2017-09-16 70 views
-1

我剛剛在我的Mac(OS X 10.12.6 - Sierra)上下載了stylelint(npm install -g stylelint),並且基本上被複制,並且試圖修改了我發現here的示例配置文件。stylelint:錯誤:未定義的規則null

我又試圖在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 
    } 
} 
+0

發佈您的'.stylelintrc'文件的內容或發佈到https://gist.github.com/ntwb並鏈接到這裏將有幫助 – netweb

回答

1

看來有在"max-line-length": 80,,行之後逗號。這是無效的JSON。

使用像JSONLint這樣的工具或者帶有JSON語法檢查的代碼編輯器將有助於發現這些。

+0

看起來就是這樣 - 稍微胖一點的打字晚了在晚上導致這樣的事情 - 我只希望有可能得到更清晰的錯誤信息...非常感謝。 –