Cannot extend shared config in monorepo setup
See original GitHub issueTell us about your environment
- ESLint Version: 5.0.1
- Node Version: 10.4.1
- npm Version: 6.1.0
What parser (default, Babel-ESLint, etc.) are you using? -
Please show your full configuration:
module.exports = {
extends: '@org/eslint-config'
};
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
Reproduction https://github.com/sqal/eslint-extends-bug-reproduction
Steps to reproduce:
- After cloning, the repo run
npm run bootstrap
- Then go to
packages/app
and runnpm run lint
What did you expect to happen? I expect eslint to find my config correctly
What actually happened? Please include the actual, raw output from ESLint.
> eslint src
Cannot find module '@org/eslint-config'
Referenced from: C:\dev\eslint-extends-bug\packages\app\.eslintrc.js
Error: Cannot find module '@org/eslint-config'
Referenced from: C:\dev\eslint-extends-bug\packages\app\.eslintrc.js
at ModuleResolver.resolve (C:\dev\eslint-extends-bug\node_modules\eslint\lib\util\module-resolver.js:72:19)
at resolve (C:\dev\eslint-extends-bug\node_modules\eslint\lib\config\config-file.js:484:28)
at load (C:\dev\eslint-extends-bug\node_modules\eslint\lib\config\config-file.js:556:26)
at configExtends.reduceRight (C:\dev\eslint-extends-bug\node_modules\eslint\lib\config\config-file.js:430:36)
at Array.reduceRight (<anonymous>)
at applyExtends (C:\dev\eslint-extends-bug\node_modules\eslint\lib\config\config-file.js:408:26)
at loadFromDisk (C:\dev\eslint-extends-bug\node_modules\eslint\lib\config\config-file.js:528:22)
at Object.load (C:\dev\eslint-extends-bug\node_modules\eslint\lib\config\config-file.js:564:20)
at Config.getLocalConfigHierarchy (C:\dev\eslint-extends-bug\node_modules\eslint\lib\config.js:227:44)
at Config.getConfigHierarchy (C:\dev\eslint-extends-bug\node_modules\eslint\lib\config.js:179:43)
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! app@1.0.0 lint: `eslint src`
npm ERR! Exit status 2
In the error logs we see that the error originates at ModuleResolver.resolve (C:\dev\eslint-extends-bug\node_modules\eslint\lib\util\module-resolver.js:74:19)
. I added console log after line#62 and these are the paths that eslint tries to search through:
[
'C:\\dev\\eslint-extends-bug\\node_modules\\node_modules',
'C:\\dev\\eslint-extends-bug\\node_modules\\eslint\\lib\\util\\node_modules',
'C:\\dev\\eslint-extends-bug\\node_modules\\eslint\\lib\\node_modules',
'C:\\dev\\eslint-extends-bug\\node_modules\\eslint\\node_modules',
'C:\\dev\\eslint-extends-bug\\node_modules',
'C:\\dev\\node_modules',
'C:\\node_modules',
'C:\\Users\\pc\\.node_modules',
'C:\\Users\\pc\\.node_libraries',
'C:\\Program Files\\nodejs\\lib\\node'
]
so looks like we’re missing here path to node_modules
relative to process.cwd()
.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
Closing in favor of #10125.
Should we close this in favor of that issue?