UNPKG

6.72 kBMarkdownView Raw
1# stylelint
2
3[![NPM version](https://img.shields.io/npm/v/stylelint.svg)](https://www.npmjs.org/package/stylelint) [![Build Status](https://github.com/stylelint/stylelint/workflows/CI/badge.svg)](https://github.com/stylelint/stylelint/actions) [![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
5A mighty, modern linter that helps you avoid errors and enforce conventions in your styles.
6
7## Features
8
9It'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 15000 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
28First, decide how you want to use stylelint:
29
30- [on the command line](docs/user-guide/cli.md)
31- [in your text editor](docs/user-guide/complementary-tools.md#editor-plugins), for example in VS Code
32- [in for your build tool](docs/user-guide/complementary-tools.md#build-tool-plugins), for example in webpack
33- [via the Node.js API](docs/user-guide/node-api.md)
34- [as a PostCSS plugin](docs/user-guide/postcss-plugin.md)
35
36Then create your [configuration object](docs/user-guide/configuration.md). You can either extend a shared configuration or craft your own.
37
38### Extend a shared configuration
39
40This is the quickest way to get started. We suggest you extend either:
41
42- [`stylelint-config-recommended`](https://github.com/stylelint/stylelint-config-recommended)
43- [`stylelint-config-standard`](https://github.com/stylelint/stylelint-config-standard)
44
45The 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:
46
47- recommended config if you use a pretty printer like [prettier](https://prettier.io/)
48- standard config if you want stylelint to enforce stylistic conventions
49
50You 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.
51
52*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.*
53
54### Craft your own config
55
56Alternatively, you can [learn about the rules](docs/user-guide/about-rules.md) and then either:
57
58- start small and add only [the rules](docs/user-guide/rules.md) you want to turn on
59- copy, paste and adapt [this example configuration](docs/user-guide/example-config.md) which lists all of the rules and their primary options
60
61## Guides
62
63You'll find detailed information on customising stylelint in our guides:
64
65- [user guide](docs/user-guide.md) - how to use and configure stylelint
66- [developer guide](docs/developer-guide.md) - how to develop for stylelint
67
68## Need help?
69
70Read our [FAQ](docs/user-guide/faq.md) first.
71
72If the answer to your problem isn't there, then post it on [stackoverflow](https://stackoverflow.com/questions/tagged/stylelint).
73
74Create a [new issue](https://github.com/stylelint/stylelint/issues/new/choose) if:
75
76- you think you've found a bug
77- you have a feature request
78
79If you're upgrading, read our [CHANGELOG](CHANGELOG.md) to learn what changes to expect in the latest version.
80
81## Help out
82
83To help out, you can:
84
85- get involved in any open [issue](https://github.com/stylelint/stylelint/issues) or [pull request](https://github.com/stylelint/stylelint/pulls)
86- create, enhance and debug rules using our [working on rules](docs/developer-guide/rules.md) guide
87- improve the [documentation](docs/)
88- add new tests to *absolutely anything*
89- improve the [performance of rules](docs/developer-guide/rules.md#improving-the-performance-of-a-rule)
90- open [new issues](https://github.com/stylelint/stylelint/issues/new/choose) about your ideas for making stylelint better
91- open [a pull request](https://github.com/stylelint/stylelint/compare) to show us how your idea works
92- create or contribute to [ecosystem tools](docs/user-guide/complementary-tools.md), for example the plugin for [VS Code](https://github.com/stylelint/vscode-stylelint)
93
94Our [VISION document](VISION.md) guides our work.
95
96## Semantic Versioning Policy
97
98We 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.
99
100## License
101
102[The MIT License](https://raw.githubusercontent.com/stylelint/stylelint/master/LICENSE).
103
104## Contributing Guidelines
105
106Check out the [Contributing Guidelines](CONTRIBUTING.md).
107
108## Contributors
109
110Without [all these wonderful people](https://github.com/stylelint/stylelint/graphs/contributors) this project would cease to exist.
111
112## Backers
113
114Thank you to all our backers! [Become a backer](https://opencollective.com/stylelint#backer).
115
116<a href="https://opencollective.com/stylelint#backers" target="_blank"><img src="https://opencollective.com/stylelint/backers.svg?width=890"></a>
117
118
119## Sponsors
120
121Support 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).
122
123<a href="https://opencollective.com/stylelint/sponsor/0/website" target="_blank"><img src="https://opencollective.com/stylelint/sponsor/0/avatar.svg"></a>