项目作者: ericmasiello

项目描述 :
A slightly more opinionated stylelint configuration than stylelint-config-standard
高级语言: JavaScript
项目地址: git://github.com/ericmasiello/stylelint-config-ericmasiello.git


stylelint-config-ericmasiello

stylelint-config-ericmassielo is a slightly more opinionated stylelint configuration than stylelint-config-standard that emphasizes minimal selector specificity as means toward improved CSS scalability.

The configuration comes in two variants:

  1. A BEM (Block Element Modifier) variant that enforces kebab-case selector naming
  2. A CSS Module variant that enforces camel case selector naming

For convenience, both configurations also white-list common SCSS directives.

Install instructions

  1. # npm
  2. npm install --save-dev stylelint stylelint-config-ericmasiello
  3. # yarn
  4. yarn add -D stylelint stylelint-config-ericmasiello

Once installed, create a file in the root of your project named .stylelintrc.js.

If you prefer to use the BEM (Block Element Modifier) linting rules, set the contents to:

  1. // .stylelintrc.js
  2. module.exports = {
  3. extends: 'stylelint-config-ericmasiello/bem',
  4. };

Alternatively, if you prefer to use CSS Modules linting rules, set the contents to:

  1. // .stylelintrc.js
  2. module.exports = {
  3. extends: 'stylelint-config-ericmasiello/cssModules',
  4. };

If you need to ignore any files such as normalize.css, create a .stylelintignore file in the root of your project and list any files you need stylelint to ignore. For example:

  1. normalize.css
  2. normalize.min.css

To run the lint configuration, add a script to package.json.

  1. "scripts": {
  2. "lint:style": "stylelint \"src/**/*.{scss,css}\""
  3. }

And then run the script like so:

  1. # npm
  2. npm run lint:style
  3. # yarn
  4. yarn lint:style