linter-eslint can't find package.json in lerna repo, but the CLI can #1304
Description
Issue Type
Question
Issue Description
I have a lerna repo configured in a pretty standard way:
my-project
├── .eslintrc.json
├── package.json
└─┬ packages
├─┬ package1
| ├── .eslintrc.json
| └── package.json
└─┬ package2
├── .eslintrc.json
└── package.json
When I enter into a package directory and run yarn run lint
, everything is great. If I run lerna run lint
from the root of the repo, everything is also great (because under the hood, lerna will cd
into each package directory). However, if I open any source file in Atom, I get this error:
The package.json file could not be found. (import/no-extraneous-dependencies)
For each of my packages, I have the following defined in the local .eslintrc.json
file:
"import/no-extraneous-dependencies": ["error", {
"packageDir": [".", "../.."]
}],
This tells eslint to look at the local package.json
(the one in the package directory) and the one in the root of the repo, since we define our dependencies in both places. The fact that Atom is reporting this error suggests to me that the context (current working directory) is wrong somehow. For a lerna repo, the current working directory should be the package directory, not the root of the repo. Is there a way for linter-eslint to do the right thing here and use the package directory as the current working directory?
Bug Checklist
- Restart Atom
- Verify the
eslint
CLI gives the proper result, whilelinter-eslint
does not - Paste the output of the
Linter Eslint: Debug
command from the Command Palette below
Atom version: 1.40.1
linter-eslint version: 8.5.5
ESLint version: 6.3.0
Hours since last Atom restart: 4.7
Platform: win32
Using local project ESLint from: <redacted>\node_modules\eslint
Current file's scopes: [
"source.js",
"support.variable"
]
linter-eslint configuration: {
"disabling": {
"disableWhenNoEslintConfig": true,
"rulesToSilenceWhileTyping": []
},
"scopes": [
"source.ts",
"source.tsx",
"source.js",
"source.jsx",
"source.flow",
"source.babel",
"source.js-semantic"
],
"lintHtmlFiles": false,
"autofix": {
"fixOnSave": false,
"ignoreFixableRulesWhileTyping": false,
"rulesToDisableWhileFixing": []
},
"global": {
"useGlobalEslint": false,
"eslintrcPath": "",
"globalNodePath": ""
},
"advanced": {
"disableEslintIgnore": false,
"disableFSCache": false,
"showRuleIdInMessage": true,
"eslintRulesDirs": [],
"localNodeModules": ""
}
}