eslint-plugin-node
eslint-plugin-node copied to clipboard
Unable to easily customize recommended config due to overrides
It is difficult to override rules causing errors in .mjs
(and presumably .cjs
) files in projects, due to the use of overrides
in the recommended
config having a high specificity:
https://github.com/mysticatea/eslint-plugin-node/blob/v9.0.1/lib/configs/recommended.js#L13
This ESLint config will not work:
{
"plugins": ["node"],
"extends": ["plugin:node/recommended"],
"rules": {
"node/no-missing-import": "off"
}
}
You must use matching overrides
for .mjs
:
{
"plugins": ["node"],
"extends": ["plugin:node/recommended"],
"overrides": [
{
"files": ["*.mjs", ".*.mjs"],
"rules": {
"node/no-missing-import": "off"
}
}
]
}
Thank you for the report.
This is a bug of ESLint (eslint/eslint#11510) and has been fixed on master (eslint/eslint#11546).
For now, please use one of workarounds:
- Use
plugin:node/recommended-script
orplugin:node/recommended-module
. - Use
overrides
in your config. - Use
eslint@next
(6.0.0-alpha.1)
Can this issue be closed now, given that it sounds like it was fixed in ESLint almost 2 years ago?