0.1.6 • Published 9 months ago

@web-configs/stylelint-plugin v0.1.6

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

@web-configs/stylelint-plugin

License: MIT npm version

ThunderMiracle's stylelint rules and config

Installation

Install stylelint and @web-configs/stylelint-plugin:

With Yarn

yarn add --dev stylelint @web-configs/stylelint-plugin

With npm

npm install stylelint @web-configs/stylelint-plugin --save-dev

Usage

ThunderMiracle's stylelint rules come bundled in @web-configs/stylelint-plugin. To enable these rules, add a stylelint property in your package.json. See the stylelint configuration docs for more details.

"stylelint": {
  "extends": ["@web-configs/stylelint-plugin"]
}

Now you can run stylelint by adding the following linting script to your package.json. See the stylelint CLI docs for more details.

"scripts": {
  "stylelint": "stylelint 'src/**/*.scss'"
}

Run it:

With Yarn

yarn run stylelint

With npm

npm run stylelint

Prettier

This config also includes a prettier config which can be extended to format .scss. Using the stylelint-prettier plugin, prettier changes are exposed as stylelint rule violations.

Install prettier:

$ yarn add --dev prettier

Extend the config in your package.json:

"stylelint": {
  "extends": [
    "@web-configs/stylelint-plugin/prettier"
  ]
}

Add a prettier config in package.json:

"prettier": {
  "singleQuote": true,
  "trailingComma": "es5",
  "bracketSpacing": true
}

Prettier fixes shall be reported when you run stylelint **/*.css and shall be autofixed when you run stylelint --fix **/*.scss.