最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Nested .eslintrc files in Visual Studio Code - Stack Overflow

programmeradmin3浏览0评论

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.

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.

Share Improve this question asked Aug 14, 2017 at 6:45 ankit_mankit_m 4672 gold badges5 silver badges16 bronze badges 1
  • i believe this is you're answer – Zakaria Mansouri Commented Jan 5, 2018 at 21:17
Add a ment  | 

1 Answer 1

Reset to default 15

Add "root": true to your .eslintrc in your client directory.

From similar question and its answer: https://stackoverflow./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/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.

发布评论

评论列表(0)

  1. 暂无评论