Reputation: 15012
.eslintrc.json
│ ├── app1
│ └── app2
│ ├── .eslintrc.json
Running this command under app2 child package.
./node_modules/eslint/bin/eslint.js ./src/ --config .eslintrc.json
And showing this error...
Oops! Something went wrong! :(
ESLint: 8.4.1
ESLint couldn't determine the plugin "@typescript-eslint" uniquely.
- @typescript-eslint/eslint-plugin/dist/index.js (loaded in "../../.eslintrc.json )...
why ESlint still trying to access ../../.eslintrc.json in the root folder?
Upvotes: 3
Views: 2413
Reputation: 47801
From the documentation (emphasis mine):
The first way to use configuration files is via
.eslintrc.*
andpackage.json
files. ESLint will automatically look for them in the directory of the file to be linted, and in successive parent directories all the way up to the root directory of the filesystem (unlessroot: true
is specified).
So the reason why ESLint is accessing an ".eslintrc.json" file located in a parent folder is simply because that is the default behaviour. If not otherwise specified, ".eslintrc.*" files will inherit their settings from other ".eslintrc.*" files in their ancestor folders.
To prevent this behavior, set "root": true
in the ".eslintrc.json" file inside "app2", and ESLint will no longer try to access "../../.eslintrc.json" or any other configuration files up in the directory structure.
Upvotes: 5