1 | # stylelint
|
2 |
|
3 | [![NPM version](https://img.shields.io/npm/v/stylelint.svg)](https://www.npmjs.org/package/stylelint) [![Build Status](https://travis-ci.com/stylelint/stylelint.svg?branch=master)](https://travis-ci.com/stylelint/stylelint) [![Build status](https://ci.appveyor.com/api/projects/status/o60hlhki49t2333i/branch/master?svg=true)](https://ci.appveyor.com/project/stylelint/stylelint/branch/master) [![NPM Downloads](https://img.shields.io/npm/dm/stylelint.svg)](https://npmcharts.com/compare/stylelint?minimal=true) [![Backers on Open Collective](https://opencollective.com/stylelint/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/stylelint/sponsors/badge.svg)](#sponsors)
|
4 |
|
5 | A mighty, modern linter that helps you avoid errors and enforce conventions in your styles.
|
6 |
|
7 | ## Features
|
8 |
|
9 | It's mighty because it:
|
10 |
|
11 | - understands the **latest CSS syntax** including custom properties and level 4 selectors
|
12 | - extracts **embedded styles** from HTML, markdown and CSS-in-JS object & template literals
|
13 | - parses **CSS-like syntaxes** like SCSS, Sass, Less and SugarSS
|
14 | - has over **170 built-in rules** to catch errors, apply limits and enforce stylistic conventions
|
15 | - supports **plugins** so you can create your own rules or make use of plugins written by the community
|
16 | - automatically **fixes** some violations (*experimental feature*)
|
17 | - is **well tested** with over 10000 unit tests
|
18 | - supports **shareable configs** that you can extend or create your own of
|
19 | - is **unopinionated** so you can tailor the linter to your exact needs
|
20 | - has a **growing community** and is used by [Facebook](https://code.facebook.com/posts/879890885467584/improving-css-quality-at-facebook-and-beyond/), [GitHub](https://github.com/primer/stylelint-config-primer) and [WordPress](https://github.com/ntwb/stylelint-config-wordpress/)
|
21 |
|
22 | ## Example output
|
23 |
|
24 | ![Example](https://github.com/stylelint/stylelint/raw/master/example.png?raw=true)
|
25 |
|
26 | ## Getting started
|
27 |
|
28 | It's easy to get started.
|
29 |
|
30 | First, decide how you want to use stylelint:
|
31 |
|
32 | - [on the command line](docs/user-guide/cli.md)
|
33 | - [in your text editor](docs/user-guide/complementary-tools.md#editor-plugins), for example in VS Code
|
34 | - [in for your build tool](docs/user-guide/complementary-tools.md#build-tool-plugins), for example in webpack
|
35 | - [via the Node.js API](docs/user-guide/node-api.md)
|
36 | - [as a PostCSS plugin](docs/user-guide/postcss-plugin.md)
|
37 |
|
38 | Then create your [configuration object](docs/user-guide/configuration.md). You can either extend a shared configuration or craft your own.
|
39 |
|
40 | ### Extend a shared configuration
|
41 |
|
42 | This is the quickest way to get started. We suggest you extend either:
|
43 |
|
44 | - [`stylelint-config-recommended`](https://github.com/stylelint/stylelint-config-recommended)
|
45 | - [`stylelint-config-standard`](https://github.com/stylelint/stylelint-config-standard)
|
46 |
|
47 | The recommended config turns on just the [possible error](docs/user-guide/rules.md#possible-errors) rules. The standard config extends it by turning on 60 [stylistic rules](docs/user-guide/rules.md#stylistic-issues). We suggest you extend the:
|
48 |
|
49 | - recommended config if you use a pretty printer like [prettier](https://prettier.io/)
|
50 | - standard config if you want stylelint to enforce stylistic conventions
|
51 |
|
52 | You may want to add rules to your config that [limit language features](docs/user-guide/rules.md#limit-language-features) as these will be specific to your team and/or project.
|
53 |
|
54 | *If you use language extensions, for example `@if` and `@extends`, you can use a community config like [`stylelint-config-recommended-scss`](https://github.com/kristerkari/stylelint-config-recommended-scss) instead.*
|
55 |
|
56 | ### Craft your own config
|
57 |
|
58 | Alternatively, you can [learn about the rules](docs/user-guide/about-rules.md) and then either:
|
59 |
|
60 | - start small and add only [the rules](docs/user-guide/rules.md) you want to turn on
|
61 | - copy, paste and adapt [this example configuration](docs/user-guide/example-config.md) which lists all of the rules and their primary options
|
62 |
|
63 | ## Guides
|
64 |
|
65 | You'll find detailed information on customising stylelint in our guides:
|
66 |
|
67 | - [user guide](docs/user-guide.md) - how to use and configure stylelint
|
68 | - [developer guide](docs/developer-guide.md) - how to develop for stylelint
|
69 |
|
70 | ## Need help?
|
71 |
|
72 | Read our [FAQ](docs/user-guide/faq.md) first.
|
73 |
|
74 | If the answer to your problem isn't there, then post it on [stackoverflow](https://stackoverflow.com/questions/tagged/stylelint).
|
75 |
|
76 | Create a [new issue](https://github.com/stylelint/stylelint/issues/new/choose) if:
|
77 |
|
78 | - you think you've found a bug
|
79 | - you have a feature request
|
80 |
|
81 | If you're upgrading, read our [CHANGELOG](CHANGELOG.md) to learn what changes to expect in the latest version.
|
82 |
|
83 | ## Help out
|
84 |
|
85 | To help out, you can:
|
86 |
|
87 | - get involved in any open [issue](https://github.com/stylelint/stylelint/issues) or [pull request](https://github.com/stylelint/stylelint/pulls)
|
88 | - create, enhance and debug rules using our [working on rules](docs/developer-guide/rules.md) guide
|
89 | - improve the [documentation](docs/)
|
90 | - add new tests to *absolutely anything*
|
91 | - improve the [performance of rules](docs/developer-guide/rules.md#improving-the-performance-of-a-rule)
|
92 | - open [new issues](https://github.com/stylelint/stylelint/issues/new/choose) about your ideas for making stylelint better
|
93 | - open [a pull request](https://github.com/stylelint/stylelint/compare) to show us how your idea works
|
94 | - create or contribute to [ecosystem tools](docs/user-guide/complementary-tools.md), for example the plugin for [VS Code](https://github.com/shinnn/vscode-stylelint)
|
95 |
|
96 | Our [VISION document](VISION.md) guides our work.
|
97 |
|
98 | ## Semantic Versioning Policy
|
99 |
|
100 | We have a [semantic versioning policy](docs/user-guide/semantic-versioning-policy.md). 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.
|
101 |
|
102 | ## License
|
103 |
|
104 | [The MIT License](https://raw.githubusercontent.com/stylelint/stylelint/master/LICENSE).
|
105 |
|
106 | ## Contributing Guidelines
|
107 |
|
108 | Check out the [Contributing Guidelines](CONTRIBUTING.md).
|
109 |
|
110 | ## Contributors
|
111 |
|
112 | Without [all these wonderful people](https://github.com/stylelint/stylelint/graphs/contributors) this project would cease to exist.
|
113 |
|
114 | ## Backers
|
115 |
|
116 | Thank you to all our backers! [Become a backer](https://opencollective.com/stylelint#backer).
|
117 |
|
118 | <a href="https://opencollective.com/stylelint#backers" target="_blank"><img src="https://opencollective.com/stylelint/backers.svg?width=890"></a>
|
119 |
|
120 |
|
121 | ## Sponsors
|
122 |
|
123 | Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor](https://opencollective.com/stylelint#sponsor).
|
124 |
|
125 | <a href="https://opencollective.com/stylelint/sponsor/0/website" target="_blank"><img src="https://opencollective.com/stylelint/sponsor/0/avatar.svg"></a>
|