scss-lint.yml 不工作

scss-lint.yml is not working

我在使用 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 

文件结构:

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