Stylelint Config
Stylelint config enforcing an understandable and consistent code style.
Daniel Bannert's open source work is supported by the community on GitHub Sponsors
Install
npm install --dev-save browserslist stylelint @anolilab/stylelint-config
Usage
If you don’t have a .stylelintrc.cjs
, we will create the file for you after installing @anolilab/stylelint-config
.
If you already have a .stylelintrc.cjs
, then you can extend the .stylelintrc.cjs
, with @anolilab/stylelint-config
.
module.exports = {
extends: [
"@anolilab/stylelint-config",
]
};
For tailwind you need to extend the stylelint rules
module.exports = {
extends: [
"@anolilab/stylelint-config",
],
rules: {
// Only for Tailwind support
"at-rule-no-unknown": [
true,
{
ignoreAtRules: ["tailwind", "apply", "variants", "responsive", "screen", "@tailwind"],
},
],
"declaration-block-trailing-semicolon": null,
"no-descending-specificity": null,
},
};
Add this command to your package.json
scripts section
{
"scripts": {
"lint:css": "stylelint --config=./.stylelintrc.cjs '**/*.{js,jsx,tsx,ts,less,css,scss,sass}'",
"lint:css:fix": "stylelint --config=./.stylelintrc.cjs '**/*.{js,jsx,tsx,ts,less,css,scss,sass}' --fix"
}
}
Note: this package use
browserslist
to detect the correct browserslist config.
Supported Node.js Versions
Libraries in this ecosystem make the best effort to track Node.js’ release schedule. Here’s a post on why we think this is important.
Contributing
If you would like to help take a look at the list of issues and check our Contributing guild.
Note: please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
Credits
License
The anolilab javascript-style-guide is open-sourced software licensed under the MIT license