stylelint: Error: Undefined rule null

stylelint: Error: Undefined rule null

我刚刚在我的 Mac (OS X 10.12.6 - Sierra) 上下载了 stylelint (npm install -g stylelint) 并基本上复制并尝试修改我找到的示例配置文件here.

然后我尝试在我拥有的 CSS 文件上 运行 它,在修复我的 ~/.stylelintrc 文件中的一些拼写错误后,我最终遇到错误:

Error: Undefined rule null
at module.exports (/usr/local/lib/node_modules/stylelint/lib/utils/configurationError.js:8:28)
at Object.keys.forEach.ruleName (/usr/local/lib/node_modules/stylelint/lib/augmentConfig.js:302:13)
at Array.forEach (<anonymous>)
at normalizeAllRuleSettings (/usr/local/lib/node_modules/stylelint/lib/augmentConfig.js:297:29)
at augmentConfigBasic.then.then.then.augmentedConfig (/usr/local/lib/node_modules/stylelint/lib/augmentConfig.js:91:14)
at <anonymous>

我不知道该怎么做才能克服这个问题 - 我 不想 想尝试调试代码(我在调试自己的代码时遇到了很多问题,我希望这个工具会对我有帮助——我没有足够的带宽来尝试调试别人的代码)

帮忙?


更新: 根据要求 - 我的 ~/.stylelintrc 文件:

