This is the general settings about stylelint for scss.
The rules include stylelint-order, you can easily to order scss properties by stylelint with --fix
.
git clone https://github.com/explooosion/stylelint-scss-config.git
cd stylelint-scss-config && yarn # or npm install
yarn lint # or npm run lint
yarn lint:fix # with auto fix
Checkout the package.json and install the devDependencies.
npm install -D stylelint stylelint-config-prettier stylelint-config-sass-guidelines stylelint-config-standard stylelint-order stylelint-scss pre-commit
yarn add -D stylelint stylelint-config-prettier stylelint-config-sass-guidelines stylelint-config-standard stylelint-order stylelint-scss pre-commit
Please add the following script to package.json.
{
"scripts": {
"lint": "stylelint app/scss/**/**/**/*.scss --syntax scss",
"lint:fix": "stylelint app/scss/**/**/**/*.scss --syntax scss --fix"
},
"pre-commit": [
"lint"
],
}
Copy .stylelintrc.json
into project root directory.
If your IDE is vscode, please install the following extensions:
Now you can check your scss with the following command:
yarn lint