Sublime Text 3 Typescript Tab Indentation and Single Quote Not Allowed

1.1k views Asked by At

Hi I am using sublime 3 to build a node.js server in typescript language. The editor always gives me two errors making no sense. One is that it asks me to use double quote instead of single quote. The other one is that it only allows double space as indentation.

Here is how does it look like: issue screen shot

Here is my SublimeLinter User Settings:

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

}

The issues don't actually effect the project but the error signs do annoy me a lot. Does anyone have any idea to fix it?

1

There are 1 answers

0
groteworld On BEST ANSWER

You need to tell SublimeLinter-contrib-tslint to not report these warnings. The easiest way to to add a tslint.json file to your computer and then change your SublimeLinter.sublime-settings file to look like below.

tslint.json

{
    "rules": {
        "indent": false,
        "quotemark": false,
    }
}

SublimeLinter.sublime-setting

{
"user": {
    "debug": false,
    "delay": 0.25,
    "error_color": "D02000",
    "gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
    "gutter_theme_excludes": [],
    "lint_mode": "background",
    "linters": {
        "jshint": {
            "@disable": false,
            "args": [],
            "excludes": []
        },
        "tslint": {
            "@disable": false,
            "args": [],
            "excludes": [],
            "indent": 4,
            "config_filename": "tsconfig.json"
        }
    },
    "mark_style": "outline",
    "no_column_highlights_line": true,
    "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",
        "magicpython": "python",
        "php": "html",
        "python django": "python",
        "pythonimproved": "python"
    },
    "warning_color": "DDB700",
    "wrap_find": true
}

NOTE: the added "config_filename": "tsconfig.json" key value should point to the absolute path of your config file

You could also remove the SublimeLinter-contrib-tslint package as well.

For more information about the package, you can also look at the repository README file. https://github.com/lavrton/SublimeLinter-contrib-tslint