Package detail

@brandonkal/stylelint-csstree-validator

csstree145MIT2.5.6

Stylelint plugin to validate CSS syntax

stylelint-plugin, stylelint, csstree, css

readme

NPM version Build Status

stylelint-csstree-validator

CSS syntax validator based on csstree as plugin for stylelint. Currently it's only checking declaration values to match W3C specs and browsers extensions. It would be extended in future to validate other parts of CSS.

Validator is designed to check CSS syntax only. However PostCSS (that used by stylelint as backend) may parse other syntaxes like Less or Sass and can be used for these syntaxes too. In this case validator is limited to check declaration that doesn't contain any CSS extension (e.g. variables).

Fork

This fork allows element units (ew|eh|emin|emax). It is meant to be used with @brandonkal/postcss-element-units.

Install

$ npm install --save-dev stylelint-csstree-validator

Usage

Setup plugin in your stylelint config:

{
  "plugins": ["stylelint-csstree-validator"],
  "rules": {
    "csstree/validator": true
  }
}

Options

ignore

Type: Array or false Default: false

Defines a list of property names that should be ignored by the validator.

{
  "plugins": ["stylelint-csstree-validator"],
  "rules": {
    "csstree/validator": {
      "ignore": ["composes", "foo", "bar"]
    }
  }
}

In this example, plugin would not test declaration with property name composes, foo or bar. As a result, no warnings for these declarations.

License

MIT

changelog

1.5.2 (July 11, 2019)

1.5.1 (July 11, 2019)

1.5.0 (July 11, 2019)

1.4.1 (July 5, 2019)

  • Fixed missed console.log() (#18)

1.4.0 (July 3, 2019)

  • Added support for stylelint 10 (#17, thanks to @limonte)
  • Bumped CSSTree to 1.0.0-alpha.30

1.3.0 (May 30, 2018)

1.2.2 (February 19, 2018)

  • Bumped CSSTree to 1.0.0-alpha.28 (bug fixes)
  • Bumped stylelint to >=7.0.0 <10.0.0 and make it a peer dependency

1.2.1 (November 12, 2017)

  • Bumped CSSTree to 1.0.0-alpha.26 (improved parsing and bug fixes)

1.2.0 (September 4, 2017)

  • Bumped CSSTree to 1.0.0-alpha21 (improved parsing and updated property grammars)

1.1.1 (February 15, 2017)

  • Ignore any declaration which property name looks using a preprocessor interpolation (e.g. smth-@{foo} or smth-#{$foo})
  • Ignore values with Sass interpolation (#7)

1.1.0 (February 14, 2017)

  • Ignore Less and Sass var declarations that treats as regular declarations by PostCSS (#4)
  • Implemented ignore option to define a list of property names that should be ignored by the validator. It may be used as a workaround to avoid warnings about syntax extensions (#5)

1.0.6 (February 12, 2017)

  • Bump CSSTree to 1.0.0-alpha16
  • Ignore values with Less and Sass extensions (#3)

1.0.5 (January 19, 2017)

  • Bump CSSTree to 1.0.0-alpha12

1.0.4 (December 21, 2016)

  • Bump CSSTree to 1.0.0-alpha9

1.0.3 (November 21, 2016)

  • Bump CSSTree to 1.0.0-alpha8

1.0.2 (September 19, 2016)

  • Bump CSSTree to 1.0.0-alpha5

1.0.1 (September 17, 2016)

  • Tweak description files

1.0.0 (September 17, 2016)

  • Initial implementation