【问题标题】:Sublime Text 3 Typescript Tab Indentation and Single Quote Not AllowedSublime Text 3 Typescript Tab 缩进和单引号不允许
【发布时间】:2017-05-13 06:29:57
【问题描述】:

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

下面是它的样子: 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
}

}

这些问题实际上并不影响项目,但错误迹象确实让我很恼火。有没有人有办法解决它?

【问题讨论】:

    标签: typescript sublimetext3 sublimelinter


    【解决方案1】:

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

    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
    }
    

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

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-05-02
      • 2015-04-24
      • 1970-01-01
      • 1970-01-01
      • 2023-03-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多