I have a file structure which looks like this:
-- folder1
-- folder2
-- folder3
-- client
|-- **
|-- .eslintrc (1)
-- .eslintrc (2)
The ESLint plugin in vscode
only detects the (2) .eslintrc. I have set the working directory to `"./client". Can anyone tell me what am I doing wrong? The (1) eslintrc file is supposed to add extra rules for client code.
Add "root": true
to your .eslintrc
in your client directory.
From similar question and its answer: https://stackoverflow.com/a/37490224/1766230
You can add
root: true
to the top of any config to stop ESLint from searching parent folders for config files. So you should update your.eslintrc
and add top level property"root": true
.
From the docs: https://eslint.org/docs/user-guide/configuring#using-configuration-files-1
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 (unless root: true is specified). This option is useful when you want different configurations for different parts of a project or when you want others to be able to use ESLint directly without needing to remember to pass in the configuration file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With