Search code examples
sublimetext3eslintsuppress-warningssublimelinter

How to suppress warnings in sublimelinter using eslint?


I'm using sublime as my IDE, and have downloaded sublimelinter for linting my javascript with eslint. In the sublimelinter.sublimesettings file, I have it configured to use eslint shown below:

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

My problem is I can't find anything online to suppress the warnings that come from eslint. I've tried using "ignore": "W" as a value within eslint but it didn't work. Eslint works fine, I just can't seem to find a solution to suppressing the warnings. Any ideas?

EDIT: Here's my .eslintrc file:

{
  /* 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
  }
}

Solution

  • The --quiet flag will suppress all warnings, but does not silence errors. Via the command line, you can run:

    eslint --quiet
    

    Alternatively, to have this flag automatically appended, add "quiet" to the args of the ESLint configuration, so you don't have to remember to add the flag each time.