0

是否有可能有一个嵌套的属性列表并让 stylelint 工作?我尝试这样做,但出现以下错误:

events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: Expected pseudo-class or pseudo-element

我用这段代码试了一下:

padding: {
    left: 20px;
    top: 30px;
}

这是我目前使用的配置:

"rules": {
    "block-no-empty": true,
    "color-no-invalid-hex": true,
    "declaration-colon-space-after": "always",
    "declaration-colon-space-before": "never",
    "function-comma-space-after": "always",
    "function-url-quotes": "double",
    "media-feature-colon-space-after": "always",
    "media-feature-colon-space-before": "never",
    "media-feature-name-no-vendor-prefix": true,
    "max-empty-lines": 5,
    "number-leading-zero": "never",
    "number-no-trailing-zeros": true,
    "property-no-vendor-prefix": true,
    "rule-no-duplicate-properties": true,
    "declaration-block-no-single-line": true,
    "rule-trailing-semicolon": "always",
    "selector-list-comma-space-before": "never",
    "selector-list-comma-newline-after": "always",
    "selector-no-id": true,
    "string-quotes": "double",
    "value-no-vendor-prefix": true
}

或者是否有另一个不使用 Ruby gems 的 SCSS linter?

拥有以下信息可能会很有用:

这些是我的变量:

var postcss     = require('gulp-postcss');
var reporter    = require('postcss-reporter');
var syntax_scss = require('postcss-scss');
var stylelint   = require('stylelint');

在文件的底部是这样的:

var processors = [
            stylelint(stylelintConfig),
            reporter({
                clearMessages: true,
                throwError: false
            })
        ];

        gulp.src('style.scss')
                .pipe(postcss(
                    processors, {
                        syntax: syntax_scss
                }));

我遵循了这样的教程: http ://www.creativenightly.com/2016/02/How-to-lint-your-css-with-stylelint/

并更改了我的代码中的一些位以与网站的其余部分一起使用。

4

1 回答 1

0

This issue is due to the code not being valid css but is valid for scss.

Related: https://github.com/stylelint/stylelint/issues/1386#issuecomment-223266044

于 2016-06-02T12:20:37.643 回答