Skip to content

Commit 0fd5734

Browse files
committed
Try to clarify eslint-plugin-prettier
Fixes #176. Fixes #177.
1 parent 0dd2a7e commit 0fd5734

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

CHANGELOG.md

+13
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,18 @@
3636

3737
So … what’s the catch? Why haven’t we done this earlier? Turns out it’s just a sad mistake. I (@lydell) was confused when testing, and thought that turning off unknown rules in a config was an error. Thanks to Georgii Dolzhykov (@thorn0) for pointing this out!
3838

39+
If you use [eslint-plugin-prettier], all you need is [plugin:prettier/recommended]:
40+
41+
<!-- prettier-ignore -->
42+
```json
43+
{
44+
"extends": [
45+
"some-other-config-you-use",
46+
"plugin:prettier/recommended"
47+
]
48+
}
49+
```
50+
3951
(The ["prettier/prettier" config][prettier-prettier-config] still exists separately. It’s the odd one out. The main `"prettier"` config does _not_ include the rules from it.)
4052

4153
- Changed: The CLI helper tool now only prints warnings for [arrow-body-style] and [prefer-arrow-callback], just like other “special rules.” This means that if you’ve decided to use those rules and [eslint-plugin-prettier] at the same time, you’ll get warnings but exit code zero (success).
@@ -432,6 +444,7 @@
432444
[no-unexpected-multiline]: https://eslint.org/docs/rules/no-unexpected-multiline
433445
[nonblock-statement-body-position]: https://eslint.org/docs/rules/nonblock-statement-body-position
434446
[one-var-declaration-per-line]: https://eslint.org/docs/rules/one-var-declaration-per-line
447+
[plugin:prettier/recommended]: https://github.com/prettier/eslint-plugin-prettier#recommended-configuration
435448
[prefer-arrow-callback]: https://eslint.org/docs/rules/prefer-arrow-callback
436449
[prettier-prettier-config]: https://github.com/prettier/eslint-config-prettier/tree/03c79b9306892d4dbc828ce723813ef015baabc5#arrow-body-style-and-prefer-arrow-callback
437450
[prettier-self-closing]: https://prettier.io/blog/2019/06/06/1.18.0.html#stop-converting-empty-jsx-elements-to-self-closing-elements-6127-by-duailibe

README.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,14 @@ That’s it! Extending `"prettier"` turns off a bunch of core ESLint rules, as w
6262
- [@typescript-eslint/eslint-plugin]
6363
- [eslint-plugin-babel]
6464
- [eslint-plugin-flowtype]
65-
- [eslint-plugin-prettier]
6665
- [eslint-plugin-react]
6766
- [eslint-plugin-standard]
6867
- [eslint-plugin-unicorn]
6968
- [eslint-plugin-vue]
7069

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.
70+
> 👉 Using [eslint-plugin-prettier]? Check out [eslint-plugin-prettier’s recommended config][eslint-plugin-prettier-recommended].
71+
72+
> ℹ️ 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.
7273
7374
### Excluding deprecated rules
7475

@@ -134,11 +135,11 @@ See the [`arrow-body-style` and `prefer-arrow-callback` issue][eslint-plugin-pre
134135

135136
There are a couple of ways to turn these rules off:
136137

138+
- Put `"plugin:prettier/recommended"` in your `"extends"`. That’s [eslint-<strong>plugin</strong>-prettier’s recommended config][eslint-plugin-prettier-recommended].
137139
- Put `"prettier/prettier"` in your `"extends"`. (Yes, there’s both a _rule_ called `"prettier/prettier"` and a _config_ called `"prettier/prettier"`.)
138-
- Use [eslint-plugin-prettier’s recommended config][eslint-plugin-prettier-recommended], which also turns off these two rules.
139140
- Remove them from your config or turn them off manually.
140141

141-
It doesn’t matter which approach you use – they’re all the same.
142+
It doesn’t matter which approach you use. `"plugin:prettier/recommended"` is probably the easiest.
142143

143144
Note: The CLI tool only reports these as problematic if the `"prettier/prettier"` _rule_ is enabled for the same file.
144145

0 commit comments

Comments
 (0)