Add Stylelint

npm init stylelint
npm install --save-dev stylelint-config-standard-scss

New script in package.json:

"stylelint": "stylelint \"src/**/*.scss\" --cache --formatter verbose --output-file stylelint.log || (exit 0)"

New .stylelintrc.js file in the root directory:

{
  "extends": ["stylelint-config-standard", "stylelint-config-standard-scss"]
}

New ignore in .gitignore:

# Stylelint
.stylelintcache
stylelint.log

Test

npm run stylelint

VS Code

  • Install Stylelint official extension.
  • Update settings to include scss files.