Search code examples
sublimetext3sublimetextjshintsublime-text-pluginsublimelinter

How to add to the `asi` option to JSHint?


I would like to disable warnings for missing semicolons. How should I do?

Here is my config file:

{
    "user": {
        "debug": false,
        "delay": 0.25,
        "error_color": "D02000",
        "gutter_theme": "Packages/SublimeLinter/gutter-themes/Blueberry/cross/Blueberry - cross.gutter-theme",
        "gutter_theme_excludes": [],
        "lint_mode": "background",
        "linters": {
            "jshint": {
                "@disable": false,
                "args": [],
                "excludes": []
            }
        },
        "mark_style": "none",
        "no_column_highlights_line": false,
        "passive_warnings": false,
        "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",
            "php": "html",
            "python django": "python"
        },
        "warning_color": "DDB700",
        "wrap_find": true,
    }
}

Solution

  • I would recommend adding a .jshintrc file inside your project where you can add all your settings, as it is better practice rather than changing your settings globally (this way, other people would be able to use the same linter settings as you by using the same .jshintrc file).


    If you still want to change your settings globally, you can create a file with any name (.jshint.conf for example). Add your jshint settings to this file.

    Example .jshint.conf file:

    {
        "asi": true
    }
    

    Save this file somewhere (I would recommend putting it in your Packages/User).

    Now, you can just update your sublime linter settings:

    "linters": {
        "jshint": {
            "@disable": false,
            "args": [
                "--config", "c:\\Use\\Your\\Path\\To\\jshint\\settings\\jshintrc.conf"
             ],
            "excludes": []
        }
    }
    

    More on SublimeLinter-jshint: https://github.com/SublimeLinter/SublimeLinter-jshint#settings

    In the future, I recommend looking at the README for whatever plugin you're trying to configure. They are usually very detailed. That link gives you the exact instructions on setting up jshint settings globally.