如何使用 eslint 抑制 sublimelinter 中的警告?

How to suppress warnings in sublimelinter using eslint?

我正在使用 sublime 作为我的 IDE,并且已经下载了 sublimelinter 以使用 eslint 对我的 javascript 进行 linting。在 sublimelinter.sublimesettings 文件中,我将其配置为使用如下所示的 eslint:

{
    "user": {
        "debug": false,
        "delay": 0.25,
        "error_color": "D02000",
        "gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
        "gutter_theme_excludes": [],
        "lint_mode": "load/save",
        "linters": {
            "eslint": {
                "@disable": false,
                "args": [],
                "excludes": [],
            }
        },
        "mark_style": "outline",
        "no_column_highlights_line": false,
        "passive_warnings": true,
        "paths": {
            "linux": [],
            "osx": [],
            "windows": []
        },
        "python_paths": {
            "linux": [],
            "osx": [],
            "windows": []
        },
        "rc_search_limit": 3,
        "shell_timeout": 10,
        "show_errors_on_save": false,
        "show_marks_in_minimap": true,
        "syntax_map": {
            "html (django)": "html",
            "html (rails)": "html",
            "html 5": "html",
            "javascript (babel)": "javascript",
            "magicpython": "python",
            "php": "html",
            "python django": "python",
            "pythonimproved": "python"
        },
        "warning_color": "000000",
        "wrap_find": true
    }
}

我的问题是我在网上找不到任何东西来抑制来自 eslint 的警告。我试过在 eslint 中使用 "ignore": "W" 作为值,但它没有用。 Eslint 工作正常,我似乎无法找到抑制警告的解决方案。有任何想法吗?

编辑: 这是我的 .eslintrc 文件:

{
  /* Don't search any further for .eslintrc files */
  "root": true,
  /* See all the pre-defined configs here: https://www.npmjs.com/package/eslint-config-defaults */
  "extends": [
    "eslint:recommended",
    "defaults/configurations/google"
  ],
  "ecmaFeatures": {
    "jsx": true
  },
  "env": {
    "browser": true,
    "node": true,
    "es6": true
  },

  "globals":{
    "angular": 1,
    "phoenix": 1,
    "requirejs": 1
  },
  "rules": {
    "indent": [
      2,
      2,
      { "SwitchCase": 1 }
    ],
    /* We don't do this consistently, so disable it as it is treated as an error otherwise */
    "newline-after-var": 0,
    "dot-location": [2, "property"],
    "no-extra-semi": 1,
    "semi": 2,
    "max-len": [2, 250, 2],

    "eqeqeq": 2,
    "comma-dangle": 1,
    "no-console": 0,
    "no-debugger": 1,
    "no-extra-parens": 1,
    "no-irregular-whitespace": 0,
    "no-undef": 1,
    "no-unused-vars": 2,
    "semi-spacing": 1
  }
}

--quiet 标志将抑制所有 警告 ,但不会消除错误。通过命令行,您可以 运行:

eslint --quiet

或者,要自动附加此标志,请将 "quiet" 添加到 ESLint 配置的 args,这样您就不必每次都记住添加标志。