@brandonkal/stylelint-csstree-validator

2.5.6 • Public • Published

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

Package Sidebar

Install

npm i @brandonkal/stylelint-csstree-validator

Weekly Downloads

2

Version

2.5.6

License

MIT

Unpacked Size

15 kB

Total Files

11

Last publish

Collaborators

  • brandonkal