Skip to content

Commit dcba135

Browse files
committed
Remove docs moved to eslint-plugin-prettier
1 parent 4d08b84 commit dcba135

File tree

2 files changed

+11
-73
lines changed

2 files changed

+11
-73
lines changed

README.md

+9-73
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ Note that this config _only_ turns rules _off,_ so it only makes sense using it
1212
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
1313

1414
- [Installation](#installation)
15-
- [eslint-plugin-prettier](#eslint-plugin-prettier)
1615
- [Excluding deprecated rules](#excluding-deprecated-rules)
1716
- [CLI helper tool](#cli-helper-tool)
1817
- [Legacy](#legacy)
@@ -104,54 +103,6 @@ If you extend a config which uses a plugin, it is recommended to add `"prettier/
104103

105104
If you’re unsure which plugins are used, you can usually find them in your `package.json`.
106105

107-
### eslint-plugin-prettier
108-
109-
In the above section you might have noticed this plugin being mentioned:
110-
111-
[eslint-<strong>plugin</strong>-prettier][eslint-plugin-prettier]
112-
113-
Just to clear any confusion, the repo you’re currently looking at is:
114-
115-
eslint-<strong>config</strong>-prettier
116-
117-
So what’s the difference?
118-
119-
- eslint-<strong>plugin</strong>-prettier adds a new _rule_ that lets you run Prettier from within ESLint as if it was a regular old ESLint rule.
120-
- eslint-<strong>config</strong>-prettier just turns off a bunch of rules (that are unnecessary or conflict with Prettier).
121-
122-
To make things even more confusing, eslint-<strong>plugin</strong>-prettier _also_ provides a _config_ you can extend. It’s called `"plugin:prettier/recommended"`. All that config does is:
123-
124-
```json
125-
{
126-
"extends": ["prettier", "prettier/prettier"],
127-
"plugins": ["prettier"],
128-
"rules": {
129-
"prettier/prettier": "error"
130-
}
131-
}
132-
```
133-
134-
Ugh, that’s a lot of `prettier` and `prettier/prettier`! What is all of that doing? Let’s start from the bottom:
135-
136-
- `"rules": { "prettier/prettier": "error" }` turns on the _rule_ that eslint-<strong>plugin</strong>-prettier provides, that lets you run Prettier from within ESLint.
137-
138-
- `"plugins": ["prettier"]` registers eslint-<strong>plugin</strong>-prettier as a plugin, so ESLint knows what `"prettier/prettier": "error"` is.
139-
140-
- `"extends"` is the interesting part. This requires you to also install eslint-<strong>config</strong>-prettier (this repo), because the listed configs comes from _this_ repo, not from the plugin’s repo!
141-
142-
- `"prettier"` is the base config which disables ESLint core rules.
143-
- `"prettier/prettier"` is specific config for eslint-<strong>plugin</strong>-prettier which disables [two ESLint core rules][eslint-plugin-prettier-special] that conflict only with eslint-<strong>plugin</strong>-prettier (not Prettier itself).
144-
145-
Note that even if you use `"plugin:prettier/recommended"`, you might still need to add more stuff to the `"extends"` array, depending on which other plugins you use. For example:
146-
147-
```json
148-
{
149-
"extends": ["plugin:prettier/recommended", "prettier/@typescript-eslint"]
150-
}
151-
```
152-
153-
**Note:** [eslint-<strong>plugin</strong>-prettier has some downsides][eslint-plugin-prettier-downsides] that you might want to read about.
154-
155106
### Excluding deprecated rules
156107

157108
Some of the rules that eslint-config-prettier turns off may be deprecated. **This is perfectly fine,** but if you really need to omit the deprecated rules, you can do so by setting the `ESLINT_CONFIG_PRETTIER_NO_DEPRECATED` environment variable to a non-empty value. For example:
@@ -212,29 +163,18 @@ For maximum ease of use, the special rules are disabled by default (provided tha
212163

213164
**These rules might cause problems if using [eslint-plugin-prettier] and `--fix`.**
214165

215-
If you use any of these rules together with the `prettier/prettier` rule from [eslint-plugin-prettier], you can in some cases end up with invalid code due to a bug in ESLint’s autofix.
216-
217-
These rules are safe to use if:
218-
219-
- You don’t use [eslint-plugin-prettier]. In other words, you run `eslint --fix` and `prettier --write` as separate steps.
220-
- You _do_ use [eslint-plugin-prettier], but don’t use `--fix`. (But then, what’s the point?)
221-
222-
You _can_ still use these rules together with [eslint-plugin-prettier] if you want, because the bug does not occur _all the time._ But if you do, you need to keep in mind that you might end up with invalid code, where you manually have to insert a missing closing parenthesis to get going again.
166+
See [`arrow-body-style` and `prefer-arrow-callback` issue][eslint-plugin-prettier-autofix-issue] for details.
223167

224-
If you’re fixing large of amounts of previously unformatted code, consider temporarily disabling the `prettier/prettier` rule and running `eslint --fix` and `prettier --write` separately.
168+
There are a couple of ways to turn these rules off:
225169

226-
See these issues for more information:
227-
228-
- [eslint-config-prettier#31]
229-
- [eslint-config-prettier#71]
230-
- [eslint-plugin-prettier#65]
231-
232-
When the autofix bug in ESLint has been fixed, the special case for these rules can be removed.
233-
234-
Note: You need to put `"prettier/prettier"` in your `"extends"` array if you want these rules to be turned off. (Yes, there’s both a _rule_ called `"prettier/prettier"` and a _config_ called `"prettier/prettier"`.)
170+
- Put `"prettier/prettier"` in your `"extends"`. (Yes, there’s both a _rule_ called `"prettier/prettier"` and a _config_ called `"prettier/prettier"`.)
171+
- Use [eslint-plugin-prettier’s recommended config][eslint-plugin-prettier-recommended], which also turns off these two rules.
172+
- Remove them from your config or turn them off manually.
235173

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

176+
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.
177+
238178
### [curly]
239179

240180
**This rule requires certain options.**
@@ -810,16 +750,12 @@ When you’re done, run `npm test` to verify that you got it all right. It runs
810750
[arrow-body-style]: https://eslint.org/docs/rules/arrow-body-style
811751
[babel/quotes]: https://github.com/babel/eslint-plugin-babel#rules
812752
[curly]: https://eslint.org/docs/rules/curly
813-
[eslint 5.7.0]: https://eslint.org/blog/2018/10/eslint-v5.7.0-released
814753
[eslint-config-airbnb]: https://www.npmjs.com/package/eslint-config-airbnb
815-
[eslint-config-prettier#31]: https://github.com/prettier/eslint-config-prettier/issues/31
816-
[eslint-config-prettier#71]: https://github.com/prettier/eslint-config-prettier/issues/71
817754
[eslint-plugin-babel]: https://github.com/babel/eslint-plugin-babel
818755
[eslint-plugin-flowtype]: https://github.com/gajus/eslint-plugin-flowtype
819-
[eslint-plugin-prettier-downsides]: https://prettier.io/docs/en/integrating-with-linters.html#notes
820-
[eslint-plugin-prettier-special]: #arrow-body-style-and-prefer-arrow-callback
756+
[eslint-plugin-prettier-autofix-issue]: https://github.com/prettier/eslint-plugin-prettier#arrow-body-style-and-prefer-arrow-callback-issue
757+
[eslint-plugin-prettier-recommended]: https://github.com/prettier/eslint-plugin-prettier#recommended-configuration
821758
[eslint-plugin-prettier]: https://github.com/prettier/eslint-plugin-prettier
822-
[eslint-plugin-prettier#65]: https://github.com/prettier/eslint-plugin-prettier/issues/65
823759
[eslint-plugin-react]: https://github.com/yannickcr/eslint-plugin-react
824760
[eslint-plugin-standard]: https://github.com/xjamundx/eslint-plugin-standard
825761
[eslint-plugin-unicorn]: https://github.com/sindresorhus/eslint-plugin-unicorn

prettier.js

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ module.exports = {
44
rules: {
55
// These are safe to use as long as the `"prettier/prettier"` rule from
66
// eslint-plugin-prettier isn’t enabled.
7+
// These are also included in `"plugin:prettier/recommended"`:
8+
// https://github.com/prettier/eslint-plugin-prettier#recommended-configuration
79
"arrow-body-style": 0,
810
"prefer-arrow-callback": 0,
911
},

0 commit comments

Comments
 (0)