【问题标题】:sass-lint in Visual Studio Code mixed tabs with spacesVisual Studio Code 中的 sass-lint 混合制表符与空格
【发布时间】:2017-06-17 03:18:42
【问题描述】:

我刚刚在我的 VS Code 编辑器中安装了 sass-lint 并且对于我在我的*.scss文件:

[sass-lint] Mixed tabs and spaces

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

如何禁用 sass-lint 的制表符和空格混合?

【问题讨论】:

    标签: sass visual-studio-code lint sass-lint


    【解决方案1】:

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

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

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

    缩进: - 1 - 大小:'标签'

    【讨论】:

    • 我在我的配置文件中设置了这个,它仍然抛出同样的错误。
    【解决方案2】:

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

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

    就我而言,我使用 EditorConfig for VScode。将它添加到您选择的编辑器后,只需在您的基本(根)目录中创建一个 .editorconfig 文件,并用所需的设置填充它。

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

    # 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
    

    【讨论】:

      【解决方案3】:

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

      读完这个GitHub issue

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

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

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

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

      【讨论】:

        猜你喜欢
        • 2016-08-17
        • 2021-06-20
        • 2017-07-01
        • 2011-03-28
        • 2011-04-04
        • 2019-01-24
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多