不允许 Sublime Text 3 Typescript 制表符缩进和单引号

Sublime Text 3 Typescript Tab Indentation and Single Quote Not Allowed

您好,我正在使用 sublime 3 以 typescript 语言构建一个 node.js 服务器。编辑总是给我两个没有意义的错误。一是它要求我使用双引号而不是单引号。另一个是它只允许双 space 作为缩进。

这是它的样子: issue screen shot

这是我的 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": "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
}

}

这些问题实际上并没有影响项目,但错误标志确实让我很恼火。有没有人知道如何修复它?

您需要告诉 SublimeLinter-contrib-tslint 不要报告这些警告。最简单的方法是将 tslint.json 文件添加到您的计算机,然后将 SublimeLinter.sublime-settings 文件更改为如下所示。

tslint.json

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

SublimeLinter.sublime-设置

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

注意: 添加的 "config_filename": "tsconfig.json" 键值应指向配置文件的绝对路径

您也可以删除 SublimeLinter-contrib-tslint 包。

有关软件包的更多信息,您还可以查看存储库 README 文件。 https://github.com/lavrton/SublimeLinter-contrib-tslint