我在 ubuntu 平台的 VS Code 编辑器中为 React.js 项目使用 .eslintrc.json 文件,但是,由于某些原因,VS Code 编辑器无法处理/读取 .eslintrc.json 文件。当我在 VS Code 中打开项目时,我收到以下错误:
Cannot read config file: /home/[nonrootuser]/Desktop/react-projects/.eslintrc.json Error: Unexpected end of JSON input
文件权限和所有权已正确设置,如下:
-rw-rw-r-- 1 [nonrootuser] [nonrootuser] 748 Apr 5 09:34 .eslintrc.json
但是,vs code 编辑器仍然没有处理/读取 .eslintrc.json 文件。
我的帮助将不胜感激。
最佳答案
我遇到了类似的问题,我通过将 eslintrc.json 的内容复制到新文件中,删除旧文件并将新文件重命名为 eslintrc.json 来修复该问题。我还删除了 node_modules
的内容并运行了 npm install
但由于某种原因我必须显式运行 npm install eslint-plugin-node --save-dev
.
关于javascript - 无法在 ubuntu 中读取 VS Code 中的 .eslintrc.json 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49725177/