eslint-config-prettier 4.3.0 → 6.1.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/CHANGELOG.md CHANGED
@@ -1,3 +1,69 @@
1
+ ### Version 6.1.0 (2019-08-19)
2
+
3
+ - Added: [function-call-argument-newline] \(new in ESLint 6.2.0). Thanks to
4
+ Masafumi Koba (@ybiquitous)!
5
+
6
+ ### Version 6.0.0 (2019-06-25)
7
+
8
+ - Changed: The CLI helper tool now considers [no-confusing-arrow] to conflict
9
+ if you use the default value of its `allowParens` option. The default was
10
+ changed to `true` in ESLint 6, which conflicts with Prettier.
11
+
12
+ If the CLI helper tool gives you errors about this after upgrading, the
13
+ solution is to change this:
14
+
15
+ ```json
16
+ {
17
+ "rules": {
18
+ "no-confusing-arrow": ["error"]
19
+ }
20
+ }
21
+ ```
22
+
23
+ Into this:
24
+
25
+ ```json
26
+ {
27
+ "rules": {
28
+ "no-confusing-arrow": ["error", { "allowParens": false }]
29
+ }
30
+ }
31
+ ```
32
+
33
+ The latter works in both ESLint 6 as well as in ESLint 5 and older.
34
+
35
+ - Improved: `eslint --print-config` usage instructions. The CLI tool help
36
+ text as well as the documentation has been updated to suggest commands that
37
+ work in ESLint 6.0 as well as in ESLint 5 and older. (Instead of `eslint
38
+ --print-config .`, use `eslint --print-config path/to/main.js`.)
39
+
40
+ ### Version 5.1.0 (2019-06-25)
41
+
42
+ - Added: [react/jsx-curly-newline]. Thanks to Masafumi Koba (@ybiquitous)!
43
+
44
+ ### Version 5.0.0 (2019-06-15)
45
+
46
+ - Removed: [react/self-closing-comp]. This rule was added in v4.1.0 not
47
+ because it _conflicted_ with Prettier but because it was _unnecessary_ when
48
+ using Prettier. However, in v1.18.0 [Prettier stopped converting empty
49
+ elements to self-closing elements][prettier-self-closing]. So the rule is
50
+ not unnecessary anymore.
51
+
52
+ If you use Prettier v1.17.1 or older you should be able to upgrade
53
+ eslint-config-prettier to v5.0.0 without having to do anything else.
54
+
55
+ If you use Prettier v1.18.0 or newer, you might get lint errors about for
56
+ example changing `<div></div>` into `<div />`. You have two options:
57
+
58
+ - Run `eslint --fix` if you prefer to enforce self-closing elements where
59
+ possible. This should fix all the errors.
60
+ - Add `"react/self-closing-comp": "off"` to your ESLint config if you use
61
+ autofix from your editor and you face the same [issue as Prettier
62
+ did][prettier-self-closing].
63
+
64
+ - Changed: Node.js 6 is no longer officially supported, but v5.0.0 should
65
+ still work with it.
66
+
1
67
  ### Version 4.3.0 (2019-05-16)
2
68
 
3
69
  - Added: New [eslint-plugin-vue] rules: [vue/arrow-spacing],
@@ -13,7 +79,7 @@
13
79
  ### Version 4.1.0 (2019-02-26)
14
80
 
15
81
  - Added: [linebreak-style]. Use Prettier’s [end-of-line] option instead.
16
- - Added: [self-closing-comp]. Thanks to Gaurav Gupta (@gaurav5430)!
82
+ - Added: [react/self-closing-comp]. Thanks to Gaurav Gupta (@gaurav5430)!
17
83
 
18
84
  ### Version 4.0.0 (2019-01-26)
19
85
 
@@ -228,14 +294,15 @@
228
294
  [@typescript-eslint/func-call-spacing]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/func-call-spacing.md
229
295
  [@typescript-eslint/no-extra-parens]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extra-parens.md
230
296
  [@typescript-eslint/semi]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/semi.md
231
- [ESLint 4.0.0]: https://eslint.org/blog/2017/06/eslint-v4.0.0-released
232
- [ESLint 4.6.0]: https://eslint.org/blog/2017/09/eslint-v4.6.0-released
233
297
  [array-bracket-newline]: https://eslint.org/docs/rules/array-bracket-newline
234
298
  [array-element-newline]: https://eslint.org/docs/rules/array-element-newline
235
299
  [arrow-body-style]: https://eslint.org/docs/rules/arrow-body-style
236
300
  [arrow-special]: https://github.com/prettier/eslint-config-prettier/blob/2c842675e55b91aecaef6f997d234ebf2d220ffb/README.md#arrow-body-style-and-prefer-arrow-callback
