All Projects → csstree → Stylelint Validator

csstree / Stylelint Validator

Licence: mit
Stylelint plugin to validate CSS syntax

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Stylelint Validator

gulp-html
Gulp plugin for HTML validation, using the official Nu Html Checker (v.Nu)
Stars: ✭ 70 (+9.38%)
Mutual labels:  w3c, validator
Unicorn
Unicorn - W3C's Unified Validator
Stars: ✭ 70 (+9.38%)
Mutual labels:  w3c, validator
Validate
A simple jQuery plugin to validate forms.
Stars: ✭ 298 (+365.63%)
Mutual labels:  validator, plugin
Postcss Less
PostCSS Syntax for parsing LESS
Stars: ✭ 93 (+45.31%)
Mutual labels:  stylelint, syntax
spec-prod
GitHub Action to build ReSpec/Bikeshed specs, validate output and publish to GitHub pages or W3C
Stars: ✭ 19 (-70.31%)
Mutual labels:  w3c, validator
Nord Jetbrains
An arctic, north-bluish clean and elegant JetBrains IDE UI and editor color theme.
Stars: ✭ 293 (+357.81%)
Mutual labels:  plugin, syntax
Webmention.rocks
a webmention validator and test suite
Stars: ✭ 11 (-82.81%)
Mutual labels:  w3c, validator
Flake8
The official GitHub mirror of https://gitlab.com/pycqa/flake8
Stars: ✭ 1,112 (+1637.5%)
Mutual labels:  stylelint
Pure Css3 Animated Border
Pure CSS3 animated border for all html element.
Stars: ✭ 63 (-1.56%)
Mutual labels:  plugin
Elm Syntax Highlight
Syntax highlighting in Elm
Stars: ✭ 61 (-4.69%)
Mutual labels:  syntax
Winhellounlock
KeePass 2 plugin to automatically unlock databases with Windows Hello
Stars: ✭ 61 (-4.69%)
Mutual labels:  plugin
Httpie Http2
Experimental HTTP/2 plugin for HTTPie
Stars: ✭ 61 (-4.69%)
Mutual labels:  plugin
Sublime Text Plugins For Frontend Web Development
📝 Collection of plugins for Frontend Web Development
Stars: ✭ 1,127 (+1660.94%)
Mutual labels:  plugin
Is
Micro check library in Golang.
Stars: ✭ 61 (-4.69%)
Mutual labels:  validator
Weakable Self
A Swift micro-framework to easily deal with weak references to self inside closures
Stars: ✭ 64 (+0%)
Mutual labels:  syntax
Ads
CoreDNS plugin to block ads. Inspried by PiHole.
Stars: ✭ 61 (-4.69%)
Mutual labels:  plugin
Inspector
A tiny class validation library.
Stars: ✭ 64 (+0%)
Mutual labels:  validator
Rep
A single-shot nREPL client designed for shell invocation
Stars: ✭ 64 (+0%)
Mutual labels:  plugin
Wepos
WooCommerce Point of Sale ( POS ) WordPress Plugin
Stars: ✭ 63 (-1.56%)
Mutual labels:  plugin
Vue Confirm Dialog
Simple Confirm Dialog verification plugin with Vue.js.
Stars: ✭ 62 (-3.12%)
Mutual labels:  plugin

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).

Install

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

Usage

Setup plugin in your stylelint config:

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

Options

properties

Type: Object or null
Default: null

Overrides or/and extends property definition dictionary. CSS Value Definition Syntax is used to define value's syntax. If definition starts with | it added to existing definition if any. See CSS syntax reference for default definitions.

In the following example we extend width property and defines size:

{
  "plugins": [
    "stylelint-csstree-validator"
  ],
  "rules": {
    "csstree/validator": {
      "properties": {
        "width": "| new-keyword | custom-function(<length>, <percentage>)",
        "size": "<length-percentage>"
      }
    }
  }
}

Using property definitions with the syntax <any-value> is an alternative for ignore option.

{
  "plugins": [
    "stylelint-csstree-validator"
  ],
  "rules": {
    "csstree/validator": {
      "properties": {
        "my-custom-property": "<any-value>"
      }
    }
  }
}

types

Type: Object or null
Default: null

Overrides or/and extends type definition dictionary. CSS Value Definition Syntax is used to define value's syntax. If definition starts with | it added to existing definition if any. See CSS syntax reference for default definitions.

In the following example we define new functional type my-fn() and extend color type:

{
  "plugins": [
    "stylelint-csstree-validator"
  ],
  "rules": {
    "csstree/validator": {
      "properties": {
        "some-property": "<my-fn()>"
      },
      "types": {
        "color": "| darken(<color>, [ <percentage> | <number [0, 1]> ])",
        "my-fn()": "my-fn( <length-percentage> )"
      }
    }
  }
}

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.

ignoreValue

Type: RegExp
Default: false

Defines a pattern for values that should be ignored by the validator.

{
  "plugins": [
    "stylelint-csstree-validator"
  ],
  "rules": {
    "csstree/validator": {
      "ignoreValue": "^pattern$"
    }
  }
}

In this example, the plugin will not report warnings for values that match the given pattern. Warnings will still be reported for properties.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].