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.gitcd stylelint-scss-config && yarn # or npm installyarn lint # or npm run lintyarn lint:fix # with auto fixCheckout 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-commityarn add -D stylelint stylelint-config-prettier stylelint-config-sass-guidelines stylelint-config-standard stylelint-order stylelint-scss pre-commitPlease 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