A shareable Stylelint configuration for enforcing best practices in CSS, SCSS, and other style sheets.
Ensure the required peer dependencies are installed before using this package:
npm install -D stylelint stylelint-config-standard-scss
To install the package, run:
npm install -D @ebarooni/stylelint-config
Extend this configuration in your .stylelintrc.json
file:
{
"extends": ["@ebarooni/stylelint-config"]
}
To simplify linting and fixing style files, add these scripts to your package.json
:
{
"scripts": {
"stylelint": "npx stylelint",
"stylelint:check": "npm run stylelint -- \"**/*.{css,scss}\"",
"stylelint:fix": "npm run stylelint -- \"**/*.{css,scss}\" --fix"
}
}
Run these commands:
- Check for style errors:
npm run stylelint:check
- Automatically fix style issues:
npm run stylelint:fix
This package supports custom rules, ignored files, and directory-specific overrides.
To exclude certain files or directories, use the ignoreFiles
field:
{
"ignoreFiles": ["example/(ios|android)/**/*.{css,scss}"]
}
If you need different rules for specific directories, use the overrides
field:
{
"overrides": [
{
"files": ["example/**/*.{css,scss}"],
"extends": ["@ebarooni/stylelint-config"]
}
]
}