A mighty, modern linter that helps you avoid errors and enforce conventions in your styles.
It's mighty because it:
- has over 160 built-in rules to catch errors, apply limits and enforce stylistic conventions
- understands the latest CSS syntax including custom properties and level 4 selectors
- parses CSS-like syntaxes like SCSS, Sass, Less and SugarSS
- extracts embedded styles from HTML, markdown and CSS-in-JS template literals
- automatically fixes some violations (experimental feature)
- supports plugins so you can create your own rules or make use of plugins written by the community
- is well tested with over 10000 unit tests
- supports shareable configs that you can extend or create your own of
- is unopinionated so you can tailor the linter to your exact needs
- has a growing community and is used by Facebook, GitHub and WordPress
It's easy to get started.
First, decide how you want to use stylelint:
- on the command line
- in your text editor, for example in VS Code
- in for your build tool, for example in webpack
- via the Node API
- as a PostCSS plugin
Then, create your configuration object.
You can either extend a shared configuration or craft your own.
Extend a shared configuration
It's the quickest way to get started. We suggest extending either:
The recommended one turns on the possible error rules. The standard config builds on it by turning on over 60 of the stylistic rules with sensible defaults. We update these configs with each release of stylelint, so it's easy to stay up to date.
However, you can use a community config, for example
stylelint-config-recommended-scss, if you use non-standard syntax like
You can always override rules after extending any config. You may also want to add some rules that limit language features as these will be specific to your team and/or project.
Craft your own config
Alternatively, you can learn about the rules and then either:
- start small and add only the rules you want to turn on
- copy, paste and adapt this example configuration which lists all of the rules and their primary options
You'll find detailed information on customising stylelint in our guides:
Please create a new issue if you think you've found a bug or if you have feature request.
If you're upgrading, read our CHANGELOG to learn what changes to expect in the latest version.
There is a lot of work to do. Please help out in any way. You can:
- get involved in any open issue or pull request
- create, enhance and debug rules using our working on rules guide
- improve the documentation
- add new tests to absolutely anything
- improve the performance of rules
- open new issues about your ideas for making stylelint better
- open a pull request to show us how your idea works
- create or contribute to ecosystem tools, for example the plugin for VS Code
If you're interested in the project vision, you can read our VISION document.
Semantic Versioning Policy
We have a semantic versioning policy. Any minor update may report more errors than the previous release. As such, we recommend using the tilde (
"stylelint": "~7.2.0" to guarantee the results of your builds.
This project exists thanks to all these people. Contribute.
Thank you to all our backers! Become a backer.
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. Become a sponsor.