Skip to content
A custom stylelint rule to enforce use of shorthand values.
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test
.gitignore
.travis.yml
CHANGELOG.md
LICENSE
README.md
index.js
package.json

README.md

stylelint-value-shorthand

Build Status

A stylelint custom rule to enforce use of shorthand values.

This rule will cause stylelint to warn you whenever an the preferred convention is not used.

Installation

npm install stylelint-value-shorthand

This plugin is compatible with v5.0.1+.

Details

a { /* OK */
  margin: 0
}

a { /* Not OK */
  margin: 0 0 0 0
}
a { /* OK */
  border-color: $gray $blue $black
}

a { /* Not OK */
  border-color: $gray $blue $black $blue
}

This rule applies to properties which are able to be written in shorthand.

border-color
border-radius
border-style
border-width
margin
padding

Usage

Add "stylelint-value-shorthand" to your stylelint config plugins array, then add value-shorthand to your rules, set to true.

As follows:

{
  "plugins": [
    "stylelint-value-shorthand"
  ],
  "rules": {
    "value-shorthand": true
  }
};
You can’t perform that action at this time.