eslint-config-prettier 3.5.0 → 4.2.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.
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ module.exports = {
4
+ rules: {
5
+ "@typescript-eslint/indent": "off",
6
+ "@typescript-eslint/member-delimiter-style": "off",
7
+ "@typescript-eslint/no-extra-parens": "off",
8
+ "@typescript-eslint/type-annotation-spacing": "off"
9
+ }
10
+ };
package/CHANGELOG.md CHANGED
@@ -1,3 +1,31 @@
1
+ ### Version 4.2.0 (2019-04-25)
2
+
3
+ - Added: [@typescript-eslint/no-extra-parens]. Thanks to Keiichiro Amemiya
4
+ (@Hoishin) and Jen Gorfine (@jgorfine)!
5
+
6
+ ### Version 4.1.0 (2019-02-26)
7
+
8
+ - Added: [linebreak-style]. Use Prettier’s [end-of-line] option instead.
9
+ - Added: [self-closing-comp]. Thanks to Gaurav Gupta (@gaurav5430)!
10
+
11
+ ### Version 4.0.0 (2019-01-26)
12
+
13
+ - Breaking change: Support for [eslint-plugin-typescript] has been removed and
14
+ replaced with support for its successor [@typescript-eslint/eslint-plugin].
15
+ Thanks to TANIGUCHI Masaya (@ta2gch) and everyone else who helped with this!
16
+ - Changed: [arrow-body-style] and [prefer-arrow-callback] are now marked as
17
+ [special rules][arrow-special], since they might cause problems if using
18
+ [eslint-plugin-prettier] and `--fix`. They are turned off by default, and the
19
+ CLI helper tool will _warn_ about them (but not error if you do enable them).
20
+ This won’t break your linting checks, but do note that these rules will be
21
+ disabled unless you explicitly enable them again, and that you might see new
22
+ warnings when running the CLI helper tool.
23
+
24
+ ### Version 3.6.0 (2019-01-19)
25
+
26
+ - Added: Support for [eslint-plugin-babel]. Thanks to Matija Marohnić
27
+ (@silvenon)!
28
+
1
29
  ### Version 3.5.0 (2019-01-16)
2
30
 
3
31
  - Fixed: The eslint-plugin-vue change from 3.4.0 has been reverted. That change
@@ -189,12 +217,18 @@
189
217
 
190
218
  - Initial release.
191
219
 
220
+ [@typescript-eslint/eslint-plugin]: https://github.com/typescript-eslint/typescript-eslint
221
+ [@typescript-eslint/no-extra-parens]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extra-parens.md
192
222
  [ESLint 4.0.0]: https://eslint.org/blog/2017/06/eslint-v4.0.0-released
193
223
  [ESLint 4.6.0]: https://eslint.org/blog/2017/09/eslint-v4.6.0-released
194
224
  [array-bracket-newline]: https://eslint.org/docs/rules/array-bracket-newline
195
225
  [array-element-newline]: https://eslint.org/docs/rules/array-element-newline
226
+ [arrow-body-style]: https://eslint.org/docs/rules/arrow-body-style
227
+ [arrow-special]: https://github.com/prettier/eslint-config-prettier/blob/2c842675e55b91aecaef6f997d234ebf2d220ffb/README.md#arrow-body-style-and-prefer-arrow-callback
196
228
  [curly]: https://eslint.org/docs/rules/curly
229
+ [end-of-line]: https://prettier.io/docs/en/options.html#end-of-line
197
230
  [eslint-plugin-flowtype]: https://github.com/gajus/eslint-plugin-flowtype
231
+ [eslint-plugin-prettier]: https://github.com/prettier/eslint-plugin-prettier
198
232
  [eslint-plugin-react]: https://github.com/yannickcr/eslint-plugin-react
199
233
  [eslint-plugin-standard]: https://github.com/xjamundx/eslint-plugin-standard
200
234
  [eslint-plugin-typescript]: https://github.com/bradzacher/eslint-plugin-typescript
