Apply Stylelint to your project's CSS with the following steps:
-
NPM Script
-
Go to directory:
devTools/ -
Add Stylelint & stylistic/stylelint-plugin
npm install --save-dev stylelint stylelint-config-standard npm install --save-dev @stylistic/stylelint-plugin
-
Add a script entry to your
package.json: -
Run the linter:
npm run lint:css:check npm run lint:css:fix
-
-
CLI Usage
- Lint all CSS files:
npx stylelint ../app/core/src/main/**/*.css ../app/proprietary/src/main/resources/static/css/*.css
- Lint a single file:
npx stylelint ../app/proprietary/src/main/resources/static/css/audit-dashboard.css
- Apply automatic fixes:
npx stylelint "../app/core/src/main/**/*.css" "../app/proprietary/src/main/resources/static/css/*.css" --fix
- Lint all CSS files:
For full configuration options and rule customization, refer to the official documentation: https://stylelint.io
{ "scripts": { "lint:css:check": "stylelint \"../app/core/src/main/**/*.css\" \"../app/proprietary/src/main/resources/static/css/*.css\" --config ../.stylelintrc.json", "lint:css:fix": "stylelint \"../app/core//src/main/**/*.css\" \"../app/proprietary/src/main/resources/static/css/*.css\" --config .stylelintrc.json --fix" } }