My project contains a subproject with its own .eslintrc
(ie under ./path/to/subproject
)
I'm trying to run lint
but it either goes to the root project .eslintrc
file or it can't find the .eslintrc
file
I've tried the following configurations in package.json
:
cd path/to/subproject
and:
"lint": "tsc && eslint -c .eslintrc.js ./**/*.ts --"
or
"lint": "tsc && eslint -c ./.eslintrc.js ./**/*.ts --"
Also tried in root dir:
"lint": "tsc && eslint -c path/to/subproject/.eslintrc.js ./**/*.ts --"
or
"lint": "tsc && eslint -c .eslintrc.js ./**/*.ts --"
with
npm run lint --prefix path/to/subproject/
But it keeps referring the root project .eslintrc
file:
Oops! Something went wrong! :(
ESLint: 6.4.0.
ESLint couldn't find the config "configname" to extend from. Please check that the name of the config is correct.
The config "configname" was referenced from the config file in "/home/vsts/work/1/s/.eslintrc.js". <-- this is the wrong .eslintrc
The environment is Azure DevOps pipeline with Ubuntu 16.04
So it looks like eslint
supports this
What I had to do is add "root": true
to my eslint config file, it now looks something like this:
module.exports = {
"extends": [
"configname"
],
"root": true
}
See documentation here
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.