{
  "rules": {
    "at-rule-empty-line-before": "always",
    "at-rule-name-case": "lower",
    "at-rule-name-newline-after": "always-multi-line",
    "at-rule-name-space-after": "always-single-line",
    "at-rule-no-unknown": true,
    "at-rule-no-vendor-prefix": true,
    "at-rule-semicolon-newline-after": "always",
    "at-rule-semicolon-space-before": "never",
    "block-closing-brace-empty-line-before": "always-multi-line",
    "block-closing-brace-newline-after": "always",
    "block-closing-brace-newline-before": "always",
    "block-closing-brace-space-after": ["never-single-line", "never-multi-line"],
    "block-closing-brace-space-before": "never",
    "block-no-empty": true,
    "block-opening-brace-newline-after": "always",
    "block-opening-brace-newline-before": ["never-single-line", "never-multi-line"],
    "block-opening-brace-space-after": ["never-single-line", "never-multi-line"],
    "block-opening-brace-space-before": "always",
    "color-hex-case": "upper",
    "color-hex-length": "long",
    "color-named": "always-where-possible",
    "color-no-hex": true,
    "color-no-invalid-hex": true,
    "comment-empty-line-before": "always",
    "comment-no-empty": true,
    "comment-whitespace-inside": "always",
    "custom-property-empty-line-before": "always",
    "declaration-bang-space-after": "always",
    "declaration-bang-space-before": "always",
    "declaration-block-no-duplicate-properties": true,
    "declaration-block-no-redundant-longhand-properties": true,
    "declaration-block-no-shorthand-property-overrides": true,
    "declaration-block-semicolon-newline-after": "always",
    "declaration-block-semicolon-newline-before": "always",
    "declaration-block-semicolon-space-after": "always",
    "declaration-block-semicolon-space-before": "never",
    "declaration-block-single-line-max-declarations": 2,
    "declaration-block-trailing-semicolon": "always",
    "declaration-colon-newline-after": "always",
    "declaration-colon-space-after": "always",
    "declaration-colon-space-before": "never",
    "declaration-empty-line-before": "always",
    "declaration-no-important": true,
    "declaration-property-unit-blacklist": {},
    "declaration-property-unit-whitelist": {},
    "declaration-property-value-blacklist": {},
    "declaration-property-value-whitelist": {},
    "font-family-name-quotes": "always-where-required",
    "font-family-no-duplicate-names": true,
    "font-weight-notation": "numeric",
    "function-calc-no-unspaced-operator": true,
    "function-comma-newline-after": "always",
    "function-comma-newline-before": "always",
    "function-comma-space-after": "always",
    "function-comma-space-before": "never",
    "function-linear-gradient-no-nonstandard-direction": true,
    "function-max-empty-lines": 1,
    "function-name-case": "lower",
    "function-parentheses-newline-inside": "always",
    "function-parentheses-space-inside": "never",
    "function-url-no-scheme-relative": true,
    "function-url-quotes": "always",
    "function-whitespace-after": "always",
    "indentation": 4,
    "keyframe-declaration-no-important": true,
    "length-zero-no-unit": true,
    "max-empty-lines": 1,
    "max-line-length": 80,,
    "max-nesting-depth": 3,
    "media-feature-colon-space-after": "always",
    "media-feature-colon-space-before": "never",
    "media-feature-name-case": "lower",
    "media-feature-name-no-unknown": true,
    "media-feature-name-no-vendor-prefix": true,
    "media-feature-parentheses-space-inside": "never",
    "media-feature-range-operator-space-after": "always",
    "media-feature-range-operator-space-before": "never",
    "media-query-list-comma-newline-after": "never-multi-line",
    "media-query-list-comma-newline-before": "never-multi-line",
    "media-query-list-comma-space-after": "always",
    "media-query-list-comma-space-before": "never",
    "no-descending-specificity": true,
    "no-duplicate-selectors": true,
    "no-empty-source": true,
    "no-eol-whitespace": true,
    "no-extra-semicolons": true,
    "no-invalid-double-slash-comments": true,
    "no-missing-end-of-source-newline": true,
    "no-unknown-animations": true,
    "number-leading-zero": "never",
    "number-max-precision": 3,
    "number-no-trailing-zeros": true,
    "property-case": "lower",
    "property-no-unknown": true,
    "property-no-vendor-prefix": true,
    "rule-empty-line-before": "always",
    "selector-attribute-brackets-space-inside": "never",
    "selector-attribute-operator-space-after": "always",
    "selector-attribute-operator-space-before": "never",
    "selector-attribute-quotes": "always",
    "selector-combinator-space-after": "always",
    "selector-combinator-space-before": "never",
    "selector-descendant-combinator-no-non-space": true,
    "selector-list-comma-newline-after": "never-multi-line",
    "selector-list-comma-newline-before": "never-multi-line",
    "selector-list-comma-space-after": "always",
    "selector-list-comma-space-before": "never",
    "selector-max-attribute": 5,
    "selector-max-class": 5,
    "selector-max-combinators": 5,
    "selector-max-compound-selectors": 5,
    "selector-max-empty-lines": 1,
    "selector-max-id": 5,
    "selector-max-type": 5,
    "selector-max-universal": 5,
    "selector-no-qualifying-type": true,
    "selector-no-vendor-prefix": true,
    "selector-pseudo-class-case": "lower",
    "selector-pseudo-class-no-unknown": true,
    "selector-pseudo-class-parentheses-space-inside": "never",
    "selector-pseudo-element-case": "lower",
    "selector-pseudo-element-colon-notation": "single",
    "selector-pseudo-element-no-unknown": true,
    "selector-type-case": "lower",
    "selector-type-no-unknown": true,
    "shorthand-property-no-redundant-values": true,
    "string-no-newline": true,
    "string-quotes": "double",
    "time-min-milliseconds": 5,
    "unit-case": "lower",
    "unit-no-unknown": true,
    "value-keyword-case": "lower",
    "value-list-comma-newline-after": "never-multi-line",
    "value-list-comma-newline-before": "never-multi-line",
    "value-list-comma-space-after": "always",
    "value-list-comma-space-before": "never",
    "value-list-max-empty-lines": 1,
    "value-no-vendor-prefix": true
  }
}

"max-line-length": 80,, 行后似乎有 两个 逗号。这是无效的 JSON.

使用 JSONLint 之类的工具或具有 JSON 语法检查功能的代码编辑器将有助于发现这些问题。