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).
$ npm install --save-dev stylelint-csstree-validator
Setup plugin in your stylelint config:
{
"plugins": [
"stylelint-csstree-validator"
],
"rules": {
"csstree/validator": true
}
}
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.
MIT