css - 我应该如何使用 stylelint 检查 SASS 文件中的缩进?

标签 css sass coding-style stylesheet stylelint

我尝试使用 stylelint 检查我的 SASS 文件。当我设置规则时

"indentation": "tab"

stylelint 抛出下一个错误

 2:1   ✖  Expected indentation of 1 tab   indentation
 3:1   ✖  Expected indentation of 1 tab   indentation
 5:1   ✖  Expected indentation of 1 tab   indentation
 8:3   ✖  Expected indentation of 1 tab   indentation
11:3   ✖  Expected indentation of 1 tab   indentation
14:3   ✖  Expected indentation of 1 tab   indentation
....

如何正确检查缩进?

更新: 顶部样式:

@import "theme/bootstrap"
@import "theme/bootstrap-theme"
@import "theme/theme"

@keyframes hide-notifi

    0%
        top: 0

    75%
        top: 0

    100%
        top: -100%

最佳答案

stylelint 目前与基于空白的 SASS 语法不兼容。

引用stylelint.io网站:

Understands CSS-like syntaxes: The linter is powered by PostCSS, so it understands any syntax that PostCSS can parse, including SCSS, SugarSS, and experimental support for Less.

你可以领养SugarSS ,这是一种基于空格的语法。当与 precss PostCSS plugin pack 组合时,您将拥有与基于空白的 SASS 相当的东西。

另一个选择是向 PostCSS 社区贡献一个 SASS 解析器。

或者,您可以使用 SASS-lint它支持 SASS 语法,但具有与 stylelint 不同的一组功能。

关于css - 我应该如何使用 stylelint 检查 SASS 文件中的缩进?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39307087/

相关文章:

html - 在移动浏览器中左右移动页面

css - Susy 响应式网格

sass - sass 后 gulp concat

c# - 'var' 的目的是什么?

html - 在 div、float 或 absolute 上自动扩展宽度?

css - 当我在里面有一个字段集时,div 高度不会扩展

jQuery 如何将一个元素移动到另一个元素中

javascript - React-tooltip 自定义类正在删除克拉

c++ - C++ 中的编码标准/编码最佳实践

c++ - 是否可以自定义 XCode 的缩进样式?