UNPKG

2.48 kBMarkdownView Raw
1# Getting started
2
31\. Use [npm](https://docs.npmjs.com/about-npm/) to install stylelint and its [`standard configuration`](https://github.com/stylelint/stylelint-config-standard):
4
5```shell
6npm install --save-dev stylelint stylelint-config-standard
7```
8
92\. Create a `.stylelintrc.json` configuration file in the root of your project:
10
11```json
12{
13 "extends": "stylelint-config-standard"
14}
15```
16
173\. Run stylelint on, for example, all the CSS files in your project:
18
19```shell
20npx stylelint "**/*.css"
21```
22
23This will lint your CSS for [possible errors](rules/list.md#possible-errors) and [stylistic issues](rules/list.md#stylistic-issues).
24
25## Customize
26
27Now that you're up and running, you'll likely want to customize stylelint to meet your needs.
28
29### Your configuration
30
31You'll want to customize your configuration.
32
33For example, you may want to use the popular:
34
35- [`stylelint-config-sass-guidelines` config](https://github.com/bjankord/stylelint-config-sass-guidelines) if you write SCSS
36- [`stylelint-order` plugin](https://github.com/hudochenkov/stylelint-order) if you want to order things like properties
37
38You'll find more [configs](https://github.com/stylelint/awesome-stylelint#configs) and [plugins](https://github.com/stylelint/awesome-stylelint#plugins) listed in [awesome stylelint](https://github.com/stylelint/awesome-stylelint).
39
40To further customize your stylelint configuration, you can adapt your:
41
42- [rules](configure.md#rules)
43- [shared configs](configure.md#extends)
44- [plugins](configure.md#plugins)
45
46We recommend you add [rules that limit language features](rules/list.md#limit-language-features) to your configuration, e.g. [`unit-whitelist`](../../lib/rules/unit-whitelist/README.md), [`selector-class-pattern`](../../lib/rules/selector-class-pattern/README.md) and [`selector-max-id`](../../lib/rules/selector-max-id/README.md). These are powerful rules that you can use to enforce non-stylistic consistency in your code.
47
48### Your usage
49
50You don't have to use the [Command Line Interface](usage/cli.md); you can also use the:
51
52- [Node API](usage/node-api.md)
53- [PostCSS plugin](usage/postcss-plugin.md)
54
55There are also integrations for [editors](integrations/editor.md), [task-runners](integrations/task-runner.md) and [others](integrations/other.md) too. Our [extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=stylelint.vscode-stylelint) is a popular choice that lets you see violations inline in your editor.