stylelint-no-ending-comma-rule
v1.1.0
Published
A Stylelint custom rule that does not allow CSS values ending with a comma.
Downloads
4
Maintainers
Readme
Installation
npm install stylelint-no-ending-comma-rule
Details
Stylelint is allowing CSS property values ending with ,
. Example below:
.foo {
margin: 0,;
}
Although PostCSS considers this as something valid and actually compiles the final property as margin: 0;
, it looks a bit messy to have code like that on the codebase.
After applying this rule, Stylelint will declare that ending ,
as an error. If applying Stylelint's formatting, the code will be changed to the following:
.foo {
margin: 0;
}
Usage
Add no-ending-comma-rule
to your stylelint config plugins
array, then add "jagoncalves14/no-ending-comma-rule"
to your rules,
specifying the property for which you want to check the usage of variable.
Like so:
// .stylelintrc
{
"plugins": [
"stylelint-no-ending-comma-rule"
],
"rules": {
// ...
"jagoncalves14/stylelint-no-ending-comma-rule": true,
// ...
}
}
Note: If you project uses Prettier, its formatter actually solves this. This plugin is only recommended if your project's formatting is being solely treated by ESLint and Stylelint.
🤝 How to Contribute
Whether you're helping us fix bugs, improve the docs, or spread the word, thank you! 💪 🧡 💙
Check out our Contributing Guide for ideas on contributing and setup steps.
📝 License
Licensed under the MIT License.