Skip to content
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

Cannot extend shared config in monorepo setup #10540

Closed
sqal opened this issue Jun 28, 2018 · 5 comments
Closed

Cannot extend shared config in monorepo setup #10540

sqal opened this issue Jun 28, 2018 · 5 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion question This issue asks a question about ESLint

Comments

@sqal
Copy link

sqal commented Jun 28, 2018

Tell 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 run npm 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().

@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Jun 28, 2018
@kaicataldo kaicataldo added question This issue asks a question about ESLint and removed triage An ESLint team member will look at this issue soon labels Jul 23, 2018
@kaicataldo
Copy link
Member

Apologies that we lost track of this. @eslint/eslint-team Any thoughts on this from others who might be more familiar with Lerna?

@kaicataldo
Copy link
Member

For my own understanding, does Lerna link packages/eslint-config to packages/app/node_modules/eslint-config?

@not-an-aardvark
Copy link
Member

I think this is the same issue as #10125.

@kaicataldo
Copy link
Member

Should we close this in favor of that issue?

@nzakas
Copy link
Member

nzakas commented Sep 19, 2018

Closing in favor of #10125.

@nzakas nzakas closed this as completed Sep 19, 2018
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Mar 19, 2019
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Mar 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion question This issue asks a question about ESLint
Projects
None yet
Development

No branches or pull requests

4 participants