css - scss-lint.yml 不工作

标签 css sass scss-lint

我遇到了 scss-lint 的小问题,我试图在一个简单的文件中运行,并且在更改 scss-lint.yml 之后,仍然没有加载我的配置。

scss 文件:_headlines.scss

// Headlines

%headline-primary {
  @include rem-size(60px);
  color: palette(grey, light); 
  font-weight: $font-weight--book;
  line-height: $line-height-base;
  margin-top: 0;
}

scss-lint.yml

# Default application configuration that all configurations inherit from.

scss_files: "scss/**/*.scss"
plugin_directories: ['.scss-linters']

# List of gem names to load custom linters from (make sure they are already
# installed)
plugin_gems: []

# Default severity of all linters.
severity: warning

linters:
  ColorKeyword:
    enabled: false

  ColorVariable:
    enabled: false

使用的命令行:

 scss-lint scss/_headlines.scss 

文件结构:

enter image description here

scss/_headlines.scss:5:1 [W] TrailingWhitespace: Line contains trailing whitespace
scss/_headlines.scss:5:18 [W] ColorKeyword: Color `grey` should be written in hexadecimal form as `#808080`
scss/_headlines.scss:5:18 [W] ColorVariable: Color literals like `grey` should only be used in variable declarations; they should be referred to via variable everywhere else.
scss/_headlines.scss:9:1 [W] FinalNewline: Files should end with a trailing newline

ColorKeyword 在我的 scss-lint.yml 中被定义为 false 但仍在运行有人知道发生了什么吗?

最佳答案

scss-lint documentation ,指定以下内容:

Configuration

scss-lint loads configuration in the following order of precedence:

  1. Configuration file specified via the --config flag
  2. Configuration from .scss-lint.yml in the current working directory, if it exists
  3. Configuration from .scss-lint.yml in the user's home directory, if it exists

All configurations extend the default configuration.

当前工作目录 scss-lint-test 中没有 .scss-lint.yml。因此,它将使用默认配置。

要解决此问题,请将您的 YML 文件移至 scss-lint-test,或从 scss 文件夹运行 scss-lint

关于css - scss-lint.yml 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39207570/

相关文章:

node.js - Node Sass 版本 7.0.1 与 Mac 中 React 中的 ^4.0.0 不兼容

css - Ionic 2 动画(使用 Angular2)=> 来自 variable.scss 的颜色, `Failed to execute ' animate' on 'Element' : Partial keyframes are not supported

npm - 在没有 Python 的情况下使用 npm 安装 scss-lint

css - stylelint 规则黑名单特定选择器

html - 加载程序未在 Angular 4 webapp 中居中对齐

html - css 列表错位

javascript - 如何根据通过 JavaScript 添加的类更改元素的::before 内容?

css - 透明文本与CSS

html - 工具提示底部定位

html - 如何为多个不重叠的外部和内部 div 添加线条边框