My former co-worker CSS code review rules as a stylelint configuration.
1. Install a compatible version of stylelint
(we express it as a peerDependency
so you can choose a version that works for you).
npm install --save-dev stylelint stylelint-config-lintheus
2. Configure your stylelint configuration file to extend this package:
{
"extends": "stylelint-config-lintheus",
"rules": {
// Add overrides and additional rules here
}
}
Lintheus doesn't support SCSS syntax yet.
Alternatively, you can use stylelint-config-recommended-scss or stylelint-config-xo-scss.
Is a joke with my former co-worker name, Matheus and linters.
Just create the .stylelintrc
file with:
cat << EOF > .stylelintrc
{
"extends": "stylelint-config-lintheus"
}
EOF
You should strive for not breaking any rule at all.
But if is a must, then, you should make an exception only on the offending line using stylelint-disable-next-line
, eg:
/* stylelint-disable-next-line selector-max-specificity */
.accordion__input:checked + .accordion__label > .accordion__label-image {
If you managed to get two or more offences in the same line, then separate the exceptions with comma, eg:
/* stylelint-disable-next-line selector-max-specificity, selector-max-compound-selectors */
.accordion__input:checked + .accordion__label > .accordion__label-content > .accordion__label-status {
- Document the decision behind every rule.
- SCSS support.