future-architect / eslint-plugin-vue-scoped-css

ESLint plugin for Scoped CSS in Vue.js
https://future-architect.github.io/eslint-plugin-vue-scoped-css/
MIT License
97 stars 9 forks source link

not only BEM #48

Open max-norin opened 4 years ago

max-norin commented 4 years ago

vue-scoped-css/no-unused-selector rule has ignoreBEMModifier option Besides BEM, there are other ways to organize CSS code. For example RSCCS, where the modifier is defined as in the following code. More details here.

.like-button {
  &.-wide { /* ... */ }
  &.-short { /* ... */ }
  &.-disabled { /* ... */ }
}

Also, development teams can use custom modifier naming. Сreator of the stylelint-selector-bem-pattern made it possible to specify a regular expression to define a modifier. Maybe you should pay attention to this.

ota-meshi commented 4 years ago

Thank you for this issue!

I am not familiar with RSCCS. Can you write a detailed specification of the features you want to add, in this issue? Also, can you open a pull request after that?

max-norin commented 4 years ago

For example, replace ignoreBEMModifier option with:

ignoreModifier: {
   // The preset patterns are available: bem and rscc
   preset: 'bem'|'rscc',
   // Array of regular expressions or strings defining custom modifier naming
   list: [
     '/{componentSelector}--{modifier}/', // this regular expression match bem 
     '/{componentSelector}\\.-{modifier}/', // this regular expression match rscc
     '&--warn', '&--error', // this strings match bem where as modifiers there can only be `warn` and `error`
     '&.-warn', '&.-error', // this strings match rscc where as modifiers there can only be `warn` and `error`
     '/{componentSelector}-{modifier}/', // this regular expression match custom modifier naming
     '/{componentSelector}---{modifier}/', // this regular expression match custom modifier naming
     '/{componentSelector}.{modifier}/', // this regular expression match custom modifier naming
   ]
}