1.1.0 โ€ข Published 1 year ago

stylelint-no-ending-comma-rule v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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.