Open nirtamir2 opened 1 year ago
Do you have a public example to link to? Is your plugin compiled to CJS? Or are you using flat config? (#376).
Thank you for your fast response!
Do you have a public example to link to? Is your plugin compiled to CJS? Or are you using flat config? (#376).
https://github.com/nirtamir2/eslint-plugin-default-import-name
https://github.com/nirtamir2/eslint-plugin-default-import-name/commit/7c545cfddbb289f3bffdcedd665eb6c31bbe723d - this is the commit I converted to ESM only. I did not want to lose the eslint-doc-generator
so I reverted it later
With ESM, you still have a build command and compiled CJS output, right? If this is the case, then the solution is normally to just ensure the build runs before running eslint-doc-generator: https://github.com/bmish/eslint-doc-generator#build-tools
{
"build": "tsc",
"update:eslint-docs": "npm run build && eslint-doc-generator"
}
Not if they’re using native ESM.
@bmish I ran into this with a new native ESM project. Because "main"
in package.json points to an ESM file, I end up with this error.
You can probably somewhat account for this by checking "exports"
field for a CommonJS entrypoint, though at this point, I don't know that you can rely on packages to continue publishing CommonJS entrypoints.
Those that stop doing so almost universally leave the majority of their users stuck on the last version to do so, so i think that's still something that can be relied on.
Hi! Thank you for creating this tool! I would like to create ESM only ESLint plugin, and this rule tries to require stuff inside so it's not compatible I would like it to work with ESM.
Thanks!