A mighty, modern style linter
Latest commit b66d6b6 Nov 13, 2018
Permalink
Failed to load latest commit information.
.github Fix template (#3392) Jun 12, 2018
bin Add system tests for CLI (#2903) Mar 23, 2018
docs Remove old <style> faq item (#3798) Nov 9, 2018
flow-typed Update flow-bin to the latest version 🚀 (#3791) Nov 12, 2018
identity Use transparent background Mar 13, 2016
lib Don't parse ignored files (#3801) Nov 13, 2018
scripts Update eslint-config-stylelint (#3733) Oct 20, 2018
system-tests Update prettier to the latest version 🚀 (#3782) Nov 8, 2018
.editorconfig Prepare docs for #2067 (#2127) Nov 27, 2016
.eslintignore Move 3rd party Flow definitions and ignore from package publication (#… Mar 15, 2018
.flowconfig Move 3rd party Flow definitions and ignore from package publication (#… Mar 15, 2018
.gitattributes Add png as binary Jul 30, 2015
.gitignore Adding yarn.lock to .gitignore file (#2943) Oct 5, 2017
.npmrc Disable package-lock (#2936) Oct 2, 2017
.prettierignore Move 3rd party Flow definitions and ignore from package publication (#… Mar 15, 2018
.remarkignore Make remark ignore the .github folder Feb 18, 2016
.travis.yml Add Node.js 10 to CIs (#3299) Jun 5, 2018
CHANGELOG.md Update CHANGELOG.md Nov 13, 2018
CONTRIBUTING.md Remove open collective from contributing doc (#3795) Nov 9, 2018
LICENSE Update license date (#3090) Jan 1, 2018
README.md Update appveyor badge id Oct 30, 2018
VISION.md Use "ID" and not "id" throughout (#3486) Jul 22, 2018
appveyor.yml Update micromatch (#3769) Nov 1, 2018
example.png Optimise example output image Jun 18, 2016
jest-setup.js Update eslint-config-stylelint to the latest version 🚀 (#3788) Nov 13, 2018
package.json Update eslint-config-stylelint to the latest version 🚀 (#3788) Nov 13, 2018

README.md

stylelint

NPM version Build Status Build status NPM Downloads Backers on Open Collective Sponsors on Open Collective

A mighty, modern linter that helps you avoid errors and enforce conventions in your styles.

Features

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
  • extracts embedded styles from HTML, markdown and CSS-in-JS object & template literals
  • parses CSS-like syntaxes like SCSS, Sass, Less and SugarSS
  • supports plugins so you can create your own rules or make use of plugins written by the community
  • automatically fixes some violations (experimental feature)
  • 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

Example output

Example

Getting started

It's easy to get started.

First, decide how you want to use stylelint:

Then create your configuration object. You can either extend a shared configuration or craft your own.

Extend a shared configuration

This is the quickest way to get started. We suggest you extend either:

The recommended config turns on just the possible error rules. The standard config extends it by turning on 60 stylistic rules. We suggest you extend the:

  • recommended config if you use a pretty printer like prettier
  • standard config if you want stylelint to enforce stylistic conventions

You may want to add rules to your config that limit language features as these will be specific to your team and/or project.

If you use language extensions, for example @if and @extends, you can use a community config like stylelint-config-recommended-scss instead.

Craft your own config

Alternatively, you can learn about the rules and then either:

Guides

You'll find detailed information on customising stylelint in our guides:

Need help?

Read our FAQ first.

If the answer to your problem isn't there, then post it on stackoverflow.

Create a new issue if:

  • you think you've found a bug
  • you have a feature request

If you're upgrading, read our CHANGELOG to learn what changes to expect in the latest version.

Help out

To help out, you can:

Our VISION document guides our work.

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 (~) in package.json e.g. "stylelint": "~7.2.0" to guarantee the results of your builds.

License

The MIT License.

Contributors

This project exists thanks to all these people. Contribute.

Backers

Thank you to all our backers! Become a backer.

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. Become a sponsor.