suppress-eslint-errors
suppress-eslint-errors copied to clipboard
Latest version errors on run as it require()s ES modules
hey! excited to use this module :)
/Users/callumacrae/.nvm/versions/node/v16.13.1/lib/node_modules/suppress-eslint-errors/bin/index.js:11
const chalk = require('chalk');
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/callumacrae/.nvm/versions/node/v16.13.1/lib/node_modules/suppress-eslint-errors/node_modules/chalk/source/index.js from /Users
/callumacrae/.nvm/versions/node/v16.13.1/lib/node_modules/suppress-eslint-errors/bin/index.js not supported.
Instead change the require of /Users/callumacrae/.nvm/versions/node/v16.13.1/lib/node_modules/suppress-eslint-errors/node_modules/chalk/source/index.js in /Users/callumacrae/.nvm/ve
rsions/node/v16.13.1/lib/node_modules/suppress-eslint-errors/bin/index.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (/Users/callumacrae/.nvm/versions/node/v16.13.1/lib/node_modules/suppress-eslint-errors/bin/index.js:11:15) { code: 'ERR_REQUIRE_ESM'
}
I get errors about this and other modules which were updated by dependabot, e.g. chalk - https://github.com/chalk/chalk/releases/tag/v5.0.0
There's more than one so I'd suggest that the best fix would probably be to switch the imports out in this module rather than downgrade the other modules.
As a workaround, 2.0.4 works fine :)
I’d be happy to accept a PR that fixes the issue!
(especially if it adds a couple of integration tests for the main entry point, so that this doesn’t happen again)
I looked at the most recent version diff
Wasn't anything obvious! But I remember seeing chalk
referenced in the error message I got.
Found this: https://github.com/chalk/chalk/releases/tag/v5.0.0
If you use TypeScript, you will want to stay on Chalk 4 until TypeScript 4.6 is out. https://github.com/microsoft/TypeScript/issues/46452
It's totally fine to stay on Chalk v4. It's been stable for years.
So I think the play is just to rollback the dependency update for chalk, until TS 4.6 has had time to matriculate.
So I think the play is just to rollback the dependency update for chalk,
I already tried that, there's other modules that have been updated with the same issue too
also, this project isn't using TS - this isn't a problem that will be fixed by waiting for an update
I believe downgrading chalk
to version 4 should fix this:
https://github.com/amanda-mitchell/suppress-eslint-errors/pull/290
chalk
v5.0.1 added CJS compatibility back so upgrading might be a better choice.
With chalk 5.1.2 I still have the problem
Issue is still persisting
Fixed in 3.0.1
Thank you very much @amanda-mitchell !