rstacruz / stylelint-rscss

Validate CSS with RSCSS conventions
MIT License
75 stars 6 forks source link

class-format/component: false triggers "TypeError: Cannot read property 'test' of undefined" #10

Open gmatheus opened 7 years ago

gmatheus commented 7 years ago

My stylelint config is:

{
  "extends": [
    "stylelint-config-standard",
    "stylelint-rscss/config"
  ],
  "plugins": [
    "stylelint-rscss"
  ],
  "rules": {
    "string-quotes": "single",
    "selector-no-type": true,
    "selector-no-id": true,
    "block-opening-brace-space-before": "never-multi-line",
    "rscss/no-descendant-combinator": true,
    "rscss/class-format": [
      true,
      {
        "component": false
      }
    ]
  }
}

When running using gulp-stylelint, I get this error:

TypeError: Cannot read property 'test' of undefined
    at classes.filter.c (...node_modules/stylelint-rscss/lib/class_format.js:158:30)
    at Array.filter (native)
    at validateComponent (...node_modules/stylelint-rscss/lib/class_format.js:157:30)
    at walkSelectors (...node_modules/stylelint-rscss/lib/class_format.js:81:7)
    at selectors.nodes.forEach.selector (...node_modules/stylelint-rscss/lib/helpers/walk_selectors.js:41:43)
    at Array.forEach (native)
    at selectors (...node_modules/stylelint-rscss/lib/helpers/walk_selectors.js:41:23)
    at Processor.selectors [as func] (...node_modules/stylelint-rscss/lib/helpers/flatten_rule.js:15:14)
    at Processor.process (...node_modules/stylelint-rscss/node_modules/postcss-selector-parser/dist/processor.js:34:14)
    at flattenRule (...node_modules/stylelint-rscss/lib/helpers/flatten_rule.js:16:6)
    at visitRule (...node_modules/stylelint-rscss/lib/helpers/walk_selectors.js:40:5)
    at visit (...node_modules/stylelint-rscss/lib/helpers/walk_selectors.js:23:20)
    at node.nodes.forEach.subnode (...node_modules/stylelint-rscss/lib/helpers/walk_selectors.js:29:7)
    at Array.forEach (native)
    at visit (...node_modules/stylelint-rscss/lib/helpers/walk_selectors.js:28:16)
    at walkSelectors (...node_modules/stylelint-rscss/lib/helpers/walk_selectors.js:14:3)
    at ...node_modules/stylelint-rscss/lib/class_format.js:73:5
    at Promise.resolve.then (...node_modules/stylelint/lib/lintSource.js:122:59)

It seems it happens when rscss/class-format -> component rule is set to false. Is my config file wrong or something?

rstacruz commented 7 years ago

oops! yeah it seems false is not supported here, contrary to what the docs say.

peschee commented 5 years ago

@rstacruz Is there any way to disable the rscss/class-format for components then?