237
301
  [curly]: https://eslint.org/docs/rules/curly
238
302
  [end-of-line]: https://prettier.io/docs/en/options.html#end-of-line
303
+ [ESLint 4.0.0]: https://eslint.org/blog/2017/06/eslint-v4.0.0-released
304
+ [ESLint 4.6.0]: https://eslint.org/blog/2017/09/eslint-v4.6.0-released
305
+ [eslint-plugin-babel]: https://github.com/babel/eslint-plugin-babel
239
306
  [eslint-plugin-flowtype]: https://github.com/gajus/eslint-plugin-flowtype
240
307
  [eslint-plugin-prettier]: https://github.com/prettier/eslint-plugin-prettier
241
308
  [eslint-plugin-react]: https://github.com/yannickcr/eslint-plugin-react
@@ -244,6 +311,7 @@
244
311
  [eslint-plugin-unicorn]: https://github.com/sindresorhus/eslint-plugin-unicorn
245
312
  [eslint-plugin-vue]: https://github.com/vuejs/eslint-plugin-vue
246
313
  [flowtype/boolean-style]: https://github.com/gajus/eslint-plugin-flowtype#eslint-plugin-flowtype-rules-boolean-style
314
+ [function-call-argument-newline]: https://eslint.org/docs/rules/function-call-argument-newline
247
315
  [function-paren-newline]: https://eslint.org/docs/rules/function-paren-newline
248
316
  [implicit-arrow-linebreak]: https://eslint.org/docs/rules/implicit-arrow-linebreak
249
317
  [indent-legacy]: https://eslint.org/docs/rules/indent-legacy
@@ -260,14 +328,16 @@
260
328
  [nonblock-statement-body-position]: https://eslint.org/docs/rules/nonblock-statement-body-position
261
329
  [one-var-declaration-per-line]: https://eslint.org/docs/rules/one-var-declaration-per-line
262
330
  [prefer-arrow-callback]: https://eslint.org/docs/rules/prefer-arrow-callback
