eslint-config-prettier 6.10.0 → 6.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@typescript-eslint.js +4 -2
- package/CHANGELOG.md +67 -122
- package/README.md +133 -250
- package/babel.js +2 -2
- package/bin/cli.js +23 -23
- package/bin/validators.js +1 -1
- package/flowtype.js +2 -2
- package/index.js +3 -3
- package/package.json +20 -19
- package/react.js +3 -3
- package/standard.js +2 -2
- package/unicorn.js +2 -2
- package/vue.js +11 -2
package/README.md
CHANGED
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
# eslint-config-prettier
|
|
1
|
+
# eslint-config-prettier
|
|
2
2
|
|
|
3
3
|
Turns off all rules that are unnecessary or might conflict with [Prettier].
|
|
4
4
|
|
|
5
|
-
This lets you use your favorite shareable config without letting its stylistic
|
|
6
|
-
choices get in the way when using Prettier.
|
|
5
|
+
This lets you use your favorite shareable config without letting its stylistic choices get in the way when using Prettier.
|
|
7
6
|
|
|
8
|
-
Note that this config _only_ turns rules _off,_ so it only makes sense using
|
|
9
|
-
it together with some other config.
|
|
7
|
+
Note that this config _only_ turns rules _off,_ so it only makes sense using it together with some other config.
|
|
10
8
|
|
|
11
9
|
## Contents
|
|
12
10
|
|
|
13
11
|
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
|
14
12
|
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
|
15
13
|
|
|
16
|
-
|
|
17
14
|
- [Installation](#installation)
|
|
18
15
|
- [Excluding deprecated rules](#excluding-deprecated-rules)
|
|
19
16
|
- [CLI helper tool](#cli-helper-tool)
|
|
20
|
-
- [Example configuration](#example-configuration)
|
|
21
17
|
- [Special rules](#special-rules)
|
|
22
18
|
- [arrow-body-style and prefer-arrow-callback](#arrow-body-style-and-prefer-arrow-callback)
|
|
23
19
|
- [curly](#curly)
|
|
@@ -30,8 +26,8 @@ it together with some other config.
|
|
|
30
26
|
- [quotes](#quotes)
|
|
31
27
|
- [Enforce backticks](#enforce-backticks)
|
|
32
28
|
- [Forbid unnecessary backticks](#forbid-unnecessary-backticks)
|
|
33
|
-
- [Example
|
|
34
|
-
- [Example
|
|
29
|
+
- [Example double quote configuration](#example-double-quote-configuration)
|
|
30
|
+
- [Example single quote configuration](#example-single-quote-configuration)
|
|
35
31
|
- [vue/html-self-closing](#vuehtml-self-closing)
|
|
36
32
|
- [Other rules worth mentioning](#other-rules-worth-mentioning)
|
|
37
33
|
- [no-sequences](#no-sequences)
|
|
@@ -42,19 +38,15 @@ it together with some other config.
|
|
|
42
38
|
|
|
43
39
|
## Installation
|
|
44
40
|
|
|
45
|
-
Tip: First, you might be interested in installing [eslint-plugin-prettier].
|
|
46
|
-
Follow the instructions over there. This is optional, though.
|
|
47
|
-
|
|
48
41
|
Install eslint-config-prettier:
|
|
49
42
|
|
|
50
43
|
```
|
|
51
44
|
npm install --save-dev eslint-config-prettier
|
|
52
45
|
```
|
|
53
46
|
|
|
54
|
-
Then, add eslint-config-prettier to the "extends" array in your `.eslintrc.*`
|
|
55
|
-
file. Make sure to put it **last,** so it gets the chance to override other
|
|
56
|
-
configs.
|
|
47
|
+
Then, add eslint-config-prettier to the "extends" array in your `.eslintrc.*` file. Make sure to put it **last,** so it gets the chance to override other configs.
|
|
57
48
|
|
|
49
|
+
<!-- prettier-ignore -->
|
|
58
50
|
```json
|
|
59
51
|
{
|
|
60
52
|
"extends": [
|
|
@@ -76,6 +68,7 @@ A few ESLint plugins are supported as well:
|
|
|
76
68
|
|
|
77
69
|
Add extra exclusions for the plugins you use like so:
|
|
78
70
|
|
|
71
|
+
<!-- prettier-ignore -->
|
|
79
72
|
```json
|
|
80
73
|
{
|
|
81
74
|
"extends": [
|
|
@@ -92,10 +85,9 @@ Add extra exclusions for the plugins you use like so:
|
|
|
92
85
|
}
|
|
93
86
|
```
|
|
94
87
|
|
|
95
|
-
If you extend a config which uses a plugin, it is recommended to add
|
|
96
|
-
`"prettier/that-plugin"` (if available). For example, [eslint-config-airbnb]
|
|
97
|
-
enables [eslint-plugin-react] rules, so `"prettier/react"` is needed:
|
|
88
|
+
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:
|
|
98
89
|
|
|
90
|
+
<!-- prettier-ignore -->
|
|
99
91
|
```json
|
|
100
92
|
{
|
|
101
93
|
"extends": [
|
|
@@ -106,16 +98,11 @@ enables [eslint-plugin-react] rules, so `"prettier/react"` is needed:
|
|
|
106
98
|
}
|
|
107
99
|
```
|
|
108
100
|
|
|
109
|
-
If you’re unsure which plugins are used, you can usually find them in your
|
|
110
|
-
`package.json`.
|
|
101
|
+
If you’re unsure which plugins are used, you can usually find them in your `package.json`.
|
|
111
102
|
|
|
112
103
|
### Excluding deprecated rules
|
|
113
104
|
|
|
114
|
-
Some of the rules that eslint-config-prettier turns off may be deprecated.
|
|
115
|
-
**This is perfectly fine,** but if you really need to omit the
|
|
116
|
-
deprecated rules, you can do so by setting the
|
|
117
|
-
`ESLINT_CONFIG_PRETTIER_NO_DEPRECATED` environment variable to a non-empty
|
|
118
|
-
value. For example:
|
|
105
|
+
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:
|
|
119
106
|
|
|
120
107
|
```
|
|
121
108
|
env ESLINT_CONFIG_PRETTIER_NO_DEPRECATED=true npx eslint-find-rules --deprecated index.js
|
|
@@ -123,36 +110,22 @@ env ESLINT_CONFIG_PRETTIER_NO_DEPRECATED=true npx eslint-find-rules --deprecated
|
|
|
123
110
|
|
|
124
111
|
## CLI helper tool
|
|
125
112
|
|
|
126
|
-
eslint-config-prettier also ships with a little CLI tool to help you check if
|
|
127
|
-
your configuration contains any rules that are unnecessary or conflict with
|
|
128
|
-
Prettier.
|
|
113
|
+
eslint-config-prettier also ships with a little CLI tool to help you check if your configuration contains any rules that are unnecessary or conflict with Prettier.
|
|
129
114
|
|
|
130
|
-
|
|
115
|
+
You can run it using `npx`:
|
|
131
116
|
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
"scripts": {
|
|
135
|
-
"eslint-check": "eslint --print-config path/to/main.js | eslint-config-prettier-check"
|
|
136
|
-
}
|
|
137
|
-
}
|
|
117
|
+
```
|
|
118
|
+
npx eslint --print-config path/to/main.js | npx eslint-config-prettier-check
|
|
138
119
|
```
|
|
139
120
|
|
|
140
|
-
|
|
141
|
-
exists in your project.)
|
|
121
|
+
(Change `path/to/main.js` to a file that exists in your project.)
|
|
142
122
|
|
|
143
|
-
In theory you need to run `eslint --print-config file.js |
|
|
144
|
-
eslint-config-prettier-check` for every single file in your project to be
|
|
145
|
-
100% sure that there are no conflicting rules, because ESLint supports having
|
|
146
|
-
different rules for different files. But usually you’ll have about the same
|
|
147
|
-
rules for all files, so it is enough to run the command on one file (pick one
|
|
148
|
-
that you won’t be moving). If you use [multiple configuration files] or
|
|
149
|
-
[overrides], you can (but you probably don’t need to!) run the above script
|
|
150
|
-
several times with different `--print-config` arguments, such as:
|
|
123
|
+
In theory you need to run `npx eslint --print-config file.js | npx eslint-config-prettier-check` for every single file in your project to be 100% sure that there are no conflicting rules, because ESLint supports having different rules for different files. But usually you’ll have about the same rules for all files, so it is enough to run the command on one file (pick one that you won’t be moving). If you use [multiple configuration files] or [overrides], you can (but you probably don’t need to!) run the above script several times with different `--print-config` arguments, such as:
|
|
151
124
|
|
|
152
125
|
```
|
|
153
|
-
eslint --print-config index.js | eslint-config-prettier-check
|
|
154
|
-
eslint --print-config test/index.js | eslint-config-prettier-check
|
|
155
|
-
eslint --print-config legacy/main.js | eslint-config-prettier-check
|
|
126
|
+
npx eslint --print-config index.js | npx eslint-config-prettier-check
|
|
127
|
+
npx eslint --print-config test/index.js | npx eslint-config-prettier-check
|
|
128
|
+
npx eslint --print-config legacy/main.js | npx eslint-config-prettier-check
|
|
156
129
|
```
|
|
157
130
|
|
|
158
131
|
Exit codes:
|
|
@@ -161,89 +134,30 @@ Exit codes:
|
|
|
161
134
|
- 1: Unexpected error.
|
|
162
135
|
- 2: Conflicting rules found.
|
|
163
136
|
|
|
164
|
-
## Example configuration
|
|
165
|
-
|
|
166
|
-
```json
|
|
167
|
-
{
|
|
168
|
-
"extends": [
|
|
169
|
-
"standard",
|
|
170
|
-
"plugin:@typescript-eslint/recommended",
|
|
171
|
-
"plugin:flowtype/recommended",
|
|
172
|
-
"plugin:react/recommended",
|
|
173
|
-
"plugin:unicorn/recommended",
|
|
174
|
-
"plugin:vue/recommended",
|
|
175
|
-
"prettier",
|
|
176
|
-
"prettier/@typescript-eslint",
|
|
177
|
-
"prettier/babel",
|
|
178
|
-
"prettier/flowtype",
|
|
179
|
-
"prettier/react",
|
|
180
|
-
"prettier/standard",
|
|
181
|
-
"prettier/unicorn",
|
|
182
|
-
"prettier/vue"
|
|
183
|
-
],
|
|
184
|
-
"plugins": [
|
|
185
|
-
"@typescript-eslint",
|
|
186
|
-
"babel",
|
|
187
|
-
"flowtype",
|
|
188
|
-
"prettier",
|
|
189
|
-
"react",
|
|
190
|
-
"standard",
|
|
191
|
-
"unicorn",
|
|
192
|
-
"vue"
|
|
193
|
-
],
|
|
194
|
-
"parserOptions": {
|
|
195
|
-
"sourceType": "module",
|
|
196
|
-
"ecmaFeatures": {
|
|
197
|
-
"jsx": true
|
|
198
|
-
}
|
|
199
|
-
},
|
|
200
|
-
"env": {
|
|
201
|
-
"es6": true,
|
|
202
|
-
"node": true
|
|
203
|
-
},
|
|
204
|
-
"rules": {
|
|
205
|
-
"prettier/prettier": "error"
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
```
|
|
209
|
-
|
|
210
137
|
## Special rules
|
|
211
138
|
|
|
212
|
-
There a few rules that eslint-config-prettier disables that actually can be
|
|
213
|
-
enabled in some cases.
|
|
139
|
+
There a few rules that eslint-config-prettier disables that actually can be enabled in some cases.
|
|
214
140
|
|
|
215
141
|
- Some require certain options. The CLI helper tool validates this.
|
|
216
|
-
- Some require special attention when writing code. The CLI helper tool warns
|
|
217
|
-
you if any of those rules are enabled, but can’t tell if anything is
|
|
218
|
-
problematic.
|
|
142
|
+
- Some require special attention when writing code. The CLI helper tool warns you if any of those rules are enabled, but can’t tell if anything is problematic.
|
|
219
143
|
- Some can cause problems if using [eslint-plugin-prettier] and `--fix`.
|
|
220
144
|
|
|
221
|
-
For maximum ease of use, the special rules are disabled by default. If you want
|
|
222
|
-
them, you need to explicitly specify them in your ESLint config.
|
|
145
|
+
For maximum ease of use, the special rules are disabled by default. If you want them, you need to explicitly specify them in your ESLint config.
|
|
223
146
|
|
|
224
147
|
### [arrow-body-style] and [prefer-arrow-callback]
|
|
225
148
|
|
|
226
149
|
**These rules might cause problems if using [eslint-plugin-prettier] and `--fix`.**
|
|
227
150
|
|
|
228
|
-
If you use any of these rules together with the `prettier/prettier` rule from
|
|
229
|
-
[eslint-plugin-prettier], you can in some cases end up with invalid code due to
|
|
230
|
-
a bug in ESLint’s autofix.
|
|
151
|
+
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.
|
|
231
152
|
|
|
232
153
|
These rules are safe to use if:
|
|
233
154
|
|
|
234
|
-
- You don’t use [eslint-plugin-prettier]. In other words, you run `eslint --fix`
|
|
235
|
-
|
|
236
|
-
- You _do_ use [eslint-plugin-prettier], but don’t use `--fix`. (But then,
|
|
237
|
-
what’s the point?)
|
|
155
|
+
- You don’t use [eslint-plugin-prettier]. In other words, you run `eslint --fix` and `prettier --write` as separate steps.
|
|
156
|
+
- You _do_ use [eslint-plugin-prettier], but don’t use `--fix`. (But then, what’s the point?)
|
|
238
157
|
|
|
239
|
-
You _can_ still use these rules together with [eslint-plugin-prettier] if you
|
|
240
|
-
want, because the bug does not occur _all the time._ But if you do, you need to
|
|
241
|
-
keep in mind that you might end up with invalid code, where you manually have to
|
|
242
|
-
insert a missing closing parenthesis to get going again.
|
|
158
|
+
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.
|
|
243
159
|
|
|
244
|
-
If you’re fixing large of amounts of previously unformatted code, consider
|
|
245
|
-
temporarily disabling the `prettier/prettier` rule and running `eslint --fix`
|
|
246
|
-
and `prettier --write` separately.
|
|
160
|
+
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.
|
|
247
161
|
|
|
248
162
|
See these issues for more information:
|
|
249
163
|
|
|
@@ -251,39 +165,36 @@ See these issues for more information:
|
|
|
251
165
|
- [eslint-config-prettier#71]
|
|
252
166
|
- [eslint-plugin-prettier#65]
|
|
253
167
|
|
|
254
|
-
When the autofix bug in ESLint has been fixed, the special case for these rules
|
|
255
|
-
can be removed.
|
|
168
|
+
When the autofix bug in ESLint has been fixed, the special case for these rules can be removed.
|
|
256
169
|
|
|
257
170
|
### [curly]
|
|
258
171
|
|
|
259
172
|
**This rule requires certain options.**
|
|
260
173
|
|
|
261
|
-
If a block (for example after `if`, `else`, `for` or `while`) contains only one
|
|
262
|
-
statement, JavaScript allows omitting the curly braces around that statement.
|
|
263
|
-
This rule enforces if or when those optional curly braces should be omitted.
|
|
174
|
+
If a block (for example after `if`, `else`, `for` or `while`) contains only one statement, JavaScript allows omitting the curly braces around that statement. This rule enforces if or when those optional curly braces should be omitted.
|
|
264
175
|
|
|
265
|
-
If you use the `"multi-line"` or `"multi-or-nest"` option, the rule can conflict
|
|
266
|
-
with Prettier.
|
|
176
|
+
If you use the `"multi-line"` or `"multi-or-nest"` option, the rule can conflict with Prettier.
|
|
267
177
|
|
|
268
178
|
For example, the `"multi-line"` option allows this line:
|
|
269
179
|
|
|
180
|
+
<!-- prettier-ignore -->
|
|
270
181
|
```js
|
|
271
182
|
if (cart.items && cart.items[0] && cart.items[0].quantity === 0) updateCart(cart);
|
|
272
183
|
```
|
|
273
184
|
|
|
274
|
-
However, Prettier might consider the line too long and turn it into the
|
|
275
|
-
following, which the `"multi-line"` option does _not_ allow:
|
|
185
|
+
However, Prettier might consider the line too long and turn it into the following, which the `"multi-line"` option does _not_ allow:
|
|
276
186
|
|
|
187
|
+
<!-- prettier-ignore -->
|
|
277
188
|
```js
|
|
278
189
|
if (cart.items && cart.items[0] && cart.items[0].quantity === 0)
|
|
279
190
|
updateCart(cart);
|
|
280
191
|
```
|
|
281
192
|
|
|
282
|
-
If you like this rule, it can be used just fine with Prettier as long as you
|
|
283
|
-
don’t use the `"multi-line"` or `"multi-or-nest"` option.
|
|
193
|
+
If you like this rule, it can be used just fine with Prettier as long as you don’t use the `"multi-line"` or `"multi-or-nest"` option.
|
|
284
194
|
|
|
285
195
|
Example ESLint configuration:
|
|
286
196
|
|
|
197
|
+
<!-- prettier-ignore -->
|
|
287
198
|
```json
|
|
288
199
|
{
|
|
289
200
|
"rules": {
|
|
@@ -296,16 +207,14 @@ Example ESLint configuration:
|
|
|
296
207
|
|
|
297
208
|
**This rule can be used with certain options.**
|
|
298
209
|
|
|
299
|
-
This rule requires empty lines before and/or after comments. Prettier preserves
|
|
300
|
-
blank lines, with two exceptions:
|
|
210
|
+
This rule requires empty lines before and/or after comments. Prettier preserves blank lines, with two exceptions:
|
|
301
211
|
|
|
302
|
-
- Several blank lines in a row are collapsed into a single blank line. This is
|
|
303
|
-
|
|
304
|
-
- Blank lines at the beginning and end of blocks, objects and arrays are always
|
|
305
|
-
removed. This may lead to conflicts.
|
|
212
|
+
- Several blank lines in a row are collapsed into a single blank line. This is fine.
|
|
213
|
+
- Blank lines at the beginning and end of blocks, objects and arrays are always removed. This may lead to conflicts.
|
|
306
214
|
|
|
307
215
|
By default, ESLint requires a blank line above the comment is this case:
|
|
308
216
|
|
|
217
|
+
<!-- prettier-ignore -->
|
|
309
218
|
```js
|
|
310
219
|
if (result) {
|
|
311
220
|
|
|
@@ -316,6 +225,7 @@ if (result) {
|
|
|
316
225
|
|
|
317
226
|
However, Prettier removes the blank line:
|
|
318
227
|
|
|
228
|
+
<!-- prettier-ignore -->
|
|
319
229
|
```js
|
|
320
230
|
if (result) {
|
|
321
231
|
/* comment */
|
|
@@ -323,12 +233,11 @@ if (result) {
|
|
|
323
233
|
}
|
|
324
234
|
```
|
|
325
235
|
|
|
326
|
-
If you like this rule, it can be used just fine with Prettier as long as you add
|
|
327
|
-
some extra configuration to allow comments at the start and end of blocks,
|
|
328
|
-
objects and arrays.
|
|
236
|
+
If you like this rule, it can be used just fine with Prettier as long as you add some extra configuration to allow comments at the start and end of blocks, objects and arrays.
|
|
329
237
|
|
|
330
238
|
Example ESLint configuration:
|
|
331
239
|
|
|
240
|
+
<!-- prettier-ignore -->
|
|
332
241
|
```json
|
|
333
242
|
{
|
|
334
243
|
"rules": {
|
|
@@ -357,19 +266,15 @@ Example ESLint configuration:
|
|
|
357
266
|
|
|
358
267
|
**This rule requires special attention when writing code.**
|
|
359
268
|
|
|
360
|
-
Usually, Prettier takes care of following a maximum line length automatically.
|
|
361
|
-
However, there are cases where Prettier can’t do anything, such as for long
|
|
362
|
-
strings, regular expressions and comments. Those need to be split up by a human.
|
|
269
|
+
Usually, Prettier takes care of following a maximum line length automatically. However, there are cases where Prettier can’t do anything, such as for long strings, regular expressions and comments. Those need to be split up by a human.
|
|
363
270
|
|
|
364
|
-
If you’d like to enforce an even stricter maximum line length policy than
|
|
365
|
-
Prettier can provide automatically, you can enable this rule. Just remember to
|
|
366
|
-
keep `max-len`’s options and Prettier’s `printWidth` option in sync.
|
|
271
|
+
If you’d like to enforce an even stricter maximum line length policy than Prettier can provide automatically, you can enable this rule. Just remember to keep `max-len`’s options and Prettier’s `printWidth` option in sync.
|
|
367
272
|
|
|
368
|
-
Keep in mind that you might have to refactor code slightly if Prettier formats
|
|
369
|
-
lines in a way that the `max-len` rule does not approve of.
|
|
273
|
+
Keep in mind that you might have to refactor code slightly if Prettier formats lines in a way that the `max-len` rule does not approve of.
|
|
370
274
|
|
|
371
275
|
Example ESLint configuration:
|
|
372
276
|
|
|
277
|
+
<!-- prettier-ignore -->
|
|
373
278
|
```json
|
|
374
279
|
{
|
|
375
280
|
"rules": {
|
|
@@ -384,39 +289,40 @@ Example ESLint configuration:
|
|
|
384
289
|
|
|
385
290
|
For example, the rule could warn about this line:
|
|
386
291
|
|
|
292
|
+
<!-- prettier-ignore -->
|
|
387
293
|
```js
|
|
388
294
|
var x = a => 1 ? 2 : 3;
|
|
389
295
|
```
|
|
390
296
|
|
|
391
|
-
With `{allowParens: true}` (the default since ESLint 6.0.0), adding
|
|
392
|
-
parentheses is considered a valid way to avoid the arrow confusion:
|
|
297
|
+
With `{allowParens: true}` (the default since ESLint 6.0.0), adding parentheses is considered a valid way to avoid the arrow confusion:
|
|
393
298
|
|
|
299
|
+
<!-- prettier-ignore -->
|
|
394
300
|
```js
|
|
395
301
|
var x = a => (1 ? 2 : 3);
|
|
396
302
|
```
|
|
397
303
|
|
|
398
|
-
While Prettier keeps those parentheses, it removes them if the line is long
|
|
399
|
-
enough to introduce a line break:
|
|
304
|
+
While Prettier keeps those parentheses, it removes them if the line is long enough to introduce a line break:
|
|
400
305
|
|
|
306
|
+
<!-- prettier-ignore -->
|
|
401
307
|
```js
|
|
402
308
|
EnterpriseCalculator.prototype.calculateImportantNumbers = inputNumber =>
|
|
403
309
|
1 ? 2 : 3;
|
|
404
310
|
```
|
|
405
311
|
|
|
406
|
-
With `{allowParens: false}`, ESLint instead suggests switching to an explicit
|
|
407
|
-
return:
|
|
312
|
+
With `{allowParens: false}`, ESLint instead suggests switching to an explicit return:
|
|
408
313
|
|
|
314
|
+
<!-- prettier-ignore -->
|
|
409
315
|
```js
|
|
410
316
|
var x = a => { return 1 ? 2 : 3; };
|
|
411
317
|
```
|
|
412
318
|
|
|
413
319
|
That causes no problems with Prettier.
|
|
414
320
|
|
|
415
|
-
If you like this rule, it can be used just fine with Prettier as long as the
|
|
416
|
-
`allowParens` option is off.
|
|
321
|
+
If you like this rule, it can be used just fine with Prettier as long as the `allowParens` option is off.
|
|
417
322
|
|
|
418
323
|
Example ESLint configuration:
|
|
419
324
|
|
|
325
|
+
<!-- prettier-ignore -->
|
|
420
326
|
```json
|
|
421
327
|
{
|
|
422
328
|
"rules": {
|
|
@@ -425,12 +331,7 @@ Example ESLint configuration:
|
|
|
425
331
|
}
|
|
426
332
|
```
|
|
427
333
|
|
|
428
|
-
(Note: The CLI helper tool considers `{allowParens: true}` to be the default,
|
|
429
|
-
which is the case since ESLint 6.0.0. The tool will produce a warning if you
|
|
430
|
-
use the default even if you use an older version of ESLint. It doesn’t hurt
|
|
431
|
-
to explicitly set `{allowParens: false}` even though it is technically
|
|
432
|
-
redundant. This way you are prepared for a future ESLint upgrade and the CLI
|
|
433
|
-
tool can be kept simple.)
|
|
334
|
+
(Note: The CLI helper tool considers `{allowParens: true}` to be the default, which is the case since ESLint 6.0.0. The tool will produce a warning if you use the default even if you use an older version of ESLint. It doesn’t hurt to explicitly set `{allowParens: false}` even though it is technically redundant. This way you are prepared for a future ESLint upgrade and the CLI tool can be kept simple.)
|
|
434
335
|
|
|
435
336
|
### [no-mixed-operators]
|
|
436
337
|
|
|
@@ -440,25 +341,28 @@ This rule forbids mixing certain operators, such as `&&` and `||`.
|
|
|
440
341
|
|
|
441
342
|
For example, the rule could warn about this line:
|
|
442
343
|
|
|
344
|
+
<!-- prettier-ignore -->
|
|
443
345
|
```js
|
|
444
346
|
var foo = a + b * c;
|
|
445
347
|
```
|
|
446
348
|
|
|
447
349
|
The rule suggests adding parentheses, like this:
|
|
448
350
|
|
|
351
|
+
<!-- prettier-ignore -->
|
|
449
352
|
```js
|
|
450
353
|
var foo = a + (b * c);
|
|
451
354
|
```
|
|
452
355
|
|
|
453
356
|
However, Prettier removes many “unnecessary” parentheses, turning it back to:
|
|
454
357
|
|
|
358
|
+
<!-- prettier-ignore -->
|
|
455
359
|
```js
|
|
456
360
|
var foo = a + b * c;
|
|
457
361
|
```
|
|
458
362
|
|
|
459
|
-
If you want to use this rule with Prettier, you need to split the expression
|
|
460
|
-
into another variable:
|
|
363
|
+
If you want to use this rule with Prettier, you need to split the expression into another variable:
|
|
461
364
|
|
|
365
|
+
<!-- prettier-ignore -->
|
|
462
366
|
```js
|
|
463
367
|
var bar = b * c;
|
|
464
368
|
var foo = a + bar;
|
|
@@ -466,12 +370,14 @@ var foo = a + bar;
|
|
|
466
370
|
|
|
467
371
|
Keep in mind that Prettier prints _some_ “unnecessary” parentheses, though:
|
|
468
372
|
|
|
373
|
+
<!-- prettier-ignore -->
|
|
469
374
|
```js
|
|
470
375
|
var foo = (a && b) || c;
|
|
471
376
|
```
|
|
472
377
|
|
|
473
378
|
Example ESLint configuration:
|
|
474
379
|
|
|
380
|
+
<!-- prettier-ignore -->
|
|
475
381
|
```json
|
|
476
382
|
{
|
|
477
383
|
"rules": {
|
|
@@ -484,11 +390,11 @@ Example ESLint configuration:
|
|
|
484
390
|
|
|
485
391
|
**This rule requires certain Prettier options.**
|
|
486
392
|
|
|
487
|
-
This rule disallows the use of tab characters at all. It can be used just fine
|
|
488
|
-
with Prettier as long as you don’t configure Prettier to indent using tabs.
|
|
393
|
+
This rule disallows the use of tab characters at all. It can be used just fine with Prettier as long as you don’t configure Prettier to indent using tabs.
|
|
489
394
|
|
|
490
395
|
Example ESLint configuration:
|
|
491
396
|
|
|
397
|
+
<!-- prettier-ignore -->
|
|
492
398
|
```json
|
|
493
399
|
{
|
|
494
400
|
"rules": {
|
|
@@ -497,18 +403,18 @@ Example ESLint configuration:
|
|
|
497
403
|
}
|
|
498
404
|
```
|
|
499
405
|
|
|
500
|
-
Example Prettier configuration (this is the default, so adding this is not
|
|
501
|
-
required):
|
|
406
|
+
Example Prettier configuration (this is the default, so adding this is not required):
|
|
502
407
|
|
|
408
|
+
<!-- prettier-ignore -->
|
|
503
409
|
```json
|
|
504
410
|
{
|
|
505
411
|
"useTabs": false
|
|
506
412
|
}
|
|
507
413
|
```
|
|
508
414
|
|
|
509
|
-
**Note:** Since [ESlint 5.7.0] this rule can be configured to work regardless of
|
|
510
|
-
your Prettier configuration:
|
|
415
|
+
**Note:** Since [ESlint 5.7.0] this rule can be configured to work regardless of your Prettier configuration:
|
|
511
416
|
|
|
417
|
+
<!-- prettier-ignore -->
|
|
512
418
|
```json
|
|
513
419
|
{
|
|
514
420
|
"rules": {
|
|
@@ -523,32 +429,33 @@ A future version of eslint-config-prettier might check for that automatically.
|
|
|
523
429
|
|
|
524
430
|
**This rule requires special attention when writing code.**
|
|
525
431
|
|
|
526
|
-
This rule disallows confusing multiline expressions where a newline looks like
|
|
527
|
-
it is ending a statement, but is not.
|
|
432
|
+
This rule disallows confusing multiline expressions where a newline looks like it is ending a statement, but is not.
|
|
528
433
|
|
|
529
434
|
For example, the rule could warn about this:
|
|
530
435
|
|
|
436
|
+
<!-- prettier-ignore -->
|
|
531
437
|
```js
|
|
532
438
|
var hello = "world"
|
|
533
439
|
[1, 2, 3].forEach(addNumber)
|
|
534
440
|
```
|
|
535
441
|
|
|
536
|
-
Prettier usually formats this in a way that makes it obvious that a semicolon
|
|
537
|
-
was missing:
|
|
442
|
+
Prettier usually formats this in a way that makes it obvious that a semicolon was missing:
|
|
538
443
|
|
|
444
|
+
<!-- prettier-ignore -->
|
|
539
445
|
```js
|
|
540
446
|
var hello = "world"[(1, 2, 3)].forEach(addNumber);
|
|
541
447
|
```
|
|
542
448
|
|
|
543
|
-
However, there are cases where Prettier breaks things into several lines such
|
|
544
|
-
that the `no-unexpected-multiline` conflicts.
|
|
449
|
+
However, there are cases where Prettier breaks things into several lines such that the `no-unexpected-multiline` conflicts.
|
|
545
450
|
|
|
451
|
+
<!-- prettier-ignore -->
|
|
546
452
|
```js
|
|
547
453
|
const value = text.trim().split("\n")[position].toLowerCase();
|
|
548
454
|
```
|
|
549
455
|
|
|
550
456
|
Prettier breaks it up into several lines, though, causing a conflict:
|
|
551
457
|
|
|
458
|
+
<!-- prettier-ignore -->
|
|
552
459
|
```js
|
|
553
460
|
const value = text
|
|
554
461
|
.trim()
|
|
@@ -556,10 +463,9 @@ const value = text
|
|
|
556
463
|
[position].toLowerCase();
|
|
557
464
|
```
|
|
558
465
|
|
|
559
|
-
If you like this rule, it can usually be used with Prettier without problems,
|
|
560
|
-
but occasionally you might need to either temporarily disable the rule or
|
|
561
|
-
refactor your code.
|
|
466
|
+
If you like this rule, it can usually be used with Prettier without problems, but occasionally you might need to either temporarily disable the rule or refactor your code.
|
|
562
467
|
|
|
468
|
+
<!-- prettier-ignore -->
|
|
563
469
|
```js
|
|
564
470
|
const value = text
|
|
565
471
|
.trim()
|
|
@@ -573,13 +479,11 @@ const lines = text.trim().split("\n");
|
|
|
573
479
|
const value = lines[position].toLowerCase();
|
|
574
480
|
```
|
|
575
481
|
|
|
576
|
-
**Note:** If you _do_ enable this rule, you have to run ESLint and Prettier as
|
|
577
|
-
two separate steps (and ESLint first) in order to get any value out of it.
|
|
578
|
-
Otherwise Prettier might reformat your code in such a way that ESLint never gets
|
|
579
|
-
a chance to report anything (as seen in the first example).
|
|
482
|
+
**Note:** If you _do_ enable this rule, you have to run ESLint and Prettier as two separate steps (and ESLint first) in order to get any value out of it. Otherwise Prettier might reformat your code in such a way that ESLint never gets a chance to report anything (as seen in the first example).
|
|
580
483
|
|
|
581
484
|
Example configuration:
|
|
582
485
|
|
|
486
|
+
<!-- prettier-ignore -->
|
|
583
487
|
```json
|
|
584
488
|
{
|
|
585
489
|
"rules": {
|
|
@@ -594,20 +498,18 @@ Example configuration:
|
|
|
594
498
|
|
|
595
499
|
**This rule requires certain options and certain Prettier options.**
|
|
596
500
|
|
|
597
|
-
Usually, you don’t need this rule at all. But there are two cases where it could
|
|
598
|
-
be useful:
|
|
501
|
+
Usually, you don’t need this rule at all. But there are two cases where it could be useful:
|
|
599
502
|
|
|
600
|
-
- To enforce the use of backticks rather than single or double quotes for
|
|
601
|
-
strings.
|
|
503
|
+
- To enforce the use of backticks rather than single or double quotes for strings.
|
|
602
504
|
- To forbid backticks where regular strings could have been used.
|
|
603
505
|
|
|
604
506
|
#### Enforce backticks
|
|
605
507
|
|
|
606
|
-
If you’d like all strings to use backticks (never quotes), enable the
|
|
607
|
-
`"backtick"` option.
|
|
508
|
+
If you’d like all strings to use backticks (never quotes), enable the `"backtick"` option.
|
|
608
509
|
|
|
609
510
|
Example ESLint configuration:
|
|
610
511
|
|
|
512
|
+
<!-- prettier-ignore -->
|
|
611
513
|
```json
|
|
612
514
|
{
|
|
613
515
|
"rules": {
|
|
@@ -618,9 +520,9 @@ Example ESLint configuration:
|
|
|
618
520
|
|
|
619
521
|
#### Forbid unnecessary backticks
|
|
620
522
|
|
|
621
|
-
In the following example, the first array item could have been written with
|
|
622
|
-
quotes instead of backticks.
|
|
523
|
+
In the following example, the first array item could have been written with quotes instead of backticks.
|
|
623
524
|
|
|
525
|
+
<!-- prettier-ignore -->
|
|
624
526
|
```js
|
|
625
527
|
const strings = [
|
|
626
528
|
`could have been a regular string`,
|
|
@@ -633,20 +535,18 @@ const strings = [
|
|
|
633
535
|
];
|
|
634
536
|
```
|
|
635
537
|
|
|
636
|
-
If you’d like ESLint to enforce `` `could have been a regular string` `` being
|
|
637
|
-
written as either `"could have been a regular string"` or `'could have been a
|
|
638
|
-
regular string'`, you need to use some specific configuration. The `quotes` rule has two options, a string option and an object option.
|
|
538
|
+
If you’d like ESLint to enforce `` `could have been a regular string` `` being written as either `"could have been a regular string"` or `'could have been a regular string'`, you need to use some specific configuration. The `quotes` rule has two options, a string option and an object option.
|
|
639
539
|
|
|
640
|
-
- The first (string) option needs to be set to `"single"` or `"double"` and be
|
|
641
|
-
kept in sync with Prettier’s [singleQuote] option.
|
|
540
|
+
- The first (string) option needs to be set to `"single"` or `"double"` and be kept in sync with Prettier’s [singleQuote] option.
|
|
642
541
|
- The second (object) option needs the following properties:
|
|
643
542
|
- `"avoidEscape": true` to follow Prettier’s [string formatting rules].
|
|
644
543
|
- `"allowTemplateLiterals": false` to disallow unnecessary backticks.
|
|
645
544
|
|
|
646
|
-
##### Example
|
|
545
|
+
##### Example double quote configuration
|
|
647
546
|
|
|
648
547
|
ESLint:
|
|
649
548
|
|
|
549
|
+
<!-- prettier-ignore -->
|
|
650
550
|
```json
|
|
651
551
|
{
|
|
652
552
|
"rules": {
|
|
@@ -661,16 +561,18 @@ ESLint:
|
|
|
661
561
|
|
|
662
562
|
Prettier (this is the default, so adding this is not required):
|
|
663
563
|
|
|
564
|
+
<!-- prettier-ignore -->
|
|
664
565
|
```json
|
|
665
566
|
{
|
|
666
567
|
"singleQuote": false
|
|
667
568
|
}
|
|
668
569
|
```
|
|
669
570
|
|
|
670
|
-
##### Example
|
|
571
|
+
##### Example single quote configuration
|
|
671
572
|
|
|
672
573
|
ESLint:
|
|
673
574
|
|
|
575
|
+
<!-- prettier-ignore -->
|
|
674
576
|
```json
|
|
675
577
|
{
|
|
676
578
|
"rules": {
|
|
@@ -685,6 +587,7 @@ ESLint:
|
|
|
685
587
|
|
|
686
588
|
Prettier:
|
|
687
589
|
|
|
590
|
+
<!-- prettier-ignore -->
|
|
688
591
|
```json
|
|
689
592
|
{
|
|
690
593
|
"singleQuote": true
|
|
@@ -699,6 +602,7 @@ This rule enforces whether elements should be self-closing or not.
|
|
|
699
602
|
|
|
700
603
|
Prettier generally preserves the way you wrote your elements:
|
|
701
604
|
|
|
605
|
+
<!-- prettier-ignore -->
|
|
702
606
|
```vue
|
|
703
607
|
<div />
|
|
704
608
|
<div></div>
|
|
@@ -708,14 +612,13 @@ Prettier generally preserves the way you wrote your elements:
|
|
|
708
612
|
<svg><path d=""></path></svg>
|
|
709
613
|
```
|
|
710
614
|
|
|
711
|
-
But for known _void_ HTML elements, Prettier always uses the self-closing style.
|
|
712
|
-
For example, `<img>` is turned into `<img />`.
|
|
615
|
+
But for known _void_ HTML elements, Prettier always uses the self-closing style. For example, `<img>` is turned into `<img />`.
|
|
713
616
|
|
|
714
|
-
If you like this rule, it can be used just fine with Prettier as long as you
|
|
715
|
-
set `html.void` to `"any"`.
|
|
617
|
+
If you like this rule, it can be used just fine with Prettier as long as you set `html.void` to `"any"`.
|
|
716
618
|
|
|
717
619
|
Example ESLint configuration:
|
|
718
620
|
|
|
621
|
+
<!-- prettier-ignore -->
|
|
719
622
|
```json
|
|
720
623
|
{
|
|
721
624
|
"rules": {
|
|
@@ -733,35 +636,29 @@ Example ESLint configuration:
|
|
|
733
636
|
|
|
734
637
|
## Other rules worth mentioning
|
|
735
638
|
|
|
736
|
-
These rules don’t conflict with Prettier, but have some gotchas when used with
|
|
737
|
-
Prettier.
|
|
639
|
+
These rules don’t conflict with Prettier, but have some gotchas when used with Prettier.
|
|
738
640
|
|
|
739
641
|
### [no-sequences]
|
|
740
642
|
|
|
741
|
-
This rule forbids using JavaScript’s confusing comma operator (sequence
|
|
742
|
-
expressions). This piece of code is not doing what it looks like:
|
|
643
|
+
This rule forbids using JavaScript’s confusing comma operator (sequence expressions). This piece of code is not doing what it looks like:
|
|
743
644
|
|
|
645
|
+
<!-- prettier-ignore -->
|
|
744
646
|
```js
|
|
745
647
|
matrix[4, 7];
|
|
746
648
|
```
|
|
747
649
|
|
|
748
|
-
Prettier adds parentheses to the above to make it clear that a sequence
|
|
749
|
-
expression is used:
|
|
650
|
+
Prettier adds parentheses to the above to make it clear that a sequence expression is used:
|
|
750
651
|
|
|
652
|
+
<!-- prettier-ignore -->
|
|
751
653
|
```js
|
|
752
654
|
matrix[(4, 7)];
|
|
753
655
|
```
|
|
754
656
|
|
|
755
|
-
However, the `no-sequences` rule allows comma operators if the expression
|
|
756
|
-
sequence is explicitly wrapped in parentheses. Since Prettier automatically
|
|
757
|
-
wraps them in parentheses, you might never see any warnings from ESLint about
|
|
758
|
-
comma operators.
|
|
657
|
+
However, the `no-sequences` rule allows comma operators if the expression sequence is explicitly wrapped in parentheses. Since Prettier automatically wraps them in parentheses, you might never see any warnings from ESLint about comma operators.
|
|
759
658
|
|
|
760
|
-
Ending up with an accidental sequence expression can easily happen while
|
|
761
|
-
refactoring. If you want ESLint to catch such mistakes, it is recommended to
|
|
762
|
-
forbid sequence expressions entirely using [no-restricted-syntax] \([as
|
|
763
|
-
mentioned in the `no-sequences` documentation][no-sequences-full]):
|
|
659
|
+
Ending up with an accidental sequence expression can easily happen while refactoring. If you want ESLint to catch such mistakes, it is recommended to forbid sequence expressions entirely using [no-restricted-syntax] \([as mentioned in the `no-sequences` documentation][no-sequences-full]):
|
|
764
660
|
|
|
661
|
+
<!-- prettier-ignore -->
|
|
765
662
|
```json
|
|
766
663
|
{
|
|
767
664
|
"rules": {
|
|
@@ -770,13 +667,11 @@ mentioned in the `no-sequences` documentation][no-sequences-full]):
|
|
|
770
667
|
}
|
|
771
668
|
```
|
|
772
669
|
|
|
773
|
-
If you still need to use the comma operator for some edge case, you can place an
|
|
774
|
-
`// eslint-disable-next-line no-restricted-syntax` comment on the line above the
|
|
775
|
-
expression. `no-sequences` can safely be disabled if you use the
|
|
776
|
-
`no-restricted-syntax` approach.
|
|
670
|
+
If you still need to use the comma operator for some edge case, you can place an `// eslint-disable-next-line no-restricted-syntax` comment on the line above the expression. `no-sequences` can safely be disabled if you use the `no-restricted-syntax` approach.
|
|
777
671
|
|
|
778
672
|
You can also supply a custom message if you want:
|
|
779
673
|
|
|
674
|
+
<!-- prettier-ignore -->
|
|
780
675
|
```json
|
|
781
676
|
{
|
|
782
677
|
"rules": {
|
|
@@ -795,28 +690,27 @@ You can also supply a custom message if you want:
|
|
|
795
690
|
|
|
796
691
|
eslint-config-prettier has been tested with:
|
|
797
692
|
|
|
798
|
-
- ESLint
|
|
693
|
+
- ESLint 7.11.0
|
|
694
|
+
- eslint-config-prettier 6.11.0 and older were tested with ESLint 6.x
|
|
799
695
|
- eslint-config-prettier 5.1.0 and older were tested with ESLint 5.x
|
|
800
696
|
- eslint-config-prettier 2.10.0 and older were tested with ESLint 4.x
|
|
801
697
|
- eslint-config-prettier 2.1.1 and older were tested with ESLint 3.x
|
|
802
|
-
- prettier 1.
|
|
803
|
-
- @typescript-eslint/eslint-plugin
|
|
804
|
-
- eslint-plugin-babel 5.3.
|
|
805
|
-
- eslint-plugin-flowtype
|
|
806
|
-
- eslint-plugin-react 7.
|
|
698
|
+
- prettier 2.1.2
|
|
699
|
+
- @typescript-eslint/eslint-plugin 4.4.1
|
|
700
|
+
- eslint-plugin-babel 5.3.1
|
|
701
|
+
- eslint-plugin-flowtype 5.2.0
|
|
702
|
+
- eslint-plugin-react 7.21.4
|
|
807
703
|
- eslint-plugin-standard 4.0.1
|
|
808
|
-
- eslint-plugin-unicorn
|
|
809
|
-
- eslint-plugin-vue
|
|
704
|
+
- eslint-plugin-unicorn 22.0.0
|
|
705
|
+
- eslint-plugin-vue 7.0.1
|
|
810
706
|
|
|
811
|
-
Have new rules been added since those versions? Have we missed any rules? Is
|
|
812
|
-
there a plugin you would like to see exclusions for? Open an issue or a pull
|
|
813
|
-
request!
|
|
707
|
+
Have new rules been added since those versions? Have we missed any rules? Is there a plugin you would like to see exclusions for? Open an issue or a pull request!
|
|
814
708
|
|
|
815
|
-
If you’d like to add support for eslint-plugin-foobar, this is how you’d go
|
|
816
|
-
about it:
|
|
709
|
+
If you’d like to add support for eslint-plugin-foobar, this is how you’d go about it:
|
|
817
710
|
|
|
818
711
|
First, create `foobar.js`:
|
|
819
712
|
|
|
713
|
+
<!-- prettier-ignore -->
|
|
820
714
|
```js
|
|
821
715
|
"use strict";
|
|
822
716
|
|
|
@@ -829,6 +723,7 @@ module.exports = {
|
|
|
829
723
|
|
|
830
724
|
Then, create `test-lint/foobar.js`:
|
|
831
725
|
|
|
726
|
+
<!-- prettier-ignore -->
|
|
832
727
|
```js
|
|
833
728
|
/* eslint-disable quotes */
|
|
834
729
|
"use strict";
|
|
@@ -838,35 +733,25 @@ Then, create `test-lint/foobar.js`:
|
|
|
838
733
|
console.log();
|
|
839
734
|
```
|
|
840
735
|
|
|
841
|
-
`test-lint/foobar.js` must fail when used with eslint-plugin-foobar and
|
|
842
|
-
eslint-plugin-prettier at the same time – until `"prettier/foobar"` is added to
|
|
843
|
-
the "extends" property of an ESLint config. The file should be formatted
|
|
844
|
-
according to Prettier, and that formatting should disagree with the plugin.
|
|
736
|
+
`test-lint/foobar.js` must fail when used with eslint-plugin-foobar and eslint-plugin-prettier at the same time – until `"prettier/foobar"` is added to the "extends" property of an ESLint config. The file should be formatted according to Prettier, and that formatting should disagree with the plugin.
|
|
845
737
|
|
|
846
738
|
Finally, you need to mention the plugin in several places:
|
|
847
739
|
|
|
848
740
|
- Add `"foobar.js"` to the "files" field in `package.json`.
|
|
849
741
|
- Add eslint-plugin-foobar to the "devDependencies" field in `package.json`.
|
|
850
|
-
- Make sure that at least one rule from eslint-plugin-foobar gets used in
|
|
851
|
-
|
|
852
|
-
- Add it to the list of supported plugins, to the example config and to
|
|
853
|
-
Contributing section in `README.md`.
|
|
742
|
+
- Make sure that at least one rule from eslint-plugin-foobar gets used in `.eslintrc.base.js`.
|
|
743
|
+
- Add it to the list of supported plugins, to the example config and to Contributing section in `README.md`.
|
|
854
744
|
|
|
855
|
-
When you’re done, run `npm test` to verify that you got it all right. It runs
|
|
856
|
-
several other npm scripts:
|
|
745
|
+
When you’re done, run `npm test` to verify that you got it all right. It runs several other npm scripts:
|
|
857
746
|
|
|
858
|
-
- `"test:lint"` makes sure that the files in `test-lint/` pass ESLint when
|
|
859
|
-
the exclusions from eslint-config-prettier are used. It also lints the code of
|
|
860
|
-
eslint-config-prettier itself.
|
|
747
|
+
- `"test:lint"` makes sure that the files in `test-lint/` pass ESLint when the exclusions from eslint-config-prettier are used. It also lints the code of eslint-config-prettier itself, and checks that Prettier has been run on all files.
|
|
861
748
|
- `"test:lint-verify-fail"` is run by a test in `test/lint-verify-fail.test.js`.
|
|
862
749
|
- `"test:lint-rules"` is run by a test in `test/rules.test.js`.
|
|
863
750
|
- `"test:jest"` runs unit tests that check a number of things:
|
|
864
751
|
- That eslint-plugin-foobar is mentioned in all the places shown above.
|
|
865
|
-
- That no unknown rules are turned off. This helps catching typos, for
|
|
866
|
-
example.
|
|
752
|
+
- That no unknown rules are turned off. This helps catching typos, for example.
|
|
867
753
|
- That the CLI works.
|
|
868
|
-
- `"test:cli-sanity"` and `"test:cli-sanity-warning"` are sanity checks for the
|
|
869
|
-
CLI.
|
|
754
|
+
- `"test:cli-sanity"` and `"test:cli-sanity-warning"` are sanity checks for the CLI.
|
|
870
755
|
|
|
871
756
|
## License
|
|
872
757
|
|
|
@@ -874,8 +759,8 @@ several other npm scripts:
|
|
|
874
759
|
|
|
875
760
|
[@typescript-eslint/eslint-plugin]: https://github.com/typescript-eslint/typescript-eslint
|
|
876
761
|
[@typescript-eslint/quotes]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/quotes.md
|
|
877
|
-
[
|
|
878
|
-
[
|
|
762
|
+
[eslint 5.7.0]: https://eslint.org/blog/2018/10/eslint-v5.7.0-released
|
|
763
|
+
[prettier]: https://github.com/prettier/prettier
|
|
879
764
|
[arrow-body-style]: https://eslint.org/docs/rules/arrow-body-style
|
|
880
765
|
[babel/quotes]: https://github.com/babel/eslint-plugin-babel#rules
|
|
881
766
|
[curly]: https://eslint.org/docs/rules/curly
|
|
@@ -903,9 +788,7 @@ several other npm scripts:
|
|
|
903
788
|
[overrides]: https://eslint.org/docs/user-guide/configuring#configuration-based-on-glob-patterns
|
|
904
789
|
[prefer-arrow-callback]: https://eslint.org/docs/rules/prefer-arrow-callback
|
|
905
790
|
[quotes]: https://eslint.org/docs/rules/quotes
|
|
906
|
-
[
|
|
791
|
+
[singlequote]: https://prettier.io/docs/en/options.html#quotes
|
|
907
792
|
[string formatting rules]: https://prettier.io/docs/en/rationale.html#strings
|
|
908
|
-
[travis-badge]: https://travis-ci.org/prettier/eslint-config-prettier.svg?branch=master
|
|
909
|
-
[travis]: https://travis-ci.org/prettier/eslint-config-prettier
|
|
910
793
|
[vue/html-self-closing]: https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/html-self-closing.md
|
|
911
794
|
[vue/max-len]: https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/max-len.md
|