sass-lint in Visual Studio 代码混合制表符与空格

sass-lint in Visual Studio Code mixed tabs with spaces

我刚刚安装了 sass-lint in my VS Code 编辑器,我在 属性(line) 中设置的每一行都不断收到此错误 *.scss 个文件:

[sass-lint] Mixed tabs and spaces

VS Code中的缩进类型设置为tabs(4),设置为使用Tabs缩进。

How can I disable mixing of tabs and spaces for sass-lint?

真正的原因是:SASS Lint 无法识别您的缩进设置,它使用的是默认缩进(2 个空格)。它正在寻找 2 个空格并找到制表符。

您可以通过删除所有缩进并阅读提示来确认。

正如 Pull#725 所指出的,正确的语法是:

indentation:
  - 1
  -
    size: 'tab'

我发现 Sublime Text 3 中的 sass-lint 没有加载我的配置文件。

我读完这个 GitHub issue:

在 SublimeLinter 首选项中(首选项 -> 包设置 -> SublimeLinter -> 设置):

"linters": {
    "sass": {
        "working_dir": "${/home/myusername}"
    }
},

将文件 .sasslintrc 添加到您的主文件夹:

{
  "rules": {
    "indentation": [
      1,
      {
        "size": "tab"
      }
    ]
  }
}

为了关闭这个,我后来发现最好使用 EditorConfig 文件来预设所有工作流程设置.

这是一个插件类型的设置文件,它会预先配置所需的设置以适应您的工作流程。

In my case, I use EditorConfig for VScode. After you add it to your editor of choice, simply create a .editorconfig file in your base(root) directory and fill it with the desired settings.

例如,我的基本设置如下所示:

# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = tab
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false