@@ -204,6 +238,7 @@
204
238
  [function-paren-newline]: https://eslint.org/docs/rules/function-paren-newline
205
239
  [implicit-arrow-linebreak]: https://eslint.org/docs/rules/implicit-arrow-linebreak
206
240
  [indent-legacy]: https://eslint.org/docs/rules/indent-legacy
241
+ [linebreak-style]: https://eslint.org/docs/rules/linebreak-style
207
242
  [lines-around-comment-special]: https://github.com/prettier/eslint-config-prettier/blob/5399175c37466747aae9d407021dffec2c169c8b/README.md#lines-around-comment
208
243
  [lines-around-comment]: https://eslint.org/docs/rules/lines-around-comment
209
244
  [no-confusing-arrow-special]: https://github.com/prettier/eslint-config-prettier/blob/08ac5bcc25c9cdc71864b4a1e4191e7d28dd2bc2/README.md#no-confusing-arrow
@@ -215,15 +250,17 @@
215
250
  [no-unexpected-multiline]: https://eslint.org/docs/rules/no-unexpected-multiline
216
251
  [nonblock-statement-body-position]: https://eslint.org/docs/rules/nonblock-statement-body-position
217
252
  [one-var-declaration-per-line]: https://eslint.org/docs/rules/one-var-declaration-per-line
253
+ [prefer-arrow-callback]: https://eslint.org/docs/rules/prefer-arrow-callback
218
254
  [prettier]: https://github.com/prettier
219
- [quotes]: https://eslint.org/docs/rules/quotes
220
255
  [quotes-special]: https://github.com/prettier/eslint-config-prettier/blob/8d264cd0a7f06c12e2e05415e0282a4f8f21ebc9/README.md#quotes
256
+ [quotes]: https://eslint.org/docs/rules/quotes
221
257
  [react/jsx-child-element-spacing]: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-child-element-spacing.md
222
258
  [react/jsx-closing-tag-location]: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-tag-location.md
223
259
  [react/jsx-one-expression-per-line]: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-one-expression-per-line.md
224
260
  [react/jsx-props-no-multi-spaces]: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-multi-spaces.md
261
+ [self-closing-comp]: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
225
262
  [semi-style]: https://eslint.org/docs/rules/semi-style
226
263
  [switch-colon-spacing]: https://eslint.org/docs/rules/switch-colon-spacing
227
264
  [template-tag-spacing]: https://eslint.org/docs/rules/template-tag-spacing
228
- [vue/html-self-closing]: https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/html-self-closing.md
229
265
  [vue/html-self-closing-special]: https://github.com/prettier/eslint-config-prettier/blob/d5e7af986221df5faedc12893d8dc3150a808693/README.md#vuehtml-self-closing
266
+ [vue/html-self-closing]: https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/html-self-closing.md
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2017 Simon Lydell
3
+ Copyright (c) 2017, 2018, 2019 Simon Lydell and contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -5,6 +5,9 @@ Turns off all rules that are unnecessary or might conflict with [Prettier].
5
5
  This lets you use you favorite shareable config without letting its stylistic
6
6
  choices get in the way when using Prettier.
7
7
 
8
+ Note that this config _only_ turns rules _off,_ so it only makes sense using
9
+ it together with some other config.
10
+
8
11
  ## Contents
9
12
 
10
13
  <!-- START doctoc generated TOC please keep comment here to allow auto update -->
