You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+8-46
Original file line number
Diff line number
Diff line change
@@ -57,7 +57,7 @@ Then, add eslint-config-prettier to the "extends" array in your `.eslintrc.*` fi
57
57
}
58
58
```
59
59
60
-
A few ESLint plugins are supported as well:
60
+
That’s it! Extending `"prettier"` turns off a bunch of core ESLint rules, as well as a few rules from these plugins:
61
61
62
62
-[@typescript-eslint/eslint-plugin]
63
63
-[eslint-plugin-babel]
@@ -68,40 +68,7 @@ A few ESLint plugins are supported as well:
68
68
-[eslint-plugin-unicorn]
69
69
-[eslint-plugin-vue]
70
70
71
-
Add extra exclusions for the plugins you use like so:
72
-
73
-
<!-- prettier-ignore -->
74
-
```json
75
-
{
76
-
"extends": [
77
-
"some-other-config-you-use",
78
-
"prettier",
79
-
"prettier/@typescript-eslint",
80
-
"prettier/babel",
81
-
"prettier/flowtype",
82
-
"prettier/prettier",
83
-
"prettier/react",
84
-
"prettier/standard",
85
-
"prettier/unicorn",
86
-
"prettier/vue"
87
-
]
88
-
}
89
-
```
90
-
91
-
If you extend a config which uses a plugin, it is recommended to add `"prettier/that-plugin"` (if available). For example, [eslint-config-airbnb] enables [eslint-plugin-react] rules, so `"prettier/react"` is needed:
92
-
93
-
<!-- prettier-ignore -->
94
-
```json
95
-
{
96
-
"extends": [
97
-
"airbnb",
98
-
"prettier",
99
-
"prettier/react"
100
-
]
101
-
}
102
-
```
103
-
104
-
If you’re unsure which plugins are used, you can usually find them in your `package.json`.
71
+
> Note: You might find guides on the Internet saying you should also extend stuff like `"prettier/react"`. Since version 8.0.0 of eslint-config-prettier, all you need to extend is `"prettier"`! That includes all plugins.
105
72
106
73
### Excluding deprecated rules
107
74
@@ -163,14 +130,16 @@ For maximum ease of use, the special rules are disabled by default (provided tha
163
130
164
131
**These rules might cause problems if using [eslint-plugin-prettier] and `--fix`.**
165
132
166
-
See [`arrow-body-style` and `prefer-arrow-callback` issue][eslint-plugin-prettier-autofix-issue] for details.
133
+
See the [`arrow-body-style` and `prefer-arrow-callback` issue][eslint-plugin-prettier-autofix-issue] for details.
167
134
168
135
There are a couple of ways to turn these rules off:
169
136
170
137
- Put `"prettier/prettier"` in your `"extends"`. (Yes, there’s both a _rule_ called `"prettier/prettier"` and a _config_ called `"prettier/prettier"`.)
171
138
- Use [eslint-plugin-prettier’s recommended config][eslint-plugin-prettier-recommended], which also turns off these two rules.
172
139
- Remove them from your config or turn them off manually.
173
140
141
+
It doesn’t matter which approach you use – they’re all the same.
142
+
174
143
Note: The CLI tool only reports these as problematic if the `"prettier/prettier"`_rule_ is enabled for the same file.
175
144
176
145
These rules are safe to use if you don’t use [eslint-plugin-prettier]. In other words, if you run `eslint --fix` and `prettier --write` as separate steps.
@@ -698,17 +667,11 @@ Have new rules been added since those versions? Have we missed any rules? Is the
698
667
699
668
If you’d like to add support for eslint-plugin-foobar, this is how you’d go about it:
700
669
701
-
First, create `foobar.js`:
670
+
First, add rules to `index.js`:
702
671
703
672
<!-- prettier-ignore -->
704
673
```js
705
-
"use strict";
706
-
707
-
module.exports= {
708
-
rules: {
709
-
"foobar/some-rule":"off"
710
-
}
711
-
};
674
+
"foobar/some-rule":"off"
712
675
```
713
676
714
677
Then, create `test-lint/foobar.js`:
@@ -729,7 +692,7 @@ Finally, you need to mention the plugin in several places:
729
692
730
693
- Add eslint-plugin-foobar to the "devDependencies" field in `package.json`.
731
694
- Make sure that at least one rule from eslint-plugin-foobar gets used in `.eslintrc.base.js`.
732
-
- Add it to the list of supported plugins and to the Contributing section in`README.md`.
695
+
- Add it to the lists of supported plugins and in this`README.md`.
733
696
734
697
When you’re done, run `npm test` to verify that you got it all right. It runs several other npm scripts:
735
698
@@ -751,7 +714,6 @@ When you’re done, run `npm test` to verify that you got it all right. It runs
0 commit comments