Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@stylistic/stylelint-plugin

stylelint-stylistic440.7kMIT3.1.1

A collection of stylistic/formatting Stylelint rules

codeguide, css, csslint, formatting, lint, linter, stylelint, stylelint-plugin, stylistic

readme

Stylelint Stylistic

License: MIT Changelog NPM version Test Status

An updatable collection of stylistic rules for Stylelint (in plugin form).

About and purpose

Stylelint has removed 76 rules that enforce stylistic conventions. This project returns these rules to keep styles consistent with your codeguide. In addition, new rules may be added in the future.

Installation and usage

Add @stylistic/stylelint-plugin and stylelint itself to your project:

npm add -D stylelint @stylistic/stylelint-plugin

Create the .stylelintrc config file (or open the existing one), add @stylistic/stylelint-plugin to the plugins array and the rules you need to the rules list. All rules from @stylistic/stylelint-plugin need to be namespaced with @stylistic/:

{
    "plugins": [
        "@stylistic/stylelint-plugin"
    ],
    "rules": {
        // syntax rules from stylelint:
        "color-function-notation": "modern",
        "selector-max-compound-selectors": 2,

        // stylistic rules from @stylistic/stylelint-plugin:
        "@stylistic/color-hex-case": "lower",
        "@stylistic/number-leading-zero": "always",
        "@stylistic/unit-case": "lower"
    }
}

To avoid listing a lot of rules, you can use @stylistic/stylelint-config, which returns the stylistic rules removed in stylelint-config-standard and stylelint-config-recommended.


Please refer to Stylelint docs for detailed info on using this linter.

Need more?

ESLint deprecates stylistic rules, too. But you can continue to use them thanks to ESLint Stylistic.

Important documents

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

Unreleased

3.1.1 — 2024–10–04

