[英]Eslint style guide not detect in visual studio code
My package.json contains the following 我的package.json包含以下内容
"eslint-config-airbnb-base": "^12.1.0",
"eslint-plugin-import": "^2.11.0",
and eslintrc.json
in root folder 和
eslintrc.json
在根文件夹中
{
"extends": ["airbnb-base"]
}
Also, I've installed eslint plugin in VisualStudio code, but the lint has not detected the errors in my code. 另外,我已在VisualStudio代码中安装了eslint插件,但棉绒未在我的代码中检测到错误。
You should install eslint
in your project aswell if you haven't : npm i -S eslint
. 如果
eslint
安装eslint
,也应该在项目中安装: npm i -S eslint
。
Then create a .eslint.js
in the root of your project and add the following: 然后在项目的根目录中创建一个
.eslint.js
并添加以下内容:
module.exports = { "extends": "airbnb-base" };
Install the ESLint extension for VSCode, reload VSCode. 为VSCode安装ESLint扩展,重新加载VSCode。 If it still does't work, open the command palette, search for
ESLint: Disable ESLint
, then enable it again. 如果仍然不起作用,请打开命令面板,搜索
ESLint: Disable ESLint
,然后再次启用它。
I created a sample VSCode project on github with the basics you'll need. 我在github上创建了一个示例VSCode项目,其中包含您需要的基础知识。 It worked fine on my machine, feel free to clone it.
它在我的机器上运行良好,随时可以克隆它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.