css - 如何使 SCSS linter 接受蛇形小写和带连字符的小写作为选择器命名约定

标签 css sass scss-lint

我的 SCSS linter (.scss-lint.yml) 当前设置为接受 hyphenated_lowercase CSS 选择器。

SelectorFormat:
  enabled: true
  convention: hyphenated_lowercase

最近我添加了几个使用 snake_case 的外部小部件。我也需要在我的 SCSS 文件中定位它们。最好的解决方案可能是同时接受蛇形和带连字符的小写字母。我怎样才能做到这一点?

我知道我也可以排除包含那些不符合规则的文件,但我现在正在尝试避免它。

最佳答案

我在 the official documentation 中找到您可以使用正则表达式进行选择器匹配,因此这是解决方案:

SelectorFormat:
  enabled: true
  convention: ^[a-z\d_-]+$

希望它也能帮助到其他人。

关于css - 如何使 SCSS linter 接受蛇形小写和带连字符的小写作为选择器命名约定,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38862492/

相关文章:

css - 在 SASS/SCSS 中连接特殊字符

html - float 为 : left directly below the above on new row 的元素

javascript - 使用 javascript 更改 css 值

jquery - 无法在 Highcharts 中设置字幕宽度

css - 在 Compass 中使用数据 URI 的新 Bulletproof @font-face 语法

sass - Gulp 第二次运行时将文件放入错误的目录中

javascript - Codemirror 的 SCSS linter

php - 如何使一个 block (或一个区域)在 Drupal 中 float ?

sass - 编译SCSS时我收到一条错误消息,其中指出}

css - Ionic4 背景图像