Skip to content

jagoncalves14/stylelint-no-ending-comma-rule

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stylelint-no-ending-comma-rule

A Stylelint plugin that checks CSS property values ending with a comma.

It adds functions to only run unit tests on files that are different between two branches or on changed files that haven't yet been commited;

stylelint-no-ending-comma-rule is released under the MIT license. Current npm package version. Follow @jagoncalves14

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.

About

A Stylelint custom rule that does not allow CSS values ending with a comma.

Resources

License

Stars

Watchers

Forks

Packages

No packages published