2016-11-22 58 views
1

我使用崇高作为我的IDE,并已下载sublimelinter linting我的JavaScript与eslint。在sublimelinter.sublimesettings文件,我把它配置为使用eslint如下图所示:如何使用eslint抑制sublimelinter中的警告?

{ 
    "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 
    } 
} 
+0

什么在你的'.eslintrc'文件中? – idleberg

+0

@idleberg我在编辑中添加了我的'.eslintrc'文件。 –

+0

你想忽略**所有**警告,但保持错误?如果是这样,'eslint - quiet'做你需要的吗? – Aurora0001

回答

2

--quiet标志将抑制所有警告,但不沉默的错误。通过命令行,你可以运行:

eslint --quiet 

另外,有这个标志自动添加,添加"quiet"到ESLint配置的args,所以你不必记住每次加标志。