@@ -15,6 +18,7 @@ choices get in the way when using Prettier.
15
18
  - [CLI helper tool](#cli-helper-tool)
16
19
  - [Example configuration](#example-configuration)
17
20
  - [Special rules](#special-rules)
21
+ - [arrow-body-style and prefer-arrow-callback](#arrow-body-style-and-prefer-arrow-callback)
18
22
  - [curly](#curly)
19
23
  - [lines-around-comment](#lines-around-comment)
20
24
  - [max-len](#max-len)
@@ -43,7 +47,7 @@ Follow the instructions over there. This is optional, though.
43
47
  Install eslint-config-prettier:
44
48
 
45
49
  ```
46
- $ npm install --save-dev eslint-config-prettier
50
+ npm install --save-dev eslint-config-prettier
47
51
  ```
48
52
 
49
53
  Then, add eslint-config-prettier to the "extends" array in your `.eslintrc.*`
@@ -53,6 +57,7 @@ configs.
53
57
  ```json
54
58
  {
55
59
  "extends": [
60
+ "some-other-config-you-use",
56
61
  "prettier"
57
62
  ]
58
63
  }
@@ -60,10 +65,11 @@ configs.
60
65
 
61
66
  A few ESLint plugins are supported as well:
62
67
 
68
+ - [@typescript-eslint/eslint-plugin]
69
+ - [eslint-plugin-babel]
63
70
  - [eslint-plugin-flowtype]
64
71
  - [eslint-plugin-react]
65
72
  - [eslint-plugin-standard]
66
- - [eslint-plugin-typescript]
67
73
  - [eslint-plugin-unicorn]
68
74
  - [eslint-plugin-vue]
69
75
 
@@ -72,17 +78,36 @@ Add extra exclusions for the plugins you use like so:
72
78
  ```json
73
79
  {
74
80
  "extends": [
81
+ "some-other-config-you-use",
75
82
  "prettier",
83
+ "prettier/@typescript-eslint",
84
+ "prettier/babel",
76
85
  "prettier/flowtype",
77
86
  "prettier/react",
78
87
  "prettier/standard",
79
- "prettier/typescript",
80
88
  "prettier/unicorn",
81
89
  "prettier/vue"
82
90
  ]
83
91
  }
84
92
  ```
85
93
 
94
+ If you extend a config which uses a plugin, it is recommended to add
95
+ `"prettier/that-plugin"` (if available). For example, [eslint-config-airbnb]
96
+ enables [eslint-plugin-react] rules, so `"prettier/react"` is needed:
97
+
98
+ ```json
99
+ {
100
+ "extends": [
101
+ "airbnb",
102
+ "prettier",
103
+ "prettier/react"
104
+ ]
105
+ }
106
+ ```
107
+
108
+ If you’re unsure which plugins are used, you can usually find them in your
109
+ `package.json`.
110
+
86
111
  ## CLI helper tool
87
112
 
88
113
  eslint-config-prettier also ships with a little CLI tool to help you check if
@@ -121,25 +146,27 @@ Exit codes:
121
146
  {
122
147
  "extends": [
123
148
  "standard",
149
+ "plugin:@typescript-eslint/recommended",
124
150
  "plugin:flowtype/recommended",
125
151
  "plugin:react/recommended",
126
- "plugin:typescript/recommended",
127
152
  "plugin:unicorn/recommended",
128
153
  "plugin:vue/recommended",
129
154
  "prettier",
155
+ "prettier/@typescript-eslint",
156
+ "prettier/babel",
130
157
  "prettier/flowtype",
131
158
  "prettier/react",
132
159
  "prettier/standard",
133
- "prettier/typescript",
134
160
  "prettier/unicorn",
135
161
  "prettier/vue"
136
162
  ],
137
163
  "plugins": [
164
+ "@typescript-eslint",
165
+ "babel",
138
166
  "flowtype",
139
- "react",
140
167
  "prettier",
168
+ "react",
141
169
  "standard",
142
- "typescript",
143
170
  "unicorn",
144
171
  "vue"
145
172
  ],
@@ -168,10 +195,44 @@ enabled in some cases.
168
195
  - Some require special attention when writing code. The CLI helper tool warns
169
196
  you if any of those rules are enabled, but can’t tell if anything is
170
197
  problematic.
198
+ - Some can cause problems if using [eslint-plugin-prettier] and `--fix`.
171
199
 
172
200
  For maximum ease of use, the special rules are disabled by default. If you want
173
201
  them, you need to explicitly specify them in your ESLint config.
174
202
 
203
+ ### [arrow-body-style] and [prefer-arrow-callback]
204
+
205
+ **These rules might cause problems if using [eslint-plugin-prettier] and `--fix`.**
206
+
207
+ If you use any of these rules together with the `prettier/prettier` rule from
208
+ [eslint-plugin-prettier], you can in some cases end up with invalid code due to
209
+ a bug in ESLint’s autofix.
210
+
211
+ These rules are safe to use if:
212
+
213
+ - You don’t use [eslint-plugin-prettier]. In other words, you run `eslint --fix`
214
+ and `prettier --write` as separate steps.
215
+ - You _do_ use [eslint-plugin-prettier], but don’t use `--fix`. (But then,
216
+ what’s the point?)
217
+
218
+ You _can_ still use these rules together with [eslint-plugin-prettier] if you
219
+ want, because the bug does not occur _all the time._ But if you do, you need to
220
+ keep in mind that you might end up with invalid code, where you manually have to
221
+ insert a missing closing parenthesis to get going again.
222
+
223
+ If you’re fixing large of amounts of previously unformatted code, consider
224
+ temporarily disabling the `prettier/prettier` rule and running `eslint --fix`
225
+ and `prettier --write` separately.
226
+
227
+ See these issues for more information:
228
+
229
+ - [eslint-config-prettier#31]
230
+ - [eslint-config-prettier#71]
231
+ - [eslint-plugin-prettier#65]
232
+
233
+ When the autofix bug in ESLint has been fixed, the special case for these rules
234
+ can be removed.
235
+
175
236
  ### [curly]
176
237
 
177
238
  **This rule requires certain options.**
@@ -498,6 +559,8 @@ Example configuration:
498
559
 
499
560
  ### [quotes]
500
561
 
562
+ (The following applies to [babel/quotes] as well.)
563
+
501
564
  **This rule requires certain options and certain Prettier options.**
502
565
 
503
566
  Usually, you don’t need this rule at all. But there are two cases where it could
@@ -701,15 +764,16 @@ You can also supply a custom message if you want:
701
764
 
702
765
  eslint-config-prettier has been tested with:
703
766
 
704
- - ESLint 5.12.0
767
+ - ESLint 5.16.0
705
768
  - eslint-config-prettier 2.10.0 and older were tested with ESLint 4.x
706
769
  - eslint-config-prettier 2.1.1 and older were tested with ESLint 3.x
707
- - prettier 1.15.3
708
- - eslint-plugin-flowtype 3.2.1
709
- - eslint-plugin-react 7.12.3
770
+ - prettier 1.17.0
771
+ - @typescript-eslint/eslint-plugin 1.7.0
772
+ - eslint-plugin-babel 5.3.0
773
+ - eslint-plugin-flowtype 3.6.1
774
+ - eslint-plugin-react 7.12.4
710
775
  - eslint-plugin-standard 4.0.0
711
- - eslint-plugin-typescript 1.0.0-rc.1
712
- - eslint-plugin-unicorn 7.0.0
776
+ - eslint-plugin-unicorn 8.0.2
713
777
  - eslint-plugin-vue 5.1.0
714
778
 
715
779
  Have new rules been added since those versions? Have we missed any rules? Is
@@ -738,7 +802,7 @@ Then, create `test-lint/foobar.js`:
738
802
  "use strict";
739
803
 
740
804
  // Prettier does not want spaces before the parentheses, but
741
- // some-foobar-config wants one.
805
+ // `plugin:foobar/recommended` wants one.
742
806
  console.log();
743
807
  ```
744
808
 
@@ -776,14 +840,21 @@ several other npm scripts:
776
840
 
777
841
  [MIT](LICENSE).
778
842
 
843
+ [@typescript-eslint/eslint-plugin]: https://github.com/typescript-eslint/typescript-eslint
779
844
  [ESlint 5.7.0]: https://eslint.org/blog/2018/10/eslint-v5.7.0-released
780
845
  [Prettier]: https://github.com/prettier/prettier
846
+ [arrow-body-style]: https://eslint.org/docs/rules/arrow-body-style
847
+ [babel/quotes]: https://github.com/babel/eslint-plugin-babel#rules
781
848
  [curly]: https://eslint.org/docs/rules/curly
849
+ [eslint-config-airbnb]: https://www.npmjs.com/package/eslint-config-airbnb
850
+ [eslint-config-prettier#31]: https://github.com/prettier/eslint-config-prettier/issues/31
851
+ [eslint-config-prettier#71]: https://github.com/prettier/eslint-config-prettier/issues/71
852
+ [eslint-plugin-babel]: https://github.com/babel/eslint-plugin-babel
782
853
  [eslint-plugin-flowtype]: https://github.com/gajus/eslint-plugin-flowtype
854
+ [eslint-plugin-prettier#65]: https://github.com/prettier/eslint-plugin-prettier/issues/65
783
855
  [eslint-plugin-prettier]: https://github.com/prettier/eslint-plugin-prettier
784
856
  [eslint-plugin-react]: https://github.com/yannickcr/eslint-plugin-react
785
857
  [eslint-plugin-standard]: https://github.com/xjamundx/eslint-plugin-standard
786
- [eslint-plugin-typescript]: https://github.com/bradzacher/eslint-plugin-typescript
787
858
  [eslint-plugin-unicorn]: https://github.com/sindresorhus/eslint-plugin-unicorn
788
859
  [eslint-plugin-vue]: https://github.com/vuejs/eslint-plugin-vue
789
860
  [lines-around-comment]: https://eslint.org/docs/rules/lines-around-comment
@@ -797,6 +868,7 @@ several other npm scripts:
797
868
  [no-tabs]: https://eslint.org/docs/rules/no-tabs
798
869
  [no-unexpected-multiline]: https://eslint.org/docs/rules/no-unexpected-multiline
799
870
  [overrides]: https://eslint.org/docs/user-guide/configuring#configuration-based-on-glob-patterns
871
+ [prefer-arrow-callback]: https://eslint.org/docs/rules/prefer-arrow-callback
800
872
  [quotes]: https://eslint.org/docs/rules/quotes
801
873
  [singleQuote]: https://prettier.io/docs/en/options.html#quotes
802
874
  [string formatting rules]: https://prettier.io/docs/en/rationale.html#strings
package/babel.js ADDED
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ module.exports = {
4
+ rules: {
5
+ "babel/quotes": 0,
6
+
7
+ "babel/object-curly-spacing": "off",
8
+ "babel/semi": "off"
9
+ }
10
+ };
package/index.js CHANGED
@@ -5,6 +5,7 @@ module.exports = {
5
5
  // The following rules can be used in some cases. See the README for more
6
6
  // information. (These are marked with `0` instead of `"off"` so that a
7
7
  // script can distinguish them.)
8
+ "arrow-body-style": 0,
8
9
  curly: 0,
9
10
  "lines-around-comment": 0,
10
11
  "max-len": 0,
@@ -12,6 +13,7 @@ module.exports = {
12
13
  "no-mixed-operators": 0,
13
14
  "no-tabs": 0,
14
15
  "no-unexpected-multiline": 0,
16
+ "prefer-arrow-callback": 0,
15
17
  quotes: 0,
16
18
  // The rest are rules that you never need to enable when using Prettier.
17
19
  "array-bracket-newline": "off",
@@ -37,6 +39,7 @@ module.exports = {
37
39
  "jsx-quotes": "off",
38
40
  "key-spacing": "off",
39
41
  "keyword-spacing": "off",
42
+ "linebreak-style": "off",
40
43
  "multiline-ternary": "off",
41
44
  "newline-per-chained-call": "off",
42
45
  "new-parens": "off",
package/package.json CHANGED
@@ -1,17 +1,18 @@
1
1
  {
2
2
  "name": "eslint-config-prettier",
3
- "version": "3.5.0",
3
+ "version": "4.2.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.",
7
7
  "repository": "prettier/eslint-config-prettier",
8
8
  "files": [
9
9
  "bin/",
10
+ "@typescript-eslint.js",
11
+ "babel.js",
10
12
  "flowtype.js",
11
13
  "index.js",
12
14
  "react.js",
13
15
  "standard.js",
14
- "typescript.js",
15
16
  "unicorn.js",
16
17
  "vue.js"
17
18
  ],
@@ -24,7 +25,7 @@
24
25
  "prettier"
25
26
  ],
26
27
  "scripts": {
27
- "doctoc": "doctoc README.md && replace \"\\[(\\[[\\w/-]+\\])\\]\" \"\\$1\" README.md",
28
+ "doctoc": "doctoc README.md && replace \"\\[\\[([\\w/-]+)\\](?:([^\\[\\]]+)\\[([\\w/-]+)\\])?\\]\" \"[\\$1\\$2\\$3]\" README.md",
28
29
  "test:lint": "eslint .",
29
30
  "test:lint-verify-fail": "eslint \"test-lint/*.{js,ts,vue}\" --config .eslintrc.base.js --format json",
30
31
  "test:lint-rules": "eslint index.js --config test-config/.eslintrc.js --format json",
@@ -37,23 +38,25 @@
37
38
  "get-stdin": "^6.0.0"
38
39
  },
39
40
  "devDependencies": {
41
+ "@typescript-eslint/eslint-plugin": "1.7.0",
42
+ "@typescript-eslint/parser": "1.7.0",
40
43
  "babel-eslint": "10.0.1",
41
44
  "cross-spawn": "6.0.5",
42
45
  "doctoc": "1.4.0",
43
- "eslint": "5.12.0",
44
- "eslint-config-google": "0.11.0",
45
- "eslint-plugin-flowtype": "3.2.1",
46
+ "eslint": "5.16.0",
47
+ "eslint-config-google": "0.12.0",
48
+ "eslint-plugin-babel": "5.3.0",
49
+ "eslint-plugin-flowtype": "3.6.1",
46
50
  "eslint-plugin-prettier": "3.0.1",
47
- "eslint-plugin-react": "7.12.3",
51
+ "eslint-plugin-react": "7.12.4",
48
52
  "eslint-plugin-standard": "4.0.0",
49
- "eslint-plugin-typescript": "1.0.0-rc.1",
50
- "eslint-plugin-unicorn": "7.0.0",
53
+ "eslint-plugin-unicorn": "8.0.2",
51
54
  "eslint-plugin-vue": "github:vuejs/eslint-plugin-vue#9c49dcc8ff792ec6798037bd6b7f4ac3d26fdf68",
52
- "jest": "23.6.0",
53
- "prettier": "1.15.3",
54
- "replace": "1.0.1",
55
+ "jest": "24.7.1",
56
+ "prettier": "1.17.0",
57
+ "replace": "1.1.0",
55
58
  "rimraf": "2.6.3",
56
- "typescript": "^3.2.2"
59
+ "typescript": "3.4.5"
57
60
  },
58
61
  "peerDependencies": {
59
62
  "eslint": ">=3.14.1"
package/react.js CHANGED
@@ -15,6 +15,7 @@ module.exports = {
15
15
  "react/jsx-props-no-multi-spaces": "off",
16
16
  "react/jsx-space-before-closing": "off",
17
17
  "react/jsx-tag-spacing": "off",
18
- "react/jsx-wrap-multilines": "off"
18
+ "react/jsx-wrap-multilines": "off",
19
+ "react/self-closing-comp": "off"
19
20
  }
20
21
  };
package/typescript.js DELETED
@@ -1,9 +0,0 @@
1
- "use strict";
2
-
3
- module.exports = {
4
- rules: {
5
- "typescript/indent": "off",
6
- "typescript/member-delimiter-style": "off",
7
- "typescript/type-annotation-spacing": "off"
8
- }
9
- };