Fixed

  • Indentation checking for property values that use dynamic expressions when using postcss-styled-syntax is now disabled (#44) (@MorevM).

3.1.0 — 2024–09–23

Added

Fixed

  • Calculation of indentation using postcss-styled-syntax custom syntax (#41) (@MorevM).

3.0.1 — 2024–08–18

Fixed

  • The context.fix, which is deprecated in `stylelint@16.8.2, is no longer used. Previously, attempts to updatestylelintto16.8.2` version resulted in multiple DeprecationWarning messages (#37).

3.0.0 — 2024–07–30

Changed

  • The plugin now requires stylelint version 16.8.0 or higher.

2.1.3 — 2024–07–29

Fixed

  • Dependencies are now updated, which fixes test fails (#29) (@ybiquitous).

2.1.2 — 2024–04–28

Fixed

  • Autofixing of @charset name by string-quotes rule (#26) (@Mouvedia).

2.1.1 — 2024–03–31

Fixed

  • block-closing-brace-empty-line-before with except: ["after-closing-brace"] false negatives for CSS Nesting (#22) (@firefoxic).
  • named-grid-areas-alignment for single-line input (#21) (@MorevM).

2.1.0 — 2024–02–18

Added

  • named-grid-areas-alignment rule (#16) (@MorevM).

2.0.0 — 2023–12–20

Changed

  • The repository renamed to stylelint-stylistic and moved to the organization of the same name.
  • The plugin is published in npm under the new name @stylistic/stylelint-plugin. Therefore, you should:
    • change the former plugin name stylelint-codeguide to the new one in the config,
    • remove the old stylelint-codeguide package from dependencies
    • install the new @stylistic/stylelint-plugin package.
  • The namespace of plugin rules has been renamed. Therefore, you should change the rules prefix from codeguide/ to @stylistic/ in the config.

1.0.2 — 2023–12–12

Updated

  • Stylelint to version 16.0.2, which fixes the use of plugins in Windows.

1.0.1 — 2023–12–10

Fixed

  • Dependency definition.

1.0.0 — 2023–12–08

Changed

  • The required version of Stylelint is now at least v16.0.1.
  • The required version of Node.js is now LTS at least v18.12, or at least v20.9.
  • The plugin is now converted to a pure ES module.

0.3.2 — 2023–10–19

Updated

  • Stylelint to ^15.11.0.
  • Node.js to >=18.16.

0.3.1 — 2023–10–13

No meaningful changes.

0.3.0 — 2023–10–13

Changed

  • Along with updating the plugin to this release, Stylelint needs to be updated to v15.10.3 as well.

Updated

0.2.2 — 2023–09–14

Fixed

  • The path to the internal module.

0.2.1 — 2023–07–08

Fixed

  • Any LTS version of Node.js on the 18th branch is now required (i.e. at least 18.12.0), not the latest.
  • Any version of Stylelint on the 15th branch is now required (i.e. at least 15.0.0), not the latest.

0.2.0 — 2023–07–01

Updated

  • Peer dependency Stylelint to 15.9.0.

0.1.5 — 2023–07–01

Fixed

  • All paths to docs.

0.1.4 — 2023–05–20

Changed

  • Reorganized package.json.

0.1.3 — 2023–03–28

Removed

  • The deprecated flag from the meta of each rule.

0.1.2 — 2023–03–28

Fixed

  • Error [ERR_REQUIRE_ESM]: require() of ES Module.

0.1.1 — 2023–03–28

Added

  • Babel until Stylelint is converted to ES Modules.

0.1.0 — 2023–03–28

Added

  • at-rule-name-case rule.
  • at-rule-name-newline-after rule.
  • at-rule-name-space-after rule.
  • at-rule-semicolon-newline-after rule.
  • at-rule-semicolon-space-before rule.
  • block-closing-brace-empty-line-before rule.
  • block-closing-brace-newline-after rule.
  • block-closing-brace-newline-before rule.
  • block-closing-brace-space-after rule.
  • block-closing-brace-space-before rule.
  • block-opening-brace-newline-after rule.
  • block-opening-brace-newline-before rule.
  • block-opening-brace-space-after rule.
  • block-opening-brace-space-before rule.
  • color-hex-case rule.
  • declaration-bang-space-after rule.
  • declaration-bang-space-before rule.
  • declaration-block-semicolon-newline-after rule.
  • declaration-block-semicolon-newline-before rule.
  • declaration-block-semicolon-space-after rule.
  • declaration-block-semicolon-space-before rule.
  • declaration-block-trailing-semicolon rule.
  • declaration-colon-newline-after rule.
  • declaration-colon-space-after rule.
  • declaration-colon-space-before rule.
  • function-comma-newline-after rule.
  • function-comma-newline-before rule.
  • function-comma-space-after rule.
  • function-comma-space-before rule.
  • function-max-empty-lines rule.
  • function-parentheses-newline-inside rule.
  • function-parentheses-space-inside rule.
  • function-whitespace-after rule.
  • indentation rule.
  • linebreaks rule.
  • max-empty-lines rule.
  • max-line-length rule.
  • media-feature-colon-space-after rule.
  • media-feature-colon-space-before rule.
  • media-feature-name-case rule.
  • media-feature-parentheses-space-inside rule.
  • media-feature-range-operator-space-after rule.
  • media-feature-range-operator-space-before rule.
  • media-query-list-comma-newline-after rule.
  • media-query-list-comma-newline-before rule.
  • media-query-list-comma-space-after rule.
  • media-query-list-comma-space-before rule.
  • no-empty-first-line rule.
  • no-eol-whitespace rule.
  • no-extra-semicolons rule.
  • no-missing-end-of-source-newline rule.
  • number-leading-zero rule.
  • number-no-trailing-zeros rule.
  • property-case rule.
  • selector-attribute-brackets-space-inside rule.
  • selector-attribute-operator-space-after rule.
  • selector-attribute-operator-space-before rule.
  • selector-combinator-space-after rule.
  • selector-combinator-space-before rule.
  • selector-descendant-combinator-no-non-space rule.
  • selector-list-comma-newline-after rule.
  • selector-list-comma-newline-before rule.
  • selector-list-comma-space-after rule.
  • selector-list-comma-space-before rule.
  • selector-max-empty-lines rule.
  • selector-pseudo-class-case rule.
  • selector-pseudo-class-parentheses-space-inside rule.
  • selector-pseudo-element-case rule.
  • string-quotes rule.
  • unicode-bom rule.
  • unit-case rule.
  • value-list-comma-newline-after rule.
  • value-list-comma-newline-before rule.
  • value-list-comma-space-after rule.
  • value-list-comma-space-before rule.
  • value-list-max-empty-lines rule.