.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / prettier-stylelint / README.md
1 # prettier-stylelint [![NPM Version](https://img.shields.io/npm/v/prettier-stylelint.svg)](https://www.npmjs.com/package/prettier-stylelint) [![NPM Downloads](https://img.shields.io/npm/dt/prettier-stylelint.svg)](https://www.npmjs.com/package/prettier-stylelint) [![NPM License](https://img.shields.io/npm/l/prettier-stylelint.svg)](https://www.npmjs.com/package/prettier-stylelint) [![Build Status](https://travis-ci.org/hugomrdias/prettier-stylelint.svg?branch=master)](https://travis-ci.org/hugomrdias/prettier-stylelint) [![codecov](https://codecov.io/gh/hugomrdias/prettier-stylelint/branch/master/graph/badge.svg)](https://codecov.io/gh/hugomrdias/prettier-stylelint)
2 > Format your styles with ease!
3
4 code > prettier > stylelint > formatted code   
5
6 prettier-stylelint attempts to create a prettier config based on the stylelint config, then format with prettier followed by stylelint --fix. So after that you should end up with formatted code with no linting errors.
7
8 ## Install
9
10 ```bash
11 yarn add prettier-stylelint -D
12 npm install prettier-stylelint --save-dev
13 ```
14
15 ## Usage
16 This package has a stylelint config to disable some rules that conflict with prettier.
17
18
19 ```json
20 "stylelint": {
21     "extends": [
22         "stylelint-config-idiomatic-order",
23         "./node_modules/prettier-stylelint/config.js"
24     ],
25     "rules": {
26         "indentation": 4,
27         "string-quotes": "single"
28     }
29 }
30
31 ```
32
33 After adding the disabling config you can just `prettier-stylelint --write` and its done. Check the CLI options below for more information.   
34 Also in a near future we should have support for prettier-stylelint in `prettier-vscode` follow this [PR](https://github.com/prettier/prettier-vscode/pull/218).
35
36
37 ### API
38 ```js
39 const format = require('prettier-eslint')
40 const sourceCode = 'a[id="foo"] { content: "x"; }'
41 const options = {
42   text: sourceCode
43 }
44 const formatted = format(options)
45
46
47 // formatted 
48 a[id='foo'] {
49     content: 'x';
50 }
51 ```   
52
53 ### CLI Options
54
55 The cli automatically ignores `.gitignore` and `.prettierignore`.
56
57 >**NOTE:** It is recommended that you keep your files under source control and committed
58 > before running `prettier-stylelint --write` as it will overwrite your files!
59
60
61 ```
62 Usage
63   $ prettier-stylelint [<file|glob> ...]
64
65 Options
66   --ignore          Additional paths to ignore  [Can be set multiple times]
67   --extension       Additional extension to lint [Can be set multiple times]
68   --cwd=<dir>       Working directory for files
69   --stdin           Validate/fix code from stdin ('prettier-stylelint -' also works)
70   --write           Edit files in place (DRAGONS AHEAD !!)
71   --quiet -q        Only log stderr
72
73 Examples
74   $ prettier-stylelint
75   $ prettier-stylelint index.js
76   $ prettier-stylelint *.js !foo.js
77   $ echo 'a[id="foo"] { content: "x"; }' | prettier-stylelint --stdin
78
79 Default pattern when no arguments:
80   **/*.{css,scss,less,sss}
81 ```
82
83 ## Related
84
85 - [prettier-vscode](https://github.com/esbenp/prettier-vscode) - prettier vscode extension
86 - [prettier-eslint](https://github.com/prettier/prettier-eslint) - the inspiration for this package
87 - [stylelint](https://github.com/stylelint/stylelint) - the linter ^^
88
89 ## License
90
91 MIT © [Hugo Dias](https://hugodias.me)