New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: nested plugins cannot be found when nested in a shared config (6.0.0) #11884
Bug: nested plugins cannot be found when nested in a shared config (6.0.0) #11884
Conversation
Honoring Interestingly, honoring |
"awesome/is-awesome": [2] | ||
} | ||
}; | ||
const actual = getConfig(factory, file); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This throws with:
Error: Failed to load plugin 'awesome' declared in '.eslintrc.yml » eslint-config-awesome': Cannot find module 'eslint-plugin-awesome'
Require stack:
- /private/var/folders/j6/0rhhpj0x0db7yqhhby7x27_r0000gn/T/eslint/fixtures/config-hierarchy/nested-plugins-parser/__placeholder__.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.resolve (internal/modules/cjs/helpers.js:32:19)
at Object.resolve (lib/shared/relative-module-resolver.js:44:50)
at ConfigArrayFactory._loadPlugin (lib/cli-engine/config-array-factory.js:840:39)
at names.reduce (lib/cli-engine/config-array-factory.js:729:33)
at Array.reduce (<anonymous>)
at ConfigArrayFactory._loadPlugins (lib/cli-engine/config-array-factory.js:725:22)
at ConfigArrayFactory._normalizeObjectConfigDataBody (lib/cli-engine/config-array-factory.js:551:32)
at _normalizeObjectConfigDataBody.next (<anonymous>)
at ConfigArrayFactory._normalizeObjectConfigData (lib/cli-engine/config-array-factory.js:490:20)
at _normalizeObjectConfigData.next (<anonymous>)
at ConfigArrayFactory._normalizeObjectConfigDataBody (lib/cli-engine/config-array-factory.js:544:25)
at _normalizeObjectConfigDataBody.next (<anonymous>)
at ConfigArrayFactory._normalizeObjectConfigData (lib/cli-engine/config-array-factory.js:490:20)
at _normalizeObjectConfigData.next (<anonymous>)
at createConfigArray (lib/cli-engine/config-array-factory.js:306:25)
at ConfigArrayFactory.loadInDirectory (lib/cli-engine/config-array-factory.js:399:16)
at CascadingConfigArrayFactory._loadConfigInAncestors (lib/cli-engine/cascading-config-array-factory.js:293:46)
at CascadingConfigArrayFactory.getConfigArrayForFile (lib/cli-engine/cascading-config-array-factory.js:238:18)
at getConfig (tests/lib/cli-engine/cascading-config-array-factory.js:144:22)
at Context.it (tests/lib/cli-engine/cascading-config-array-factory.js:590:32)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug output leading up to the failure:
eslint:config-array-factory Loading YAML config file: /private/var/folders/j6/0rhhpj0x0db7yqhhby7x27_r0000gn/T/eslint/fixtures/config-hierarchy/nested-plugins-parser/.eslintrc.yml +0ms
eslint:config-array-factory Config file found: /private/var/folders/j6/0rhhpj0x0db7yqhhby7x27_r0000gn/T/eslint/fixtures/config-hierarchy/nested-plugins-parser/.eslintrc.yml +5ms
eslint:config-array-factory Loading {extends:"awesome"} relative to /private/var/folders/j6/0rhhpj0x0db7yqhhby7x27_r0000gn/T/eslint/fixtures/config-hierarchy/nested-plugins-parser/.eslintrc.yml +15ms
eslint:config-array-factory Loaded: eslint-config-awesome@1.0.0 (/private/var/folders/j6/0rhhpj0x0db7yqhhby7x27_r0000gn/T/eslint/fixtures/config-hierarchy/nested-plugins-parser/node_modules/eslint-config-awesome/index.js) +1ms
eslint:config-array-factory Loading JS config file: /private/var/folders/j6/0rhhpj0x0db7yqhhby7x27_r0000gn/T/eslint/fixtures/config-hierarchy/nested-plugins-parser/node_modules/eslint-config-awesome/index.js +0ms
eslint:config-array-factory Loading parser "awesome-parser" from /private/var/folders/j6/0rhhpj0x0db7yqhhby7x27_r0000gn/T/eslint/fixtures/config-hierarchy/nested-plugins-parser/node_modules/eslint-config-awesome/index.js +1ms
eslint:config-array-factory Loaded: awesome-parser@1.0.0 (/private/var/folders/j6/0rhhpj0x0db7yqhhby7x27_r0000gn/T/eslint/fixtures/config-hierarchy/nested-plugins-parser/node_modules/eslint-config-awesome/node_modules/awesome-parser/index.js) +2ms
eslint:config-array-factory Loading plugin "awesome" from /private/var/folders/j6/0rhhpj0x0db7yqhhby7x27_r0000gn/T/eslint/fixtures/config-hierarchy/nested-plugins-parser/node_modules/eslint-config-awesome/index.js +1ms
eslint:config-array-factory Failed to load plugin 'awesome' declared in '.eslintrc.yml » eslint-config-awesome'. +1ms
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that the ConfigArrayFactory is trying to resolve plugin 'awesome' relative to the root package, not eslint-config-awesome (but the require stack thinks otherwise)
relativeTo
points to:
eslint/fixtures/config-hierarchy/nested-plugins-parser/__placeholder__.js
Hi. Thank you for your contribution. But this is by design. All plugins must be in |
Ah, doh :( Thanks for the background 👍 That's a tricky set of constraints to navigate… |
TL;DR: if a shared config package has plugins that npm or yarn decides to install as descendents of it, those plugins cannot be found by the config factory.
This is a reproduction PR to highlight the issue—I haven't determined a fix yet, and would love pointers if you all have ideas!
What is the purpose of this pull request? (put an "X" next to item)
[x] Bug report (template)
Tell us about your environment
Please show your full configuration:
See the fixtures for real files
Package Layout & Configuration
Package Tree:
<root>/.eslintrc.yml
:eslint-config-awesome/index.js
:What did you do? Please include the actual source code causing the issue.
eslint any-file.js
What did you expect to happen?
Eslint would make it to linting the desired file
What actually happened? Please include the actual, raw output from ESLint.