Bug: `ESLint` class should not load plugins already defined in `plugins`
See original GitHub issueEnvironment
Node version: v16.9.1 npm version: v7.9.0 Local ESLint version: v7.32.0 Global ESLint version: Not found Operating System: win32 10.0.19043
What parser are you using?
Default (Espree)
What did you do?
import {ESLint} from 'eslint'
new ESLint({
baseConfig: {
extends: [
'plugin:foo/preset',
],
},
plugins: {
foo: {
configs: {
preset: {}
}
}
}
})
What did you expect to happen?
No errors.
What actually happened?
The config-array-factory
is trying to load the plugin that I’ve set in the plugins
.
node:internal/modules/cjs/loader:933
const err = new Error(message);
^
Error: Failed to load plugin 'foo' declared in 'BaseConfig': Cannot find module 'eslint-plugin-foo'
Require stack:
- CWD\__placeholder__.js
Referenced from: BaseConfig
// ...
Participation
- I am willing to submit a pull request for this issue.
Additional comments
N/A
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:8 (8 by maintainers)
Top Results From Across the Web
VSCode failed to load plugin cannot find module 'eslint- ...
i had the same issue. In your root workspace you have a .vscode folder with a settings.json . Add the following: { "eslint....
Read more >Configuration Files - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >eslint-plugin-react
However, this is not recommended, and any plugins or shareable configs that you use must be installed locally in either case. Configuration. Use ......
Read more >VS Code ESLint extension - Visual Studio Marketplace
If the folder doesn't provide one the extension looks for a global install version. If you haven't installed ESLint either locally or globally ......
Read more >[eslint] failed to load plugin 'prettier' declared in '.eslintrc.json'
I got the exact same problem. I solved this issue by removing existing eslint-config-prettier and eslint-plugin-prettier from package.json.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I took a look at this and updating CLIEngine is probably the easiest way to fix this.
I think something like that would work. In the current version, we are updating
additionalPluginPool
on the instance, but that’s too late forextends
inbaseConfig
.https://github.com/eslint/eslint/blob/e3cd1414489ceda460d593ac7e7b14f8ad45d4fc/lib/eslint/eslint.js#L435-L454
We could instead pass
additionalPluginPool
map to the constructor. CLIEngine is now an internal module, so new options on it wouldn’t be public.