stylelint-stylistic v0.4.5
This package has been deprecated in favor of @stylistic/stylelint-plugin
As I have very few free time to take care of this plugin, I have decided to share support of it with firefoxic. As such, the new package will continue support for stylelint 16 and future update. Please note this current package will still be usable with stylelint 15 but will no longer receive fixes.
stylelint-stylistic
Plugin for endangered stylelint stylistic rules.
As of its version 15, the popular stylelint package will slowly deprecate and remove 76 stylistic rules.
The proposed solution was to move to other specialized formatting packages like prettier, but it proved to be a tedious task on large projects. Not all of them are able to shift easily and fix the potential conflicts between different linters / formatters (especially on hybrid linting environments such as CSS-in-JS).
As these endangered rules were working quite well, and alongside the stylelint recommendation, I have decided to move them to this package in order to maintain them. Only a soft migration will be need to keep them in your projects.
1. Getting started
Requirements
You will need stylelint 15.0.0 or higher as a peer dependency.
Installation
Install the package :
npm install stylelint-stylistic --save-devor
yarn add stylelint-stylistic --devUsage
Append the plugin to your stylelint configuration plugins :
{
"plugins": [
"stylelint-stylistic"
]
}Or alternatively, if you wish to use the plugin default config, you can directly extend it :
{
"extends": [
"stylelint-stylistic/config"
]
}2. Rules
All rules were moved, according to stylelint plugin convention, to the stylistic scope. If you already have some of them in your configuration, juste changed any rule to stylistic/rule.
| Rule | Auto-fixable | Category |
|---|---|---|
stylistic/color-hex-caseSpecify lowercase or uppercase for hex colors. | yes | Color |
stylistic/function-comma-newline-afterRequire a newline or disallow whitespace after the commas of functions. | yes | Function |
stylistic/function-comma-newline-beforeRequire a newline or disallow whitespace before the commas of functions. | yes | Function |
stylistic/function-comma-space-afterRequire a single space or disallow whitespace after the commas of functions. | yes | Function |
stylistic/function-comma-space-beforeRequire a single space or disallow whitespace before the commas of functions. | yes | Function |
stylistic/function-max-empty-linesLimit the number of adjacent empty lines within functions. | yes | Function |
stylistic/function-parentheses-newline-insideRequire a newline or disallow whitespace on the inside of the parentheses of functions. | yes | Function |
stylistic/function-parentheses-space-insideRequire a single space or disallow whitespace on the inside of the parentheses of functions. | yes | Function |
stylistic/function-whitespace-afterRequire or disallow whitespace after functions. | yes | Function |
stylistic/number-leading-zeroRequire or disallow a leading zero for fractional numbers less than 1. | yes | Number |
stylistic/number-no-trailing-zerosDisallow trailing zeros in numbers. | yes | Number |
stylistic/string-quotesSpecify single or double quotes around strings. | yes | String |
stylistic/unit-caseSpecify lowercase or uppercase for units. | yes | Unit |
stylistic/value-list-comma-newline-afterRequire a newline or disallow whitespace after the commas of value lists. | yes | Value list |
stylistic/value-list-comma-newline-beforeRequire a newline or disallow whitespace before the commas of value lists. | no | Value list |
stylistic/value-list-comma-space-afterRequire a single space or disallow whitespace after the commas of value lists. | yes | Value list |
stylistic/value-list-comma-space-beforeRequire a single space or disallow whitespace before the commas of value lists. | yes | Value list |
stylistic/value-list-max-empty-linesLimit the number of adjacent empty lines within value lists. | yes | Value list |
stylistic/property-caseSpecify lowercase or uppercase for properties. | yes | Property |
stylistic/declaration-bang-space-afterRequire a single space or disallow whitespace after the bang of declarations. | yes | Declaration |
stylistic/declaration-bang-space-beforeRequire a single space or disallow whitespace before the bang of declarations. | yes | Declaration |
stylistic/declaration-colon-newline-afterRequire a newline or disallow whitespace after the colon of declarations. | yes | Declaration |
stylistic/declaration-colon-space-afterRequire a single space or disallow whitespace after the colon of declarations. | yes | Declaration |
stylistic/declaration-colon-space-beforeRequire a single space or disallow whitespace before the colon of declarations. | yes | Declaration |
stylistic/declaration-block-semicolon-newline-afterRequire a newline or disallow whitespace after the semicolons of declaration blocks. | yes | Declaration block |
stylistic/declaration-block-semicolon-newline-beforeRequire a newline or disallow whitespace before the semicolons of declaration blocks. | no | Declaration block |
stylistic/declaration-block-semicolon-space-afterRequire a single space or disallow whitespace after the semicolons of declaration blocks. | yes | Declaration block |
stylistic/declaration-block-semicolon-space-beforeRequire a single space or disallow whitespace before the semicolons of declaration blocks. | yes | Declaration block |
stylistic/declaration-block-trailing-semicolonRequire or disallow a trailing semicolon within declaration blocks. | yes | Declaration block |
stylistic/block-closing-brace-empty-line-beforeRequire or disallow an empty line before the closing brace of blocks. | yes | Block |
stylistic/block-closing-brace-newline-afterRequire a newline or disallow whitespace after the closing brace of blocks. | yes | Block |
stylistic/block-closing-brace-newline-beforeRequire a newline or disallow whitespace before the closing brace of blocks. | yes | Block |
stylistic/block-closing-brace-space-afterRequire a single space or disallow whitespace after the closing brace of blocks. | no | Block |
stylistic/block-closing-brace-space-beforeRequire a single space or disallow whitespace before the closing brace of blocks. | yes | Block |
stylistic/block-opening-brace-newline-afterRequire a newline after the opening brace of blocks. | yes | Block |
stylistic/block-opening-brace-newline-beforeRequire a newline or disallow whitespace before the opening brace of blocks. | yes | Block |
stylistic/block-opening-brace-space-afterRequire a single space or disallow whitespace after the opening brace of blocks. | yes | Block |
stylistic/block-opening-brace-space-beforeRequire a single space or disallow whitespace before the opening brace of blocks. | yes | Block |
stylistic/selector-attribute-brackets-space-insideRequire a single space or disallow whitespace on the inside of the brackets within attribute selectors. | yes | Selector |
stylistic/selector-attribute-operator-space-afterRequire a single space or disallow whitespace after operators within attribute selectors. | yes | Selector |
stylistic/selector-attribute-operator-space-beforeRequire a single space or disallow whitespace before operators within attribute selectors. | yes | Selector |
stylistic/selector-combinator-space-afterRequire a single space or disallow whitespace after the combinators of selectors. | yes | Selector |
stylistic/selector-combinator-space-beforeRequire a single space or disallow whitespace before the combinators of selectors. | yes | Selector |
stylistic/selector-descendant-combinator-no-non-spaceDisallow non-space characters for descendant combinators of selectors. | yes | Selector |
stylistic/selector-max-empty-linesLimit the number of adjacent empty lines within selectors. | yes | Selector |
stylistic/selector-pseudo-class-caseSpecify lowercase or uppercase for pseudo-class selectors. | yes | Selector |
stylistic/selector-pseudo-class-parentheses-space-insideRequire a single space or disallow whitespace on the inside of the parentheses within pseudo-class selectors. | yes | Selector |
stylistic/selector-pseudo-element-caseSpecify lowercase or uppercase for pseudo-element selectors. | yes | Selector |
stylistic/selector-list-comma-newline-afterRequire a newline or disallow whitespace after the commas of selector lists. | yes | Selector list |
stylistic/selector-list-comma-newline-beforeRequire a newline or disallow whitespace before the commas of selector lists. | yes | Selector list |
stylistic/selector-list-comma-space-afterRequire a single space or disallow whitespace after the commas of selector lists. | yes | Selector list |
stylistic/selector-list-comma-space-beforeRequire a single space or disallow whitespace before the commas of selector lists. | yes | Selector list |
stylistic/media-feature-colon-space-afterRequire a single space or disallow whitespace after the colon in media features. | yes | Media feature |
stylistic/media-feature-colon-space-beforeRequire a single space or disallow whitespace before the colon in media features. | yes | Media feature |
stylistic/media-feature-name-caseSpecify lowercase or uppercase for media feature names. | yes | Media feature |
stylistic/media-feature-parentheses-space-insideRequire a single space or disallow whitespace on the inside of the parentheses within media features. | yes | Media feature |
stylistic/media-feature-range-operator-space-afterRequire a single space or disallow whitespace after the range operator in media features. | yes | Media feature |
stylistic/media-feature-range-operator-space-beforeRequire a single space or disallow whitespace before the range operator in media features. | yes | Media feature |
stylistic/media-query-list-comma-newline-afterRequire a newline or disallow whitespace after the commas of media query lists. | yes | Media query list |
stylistic/media-query-list-comma-newline-beforeRequire a newline or disallow whitespace before the commas of media query lists. | no | Media query list |
stylistic/media-query-list-comma-space-afterRequire a single space or disallow whitespace after the commas of media query lists. | yes | Media query list |
stylistic/media-query-list-comma-space-beforeRequire a single space or disallow whitespace before the commas of media query lists. | yes | Media query list |
stylistic/at-rule-name-caseSpecify lowercase or uppercase for at-rules names. | yes | At-rule |
stylistic/at-rule-name-newline-afterRequire a newline after at-rule names. | no | At-rule |
stylistic/at-rule-name-space-afterRequire a single space after at-rule names. | yes | At-rule |
stylistic/at-rule-semicolon-newline-afterRequire a newline after the semicolon of at-rules. | yes | At-rule |
stylistic/at-rule-semicolon-space-beforeRequire a single space or disallow whitespace before the semicolons of at-rules. | no | At-rule |
stylistic/indentationSpecify indentation. | yes | General / Sheet |
stylistic/linebreaksSpecify unix or windows linebreaks. | yes | General / Sheet |
stylistic/max-empty-linesLimit the number of adjacent empty lines. | yes | General / Sheet |
stylistic/max-line-lengthLimit the length of a line. | no | General / Sheet |
stylistic/no-empty-first-lineDisallow empty first lines. | yes | General / Sheet |
stylistic/no-eol-whitespaceDisallow end-of-line whitespace. | yes | General / Sheet |
stylistic/no-extra-semicolonsDisallow extra semicolons. | yes | General / Sheet |
stylistic/no-missing-end-of-source-newlineDisallow missing end-of-source newlines. | yes | General / Sheet |
stylistic/unicode-bomRequire or disallow Unicode BOM. | no | General / Sheet |
3. Contribution
All contributions are welcome, I will read all pull requests. For now, my focus will be to move all the rules to TS modules, and try to improve them.
The project uses yarn as a package manager. Once installed, clone the repository, and install the dependencies :
yarn reinstallYou will then be able to compile the library :
yarn buildSome examples are available in the examples folder as a playground zone.