使用未定义的变量时,ESLint不会引发错误

时间:2018-12-26 09:03:39

标签: eslint

我正在将ESLint与"extends": "eslint:recommended"选项一起使用。在文档中,我看到这应该启用no-undef规则,但是如果我使用未定义的规则,则不会出现任何错误。我误会了规则吗?我的整个eslint配置:

{
  "env": {
    "browser": true,
    "node": true
  },
  "extends": ["eslint:recommended"],
  "parserOptions": {
    "ecmaVersion": 9,
    "sourceType": "module"
  },
  "rules": {
    "no-unused-vars": ["warn", { "args": "none" }],
    "no-console": "off",
    "no-var": "error",
    "quotes": ["warn", "single", { "allowTemplateLiterals": true }],
    "semi": "off"
  }
}

我还尝试在eslint config中显式使用该规则,但没有帮助。

对此问题进行任何澄清都是有帮助的。

谢谢。

0 个答案:

没有答案