简体   繁体   English

Eslint样式指南无法在Visual Studio代码中检测到

[英]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.

相关问题 ESLint 问题:标准指南,还是流行的风格指南 - ESLint Question: Standard guide, or a popular style guide Visual Studio Code和ESLint不会检测到拼写错误,例如“ style.backgroundCOlor”。 我怎样才能解决这个问题? - Visual Studio Code and ESLint aren't detecting typos e.g. “style.backgroundCOlor”. How can I fix this? Visual Studio Code:无法将 ESLint 修复应用到文档 - Visual Studio Code: Failed to apply ESLint fixes to the document LF或CRLF的Visual Studio代码安装eslint错误 - visual studio code install eslint error for LF or CRLF 如何切换到不同的ESLint样式指南? - How can I switch to a different ESLint style guide? 带有 Airbnb 风格指南的 ESLint 不适用于所有规则 - ESLint with Airbnb style guide does not work for all rules 通过Visual Studio代码intellisense检测Javascript重载功能 - Javascript overload functions detect by visual studio code intellisense 如何使Airbnb的JavaScript样式eslint指南与React,ES6一起在vim中工作? - How to get Airbnb's JavaScript style eslint guide working in vim with react, es6? 如何将 eslint airbnb 风格指南合并成一个文件以复制到 package.json 中? - How can I concatinate the eslint airbnb style guide into one file to copy into package.json? intellij ESlint + JavaScript标准样式+代码样式方案不一致 - intellij ESlint + JavaScript Standard Style + Code Style Scheme none consistent
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM