0.4.5 • Published 4 months ago

stylelint-stylistic v0.4.5

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

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

main branch quality workflow latest tag release workflow NPM

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-dev

or

yarn add stylelint-stylistic --dev

Usage

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.

RuleAuto-fixableCategory
stylistic/color-hex-caseSpecify lowercase or uppercase for hex colors.yesColor
stylistic/function-comma-newline-afterRequire a newline or disallow whitespace after the commas of functions.yesFunction
stylistic/function-comma-newline-beforeRequire a newline or disallow whitespace before the commas of functions.yesFunction
stylistic/function-comma-space-afterRequire a single space or disallow whitespace after the commas of functions.yesFunction
stylistic/function-comma-space-beforeRequire a single space or disallow whitespace before the commas of functions.yesFunction
stylistic/function-max-empty-linesLimit the number of adjacent empty lines within functions.yesFunction
stylistic/function-parentheses-newline-insideRequire a newline or disallow whitespace on the inside of the parentheses of functions.yesFunction
stylistic/function-parentheses-space-insideRequire a single space or disallow whitespace on the inside of the parentheses of functions.yesFunction
stylistic/function-whitespace-afterRequire or disallow whitespace after functions.yesFunction
stylistic/number-leading-zeroRequire or disallow a leading zero for fractional numbers less than 1.yesNumber
stylistic/number-no-trailing-zerosDisallow trailing zeros in numbers.yesNumber
stylistic/string-quotesSpecify single or double quotes around strings.yesString
stylistic/unit-caseSpecify lowercase or uppercase for units.yesUnit
stylistic/value-list-comma-newline-afterRequire a newline or disallow whitespace after the commas of value lists.yesValue list
stylistic/value-list-comma-newline-beforeRequire a newline or disallow whitespace before the commas of value lists.noValue list
stylistic/value-list-comma-space-afterRequire a single space or disallow whitespace after the commas of value lists.yesValue list
stylistic/value-list-comma-space-beforeRequire a single space or disallow whitespace before the commas of value lists.yesValue list
stylistic/value-list-max-empty-linesLimit the number of adjacent empty lines within value lists.yesValue list
stylistic/property-caseSpecify lowercase or uppercase for properties.yesProperty
stylistic/declaration-bang-space-afterRequire a single space or disallow whitespace after the bang of declarations.yesDeclaration
stylistic/declaration-bang-space-beforeRequire a single space or disallow whitespace before the bang of declarations.yesDeclaration
stylistic/declaration-colon-newline-afterRequire a newline or disallow whitespace after the colon of declarations.yesDeclaration
stylistic/declaration-colon-space-afterRequire a single space or disallow whitespace after the colon of declarations.yesDeclaration
stylistic/declaration-colon-space-beforeRequire a single space or disallow whitespace before the colon of declarations.yesDeclaration
stylistic/declaration-block-semicolon-newline-afterRequire a newline or disallow whitespace after the semicolons of declaration blocks.yesDeclaration block
stylistic/declaration-block-semicolon-newline-beforeRequire a newline or disallow whitespace before the semicolons of declaration blocks.noDeclaration block
stylistic/declaration-block-semicolon-space-afterRequire a single space or disallow whitespace after the semicolons of declaration blocks.yesDeclaration block
stylistic/declaration-block-semicolon-space-beforeRequire a single space or disallow whitespace before the semicolons of declaration blocks.yesDeclaration block
stylistic/declaration-block-trailing-semicolonRequire or disallow a trailing semicolon within declaration blocks.yesDeclaration block
stylistic/block-closing-brace-empty-line-beforeRequire or disallow an empty line before the closing brace of blocks.yesBlock
stylistic/block-closing-brace-newline-afterRequire a newline or disallow whitespace after the closing brace of blocks.yesBlock
stylistic/block-closing-brace-newline-beforeRequire a newline or disallow whitespace before the closing brace of blocks.yesBlock
stylistic/block-closing-brace-space-afterRequire a single space or disallow whitespace after the closing brace of blocks.noBlock
stylistic/block-closing-brace-space-beforeRequire a single space or disallow whitespace before the closing brace of blocks.yesBlock
stylistic/block-opening-brace-newline-afterRequire a newline after the opening brace of blocks.yesBlock
stylistic/block-opening-brace-newline-beforeRequire a newline or disallow whitespace before the opening brace of blocks.yesBlock
stylistic/block-opening-brace-space-afterRequire a single space or disallow whitespace after the opening brace of blocks.yesBlock
stylistic/block-opening-brace-space-beforeRequire a single space or disallow whitespace before the opening brace of blocks.yesBlock
stylistic/selector-attribute-brackets-space-insideRequire a single space or disallow whitespace on the inside of the brackets within attribute selectors.yesSelector
stylistic/selector-attribute-operator-space-afterRequire a single space or disallow whitespace after operators within attribute selectors.yesSelector
stylistic/selector-attribute-operator-space-beforeRequire a single space or disallow whitespace before operators within attribute selectors.yesSelector
stylistic/selector-combinator-space-afterRequire a single space or disallow whitespace after the combinators of selectors.yesSelector
stylistic/selector-combinator-space-beforeRequire a single space or disallow whitespace before the combinators of selectors.yesSelector
stylistic/selector-descendant-combinator-no-non-spaceDisallow non-space characters for descendant combinators of selectors.yesSelector
stylistic/selector-max-empty-linesLimit the number of adjacent empty lines within selectors.yesSelector
stylistic/selector-pseudo-class-caseSpecify lowercase or uppercase for pseudo-class selectors.yesSelector
stylistic/selector-pseudo-class-parentheses-space-insideRequire a single space or disallow whitespace on the inside of the parentheses within pseudo-class selectors.yesSelector
stylistic/selector-pseudo-element-caseSpecify lowercase or uppercase for pseudo-element selectors.yesSelector
stylistic/selector-list-comma-newline-afterRequire a newline or disallow whitespace after the commas of selector lists.yesSelector list
stylistic/selector-list-comma-newline-beforeRequire a newline or disallow whitespace before the commas of selector lists.yesSelector list
stylistic/selector-list-comma-space-afterRequire a single space or disallow whitespace after the commas of selector lists.yesSelector list
stylistic/selector-list-comma-space-beforeRequire a single space or disallow whitespace before the commas of selector lists.yesSelector list
stylistic/media-feature-colon-space-afterRequire a single space or disallow whitespace after the colon in media features.yesMedia feature
stylistic/media-feature-colon-space-beforeRequire a single space or disallow whitespace before the colon in media features.yesMedia feature
stylistic/media-feature-name-caseSpecify lowercase or uppercase for media feature names.yesMedia feature
stylistic/media-feature-parentheses-space-insideRequire a single space or disallow whitespace on the inside of the parentheses within media features.yesMedia feature
stylistic/media-feature-range-operator-space-afterRequire a single space or disallow whitespace after the range operator in media features.yesMedia feature
stylistic/media-feature-range-operator-space-beforeRequire a single space or disallow whitespace before the range operator in media features.yesMedia feature
stylistic/media-query-list-comma-newline-afterRequire a newline or disallow whitespace after the commas of media query lists.yesMedia query list
stylistic/media-query-list-comma-newline-beforeRequire a newline or disallow whitespace before the commas of media query lists.noMedia query list
stylistic/media-query-list-comma-space-afterRequire a single space or disallow whitespace after the commas of media query lists.yesMedia query list
stylistic/media-query-list-comma-space-beforeRequire a single space or disallow whitespace before the commas of media query lists.yesMedia query list
stylistic/at-rule-name-caseSpecify lowercase or uppercase for at-rules names.yesAt-rule
stylistic/at-rule-name-newline-afterRequire a newline after at-rule names.noAt-rule
stylistic/at-rule-name-space-afterRequire a single space after at-rule names.yesAt-rule
stylistic/at-rule-semicolon-newline-afterRequire a newline after the semicolon of at-rules.yesAt-rule
stylistic/at-rule-semicolon-space-beforeRequire a single space or disallow whitespace before the semicolons of at-rules.noAt-rule
stylistic/indentationSpecify indentation.yesGeneral / Sheet
stylistic/linebreaksSpecify unix or windows linebreaks.yesGeneral / Sheet
stylistic/max-empty-linesLimit the number of adjacent empty lines.yesGeneral / Sheet
stylistic/max-line-lengthLimit the length of a line.noGeneral / Sheet
stylistic/no-empty-first-lineDisallow empty first lines.yesGeneral / Sheet
stylistic/no-eol-whitespaceDisallow end-of-line whitespace.yesGeneral / Sheet
stylistic/no-extra-semicolonsDisallow extra semicolons.yesGeneral / Sheet
stylistic/no-missing-end-of-source-newlineDisallow missing end-of-source newlines.yesGeneral / Sheet
stylistic/unicode-bomRequire or disallow Unicode BOM.noGeneral / 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 reinstall

You will then be able to compile the library :

yarn build

Some examples are available in the examples folder as a playground zone.