visual-studio-2015 - 使用工具预览 1 Visual Studio 2015 for ESlint

标签 visual-studio-2015 eslint

我已经安装了工具预览 1 ( https://go.microsoft.com/fwlink/?LinkId=798481 ) 因为我想让 VS 检查 ESLint,现在我使用 VS-Code,如果 VS15 可以代替该任务,那就太好了。

像这样:
https://forums.meteor.com/t/eslint-now-officially-integrated-with-visual-studio-2015/23798

安装 Í 后,在 Tools 下获得“Web Code Analysis”,我可以选择 .eslintrc 来添加我自己的规则。我已经通过复制“Gulp Watch”使用的其他文件来尝试过这一点,但这不起作用。我试图更改默认规则,但没有任何 react 。

已经安装了这个并且它工作的人可以解释如何添加你自己的规则并让它工作,谢谢!

最佳答案

您确实遇到了 Tooling Preview 1 的问题,但我知道版本 2 也有类似的问题。该错误已被报告(参见 thread )。 markvp提出的解决方案解决了我的问题。这是他的帖子:

We experienced this issue too.

While they try to fix it... try this work-around...

Check the Web\External folder in your VS installation folder (often C:\Program Files (x86)\Microsoft Visual Studio 14.0) for a file named eslint.cmd

If it doesn't exist, open a command prompt in that folder and type npm install eslint

If this doesn't fix your issue (or you already had an eslint.cmd file), add the full location of that direction to your PATH environment variable. e.g. C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External.

(See google for instructions as it depends on your windows OS version).

If neither of these fix the issue, try manually deleting the eslint subfolder in the node_modules folder and the two eslint files in the Web\External folder. Then re-attempt the install above using a command prompt with elevated privileges (running as Administrator).



那么如果你添加一个 .eslintrc 文件位于项目的根目录,您可以覆盖 eslint 规则。
{
  "extends": "eslint:recommended",
  "parser": "babel-eslint",
  "env": {
    "browser": true
  },
  "globals": {
    "angular": false
  },
  "rules": {
    "quotes": [ "error", "single" ]
    // add rules here
  }
}

请注意,如果您延长 "eslint:recommanded"默认情况下已经设置了很多规则。更多信息可以在 official documentation 中找到.

关于visual-studio-2015 - 使用工具预览 1 Visual Studio 2015 for ESlint,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37566796/

相关文章:

git - Visual Studio 2015 团队资源管理器看不到现有的本地存储库克隆

javascript - ESLint 和普通控制台错误有什么区别?

javascript - JS 中嵌套三元运算符的替代方案

tfs - 在 Visual Studio Team Services 上构建特定分支

visual-studio - “Setup has detected that Visual Studio 2015 Update 3 may not be completely installed…”

reactjs - 带有依赖列表和 eslint-plugin-react-hooks 的自定义钩子(Hook)

javascript - Visual Studio Code 中的嵌套 .eslintrc 文件

javascript - 防止旧式函数声明

f# - "Target F# Runtime"变灰 - 为什么?

c++ - X3501 'main' : entrypoint not found when compiling DirectX11 . VS2015 中的 hlsl 着色器