bluwy / publint

Lint packaging errors
https://publint.dev
MIT License
932 stars 19 forks source link

Upgrade warning to error #95

Open benmccann opened 2 months ago

benmccann commented 2 months ago

https://publint.dev/@growthbook/growthbook@1.0.0

./dist/esm/index.js is written in ESM, but is interpreted as CJS. Consider using the .mjs extension, e.g. ./dist/esm/index.mjs (More info) - this is breaking the library for users in SvelteKit/Vites, so it would be nice to see if be an error

Also, the one about "types" needing to come first in exports to satisfy TypeScript. I've never actually seen that break an app, so I wonder if it should be a warning?

bluwy commented 2 months ago

Escalating the written in ESM... message as an error makes sense to me. Initially I have it as a warning because the library may not be meant for normal nodejs usage, but I think it's rare these days and is always worth aligning the node default. Might be safer to only change this in the next minor.

I think the types message still makes sense as an error. Because it implies an intention for types to work, but it'll never work in practice. Warnings are reserved for things that still may work in certain environments.