331
+ [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
263
332
  [prettier]: https://github.com/prettier
264
333
  [quotes-special]: https://github.com/prettier/eslint-config-prettier/blob/8d264cd0a7f06c12e2e05415e0282a4f8f21ebc9/README.md#quotes
265
334
  [quotes]: https://eslint.org/docs/rules/quotes
266
335
  [react/jsx-child-element-spacing]: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-child-element-spacing.md
267
336
  [react/jsx-closing-tag-location]: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-tag-location.md
337
+ [react/jsx-curly-newline]: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-newline.md
268
338
  [react/jsx-one-expression-per-line]: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-one-expression-per-line.md
269
339
  [react/jsx-props-no-multi-spaces]: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-multi-spaces.md
270
- [self-closing-comp]: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
340
+ [react/self-closing-comp]: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
271
341
  [semi-style]: https://eslint.org/docs/rules/semi-style
272
342
  [switch-colon-spacing]: https://eslint.org/docs/rules/switch-colon-spacing
273
343
  [template-tag-spacing]: https://eslint.org/docs/rules/template-tag-spacing
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Turns off all rules that are unnecessary or might conflict with [Prettier].
4
4
 
5
- This lets you use you favorite shareable config without letting its stylistic
5
+ This lets you use your favorite shareable config without letting its stylistic
6
6
  choices get in the way when using Prettier.
7
7
 
8
8
  Note that this config _only_ turns rules _off,_ so it only makes sense using
@@ -119,19 +119,27 @@ First, add a script for it to package.json:
119
119
  ```json
120
120
  {
121
121
  "scripts": {
122
- "eslint-check": "eslint --print-config . | eslint-config-prettier-check"
122
+ "eslint-check": "eslint --print-config path/to/main.js | eslint-config-prettier-check"
123
123
  }
124
124
  }
125
125
  ```
126
126
 
127
- Then run `npm run eslint-check`.
127
+ Then run `npm run eslint-check`. (Change `path/to/main.js` to a file that
128
+ exists in your project.)
128
129
 
129
- If you use [multiple configuration files] or [overrides], you may need to run
130
- the above script several times with different `--print-config` arguments, such
131
- as:
130
+ In theory you need to run `eslint --print-config file.js |
131
+ eslint-config-prettier-check` for every single file in your project to be
132
+ 100% sure that there are no conflicting rules, because ESLint supports having
133
+ different rules for different files. But usually you’ll have about the same
134
+ rules for all files, so it is enough to run the command on one file (pick one
135
+ that you won’t be moving). If you use [multiple configuration files] or
136
+ [overrides], you can (but you probably don’t need to!) run the above script
137
+ several times with different `--print-config` arguments, such as:
132
138
 
133
139
  ```
140
+ eslint --print-config index.js | eslint-config-prettier-check
134
141
  eslint --print-config test/index.js | eslint-config-prettier-check
142
+ eslint --print-config legacy/main.js | eslint-config-prettier-check
135
143
  ```
136
144
 
137
145
  Exit codes:
@@ -365,22 +373,14 @@ For example, the rule could warn about this line:
365
373
  var x = a => 1 ? 2 : 3;
366
374
  ```
367
375
 
368
- By default, ESLint suggests switching to an explicit return:
369
-
370
- ```js
371
- var x = a => { return 1 ? 2 : 3; };
372
- ```
373
-
374
- That causes no problems with Prettier.
375
-
376
- With `{allowParens: true}`, adding parentheses is also considered a valid way to
377
- avoid the arrow confusion:
376
+ With `{allowParens: true}` (the default since ESLint 6.0.0), adding
377
+ parentheses is considered a valid way to avoid the arrow confusion:
378
378
 
379
379
  ```js
380
380
  var x = a => (1 ? 2 : 3);
381
381
  ```
382
382
 
383
- While Prettier keeps thoses parentheses, it removes them if the line is long
383
+ While Prettier keeps those parentheses, it removes them if the line is long
384
384
  enough to introduce a line break:
385
385
 
386
386
  ```js
@@ -388,6 +388,15 @@ EnterpriseCalculator.prototype.calculateImportantNumbers = inputNumber =>
388
388
  1 ? 2 : 3;
389
389
  ```
390
390
 
391
+ With `{allowParens: false}`, ESLint instead suggests switching to an explicit
392
+ return:
393
+
394
+ ```js
395
+ var x = a => { return 1 ? 2 : 3; };
396
+ ```
397
+
398
+ That causes no problems with Prettier.
399
+
391
400
  If you like this rule, it can be used just fine with Prettier as long as the
392
401
  `allowParens` option is off.
393
402
 
@@ -396,11 +405,18 @@ Example ESLint configuration:
396
405
  ```json
397
406
  {
398
407
  "rules": {
399
- "no-confusing-arrow": "error"
408
+ "no-confusing-arrow": ["error", { "allowParens": false }]
400
409
  }
401
410
  }
402
411
  ```
403
412
 
413
+ (Note: The CLI helper tool considers `{allowParens: true}` to be the default,
414
+ which is the case since ESLint 6.0.0. The tool will produce a warning if you
415
+ use the default even if you use an older version of ESLint. It doesn’t hurt
416
+ to explicitly set `{allowParens: false}` even though it is technically
417
+ redundant. This way you are prepared for a future ESLint upgrade and the CLI
418
+ tool can be kept simple.)
419
+
404
420
  ### [no-mixed-operators]
405
421
 
406
422
  **This rule requires special attention when writing code.**
@@ -764,17 +780,18 @@ You can also supply a custom message if you want:
764
780
 
765
781
  eslint-config-prettier has been tested with:
766
782
 
767
- - ESLint 5.16.0
783
+ - ESLint 6.2.0
784
+ - eslint-config-prettier 5.1.0 and older were tested with ESLint 5.x
768
785
  - eslint-config-prettier 2.10.0 and older were tested with ESLint 4.x
769
786
  - eslint-config-prettier 2.1.1 and older were tested with ESLint 3.x
770
- - prettier 1.17.1
771
- - @typescript-eslint/eslint-plugin 1.9.0
787
+ - prettier 1.18.2
788
+ - @typescript-eslint/eslint-plugin 2.0.0
772
789
  - eslint-plugin-babel 5.3.0
773
- - eslint-plugin-flowtype 3.9.0
774
- - eslint-plugin-react 7.13.0
790
+ - eslint-plugin-flowtype 4.2.0
791
+ - eslint-plugin-react 7.14.3
775
792
  - eslint-plugin-standard 4.0.0
776
- - eslint-plugin-unicorn 8.0.2
777
- - eslint-plugin-vue 5.2.2
793
+ - eslint-plugin-unicorn 10.0.0
794
+ - eslint-plugin-vue 5.2.3
778
795
 
779
796
  Have new rules been added since those versions? Have we missed any rules? Is
780
797
  there a plugin you would like to see exclusions for? Open an issue or a pull
package/bin/cli.js CHANGED
@@ -17,7 +17,7 @@ if (module === require.main) {
17
17
  "This tool checks whether an ESLint configuration contains rules that are",
18
18
  "unnecessary or conflict with Prettier. It’s supposed to be run like this:",
19
19
  "",
20
- " eslint --print-config . | eslint-config-prettier-check",
20
+ " eslint --print-config path/to/main.js | eslint-config-prettier-check",
21
21
  " eslint --print-config test/index.js | eslint-config-prettier-check",
22
22
  "",
23
23
  "Exit codes:",
package/bin/validators.js CHANGED
@@ -32,11 +32,11 @@ module.exports = {
32
32
 
33
33
  "no-confusing-arrow"(options) {
34
34
  if (options.length === 0) {
35
- return true;
35
+ return false;
36
36
  }
37
37
 
38
38
  const firstOption = options[0];
39
- return !(firstOption && firstOption.allowParens);
39
+ return firstOption ? firstOption.allowParens === false : false;
40
40
  },
41
41
 
42
42
  "vue/html-self-closing"(options) {
package/index.js CHANGED
@@ -30,6 +30,7 @@ module.exports = {
30
30
  "dot-location": "off",
31
31
  "eol-last": "off",
32
32
  "func-call-spacing": "off",
33
+ "function-call-argument-newline": "off",
33
34
  "function-paren-newline": "off",
34
35
  "generator-star": "off",
35
36
  "generator-star-spacing": "off",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-prettier",
3
- "version": "4.3.0",
3
+ "version": "6.1.0",
4
4
  "license": "MIT",
5
5
  "author": "Simon Lydell",
6
6
  "description": "Turns off all rules that are unnecessary or might conflict with Prettier.",
@@ -30,7 +30,7 @@
30
30
  "test:lint-verify-fail": "eslint \"test-lint/*.{js,ts,vue}\" --config .eslintrc.base.js --format json",
31
31
  "test:lint-rules": "eslint index.js --config test-config/.eslintrc.js --format json",
32
32
  "test:jest": "jest",
33
- "test:cli-sanity": "eslint --print-config . | node ./bin/cli.js",
33
+ "test:cli-sanity": "eslint --print-config index.js | node ./bin/cli.js",
34
34
  "test:cli-sanity-warning": "eslint --print-config ./bin/cli.js | node ./bin/cli.js",
35
35
  "test": "npm run test:lint && npm run test:jest && npm run test:cli-sanity && npm run test:cli-sanity-warning"
36
36
  },
@@ -38,25 +38,25 @@
38
38
  "get-stdin": "^6.0.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@typescript-eslint/eslint-plugin": "1.9.0",
42
- "@typescript-eslint/parser": "1.9.0",
43
- "babel-eslint": "10.0.1",
41
+ "@typescript-eslint/eslint-plugin": "2.0.0",
42
+ "@typescript-eslint/parser": "2.0.0",
43
+ "babel-eslint": "10.0.2",
44
44
  "cross-spawn": "6.0.5",
45
45
  "doctoc": "1.4.0",
46
- "eslint": "5.16.0",
46
+ "eslint": "6.2.0",
47
47
  "eslint-config-google": "0.13.0",
48
48
  "eslint-plugin-babel": "5.3.0",
49
- "eslint-plugin-flowtype": "3.9.0",
49
+ "eslint-plugin-flowtype": "4.2.0",
50
50
  "eslint-plugin-prettier": "3.1.0",
51
- "eslint-plugin-react": "7.13.0",
51
+ "eslint-plugin-react": "7.14.3",
52
52
  "eslint-plugin-standard": "4.0.0",
53
- "eslint-plugin-unicorn": "8.0.2",
54
- "eslint-plugin-vue": "5.2.2",
55
- "jest": "24.8.0",
56
- "prettier": "1.17.1",
53
+ "eslint-plugin-unicorn": "10.0.0",
54
+ "eslint-plugin-vue": "5.2.3",
55
+ "jest": "24.9.0",
56
+ "prettier": "1.18.2",
57
57
  "replace": "1.1.0",
58
- "rimraf": "2.6.3",
59
- "typescript": "3.4.5"
58
+ "rimraf": "3.0.0",
59
+ "typescript": "3.5.3"
60
60
  },
61
61
  "peerDependencies": {
62
62
  "eslint": ">=3.14.1"
package/react.js CHANGED
@@ -5,6 +5,7 @@ module.exports = {
5
5
  "react/jsx-child-element-spacing": "off",
6
6
  "react/jsx-closing-bracket-location": "off",
7
7
  "react/jsx-closing-tag-location": "off",
8
+ "react/jsx-curly-newline": "off",
8
9
  "react/jsx-curly-spacing": "off",
9
10
  "react/jsx-equals-spacing": "off",
10
11
  "react/jsx-first-prop-new-line": "off",
@@ -15,7 +16,6 @@ module.exports = {
15
16
  "react/jsx-props-no-multi-spaces": "off",
16
17
  "react/jsx-space-before-closing": "off",
17
18
  "react/jsx-tag-spacing": "off",
18
- "react/jsx-wrap-multilines": "off",
19
- "react/self-closing-comp": "off"
19
+ "react/jsx-wrap-multilines": "off"
20
20
  }
21
21
  };