如何在 VS Code 中使用两个不同的 .eslintrc.json?

How to use two different .eslintrc.json in VS Code?

如何在 VS Code 中为 Node.js 端 Javascript 使用一个 eslint 规则集,为客户端 Javascript 使用另一个规则集?

  • 在后端的根文件夹中使用 ./.eslintrc
  • 使用./client/.eslintrc。如果您想将客户端 linting 与后端 linting 完全分离,请在您的 ./client/.eslintrc 中添加 root: true

ESLint configuration files follow "first found" rules

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)