Cannot load CJS custom rules with rulesdir
when project is "type": "module"
#13921
Labels
archived due to age
This issue has been archived; please open a new issue for any further discussion
core
Relates to ESLint's core APIs and features
enhancement
This change enhances an existing feature of ESLint
evaluating
The team will evaluate this issue to decide whether it meets the criteria for inclusion
Hello ESLint team 馃槈
Env
The Context
"type": "module"
to thepackage.json
of my project.eslintrc.cjs
and it's almost workingThe "problem"
.js
extentioneslint-rules/my-rule.js
eslint --rulesdir eslint-rules src
I get this error:
The diagnostic
"type": "module"
require()
for scripts inrulesdir
(see here)From what I understand from Node.js' docs and how ESM vs CJS works, with this setup:
.cjs
extensionIt's already a CJS file but I cannot change the extension to
.cjs
because ESLint ignores files that aren't.js
(see here).The proposition
Could we maybe add
.cjs
as allowed extensions in this check?It tried this locally and it fixes my problem:
Questions
Cheers...
The text was updated successfully, but these errors were encountered: