eslint-config-prettier 3.2.0 → 3.6.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 +31 -0
- package/LICENSE +1 -1
- package/README.md +87 -9
- package/babel.js +10 -0
- package/bin/validators.js +16 -0
- package/package.json +18 -13
- package/typescript.js +9 -0
- package/vue.js +8 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
### Version 3.6.0 (2019-01-19)
|
|
2
|
+
|
|
3
|
+
- Added: Support for [eslint-plugin-babel]. Thanks to Matija Marohnić
|
|
4
|
+
(@silvenon)!
|
|
5
|
+
|
|
6
|
+
### Version 3.5.0 (2019-01-16)
|
|
7
|
+
|
|
8
|
+
- Fixed: The eslint-plugin-vue change from 3.4.0 has been reverted. That change
|
|
9
|
+
requires eslint-plugin-vue@5, while many use eslint-plugin-vue@4. In other
|
|
10
|
+
words, it was an accidental breaking change. Also, after thinking about it
|
|
11
|
+
some more, it makes sense to have a Prettier-specific list of rules, rather
|
|
12
|
+
than using the `vue/no-layout-rules` list, since there can be layout rules
|
|
13
|
+
that don’t conflict with but rather complement Prettier.
|
|
14
|
+
- Added: New eslint-plugin-vue rules coming in the next version after 5.1.0.
|
|
15
|
+
|
|
16
|
+
### Version 3.4.0 (2019-01-13)
|
|
17
|
+
|
|
18
|
+
- Added: Support for [eslint-plugin-typescript]. Thanks to Jed Fox (@j-f1)!
|
|
19
|
+
- Improved: The eslint-plugin-vue integration is now using the
|
|
20
|
+
`vue/no-layout-rules` config behind the scenes, so it should automatically
|
|
21
|
+
stay up-to-date when new eslint-plugin-vue versions are released. Thanks to
|
|
22
|
+
Michał Sajnóg (@michalsnik)!
|
|
23
|
+
|
|
24
|
+
### Version 3.3.0 (2018-11-11)
|
|
25
|
+
|
|
26
|
+
- Added: The [vue/html-self-closing] rule (as a [special
|
|
27
|
+
rule][vue/html-self-closing-special]). Thanks to Yamagishi Kazutoshi (@ykzts)!
|
|
28
|
+
|
|
1
29
|
### Version 3.2.0 (2018-11-10)
|
|
2
30
|
|
|
3
31
|
- Added: Support for [eslint-plugin-vue].
|
|
@@ -174,6 +202,7 @@
|
|
|
174
202
|
[eslint-plugin-flowtype]: https://github.com/gajus/eslint-plugin-flowtype
|
|
175
203
|
[eslint-plugin-react]: https://github.com/yannickcr/eslint-plugin-react
|
|
176
204
|
[eslint-plugin-standard]: https://github.com/xjamundx/eslint-plugin-standard
|
|
205
|
+
[eslint-plugin-typescript]: https://github.com/bradzacher/eslint-plugin-typescript
|
|
177
206
|
[eslint-plugin-unicorn]: https://github.com/sindresorhus/eslint-plugin-unicorn
|
|
178
207
|
[eslint-plugin-vue]: https://github.com/vuejs/eslint-plugin-vue
|
|
179
208
|
[flowtype/boolean-style]: https://github.com/gajus/eslint-plugin-flowtype#eslint-plugin-flowtype-rules-boolean-style
|
|
@@ -201,3 +230,5 @@
|
|
|
201
230
|
[semi-style]: https://eslint.org/docs/rules/semi-style
|
|
202
231
|
[switch-colon-spacing]: https://eslint.org/docs/rules/switch-colon-spacing
|
|
203
232
|
[template-tag-spacing]: https://eslint.org/docs/rules/template-tag-spacing
|
|
233
|
+
[vue/html-self-closing]: https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/html-self-closing.md
|
|
234
|
+
[vue/html-self-closing-special]: https://github.com/prettier/eslint-config-prettier/blob/d5e7af986221df5faedc12893d8dc3150a808693/README.md#vuehtml-self-closing
|
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 -->
|
|
@@ -27,6 +30,7 @@ choices get in the way when using Prettier.
|
|
|
27
30
|
- [Forbid unnecessary backticks](#forbid-unnecessary-backticks)
|
|
28
31
|
- [Example _double_ quote configuration](#example-_double_-quote-configuration)
|
|
29
32
|
- [Example _single_ quote configuration](#example-_single_-quote-configuration)
|
|
33
|
+
- [vue/html-self-closing](#vuehtml-self-closing)
|
|
30
34
|
- [Other rules worth mentioning](#other-rules-worth-mentioning)
|
|
31
35
|
- [no-sequences](#no-sequences)
|
|
32
36
|
- [Contributing](#contributing)
|
|
@@ -42,7 +46,7 @@ Follow the instructions over there. This is optional, though.
|
|
|
42
46
|
Install eslint-config-prettier:
|
|
43
47
|
|
|
44
48
|
```
|
|
45
|
-
|
|
49
|
+
npm install --save-dev eslint-config-prettier
|
|
46
50
|
```
|
|
47
51
|
|
|
48
52
|
Then, add eslint-config-prettier to the "extends" array in your `.eslintrc.*`
|
|
@@ -52,6 +56,7 @@ configs.
|
|
|
52
56
|
```json
|
|
53
57
|
{
|
|
54
58
|
"extends": [
|
|
59
|
+
"some-other-config-you-use",
|
|
55
60
|
"prettier"
|
|
56
61
|
]
|
|
57
62
|
}
|
|
@@ -59,9 +64,11 @@ configs.
|
|
|
59
64
|
|
|
60
65
|
A few ESLint plugins are supported as well:
|
|
61
66
|
|
|
67
|
+
- [eslint-plugin-babel]
|
|
62
68
|
- [eslint-plugin-flowtype]
|
|
63
69
|
- [eslint-plugin-react]
|
|
64
70
|
- [eslint-plugin-standard]
|
|
71
|
+
- [eslint-plugin-typescript]
|
|
65
72
|
- [eslint-plugin-unicorn]
|
|
66
73
|
- [eslint-plugin-vue]
|
|
67
74
|
|
|
@@ -70,10 +77,13 @@ Add extra exclusions for the plugins you use like so:
|
|
|
70
77
|
```json
|
|
71
78
|
{
|
|
72
79
|
"extends": [
|
|
80
|
+
"some-other-config-you-use",
|
|
73
81
|
"prettier",
|
|
82
|
+
"prettier/babel",
|
|
74
83
|
"prettier/flowtype",
|
|
75
84
|
"prettier/react",
|
|
76
85
|
"prettier/standard",
|
|
86
|
+
"prettier/typescript",
|
|
77
87
|
"prettier/unicorn",
|
|
78
88
|
"prettier/vue"
|
|
79
89
|
]
|
|
@@ -120,19 +130,25 @@ Exit codes:
|
|
|
120
130
|
"standard",
|
|
121
131
|
"plugin:flowtype/recommended",
|
|
122
132
|
"plugin:react/recommended",
|
|
133
|
+
"plugin:typescript/recommended",
|
|
123
134
|
"plugin:unicorn/recommended",
|
|
124
135
|
"plugin:vue/recommended",
|
|
125
136
|
"prettier",
|
|
137
|
+
"prettier/babel",
|
|
126
138
|
"prettier/flowtype",
|
|
127
139
|
"prettier/react",
|
|
128
140
|
"prettier/standard",
|
|
129
|
-
"prettier/
|
|
141
|
+
"prettier/typescript",
|
|
142
|
+
"prettier/unicorn",
|
|
143
|
+
"prettier/vue"
|
|
130
144
|
],
|
|
131
145
|
"plugins": [
|
|
146
|
+
"babel",
|
|
132
147
|
"flowtype",
|
|
133
148
|
"react",
|
|
134
149
|
"prettier",
|
|
135
150
|
"standard",
|
|
151
|
+
"typescript",
|
|
136
152
|
"unicorn",
|
|
137
153
|
"vue"
|
|
138
154
|
],
|
|
@@ -407,6 +423,19 @@ required):
|
|
|
407
423
|
}
|
|
408
424
|
```
|
|
409
425
|
|
|
426
|
+
**Note:** Since [ESlint 5.7.0] this rule can be configured to work regardless of
|
|
427
|
+
your Prettier configuration:
|
|
428
|
+
|
|
429
|
+
```json
|
|
430
|
+
{
|
|
431
|
+
"rules": {
|
|
432
|
+
"no-tabs": ["error", {"allowIndentationTabs": true}]
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
A future version of eslint-config-prettier might check for that automatically.
|
|
438
|
+
|
|
410
439
|
### [no-unexpected-multiline]
|
|
411
440
|
|
|
412
441
|
**This rule requires special attention when writing code.**
|
|
@@ -478,6 +507,8 @@ Example configuration:
|
|
|
478
507
|
|
|
479
508
|
### [quotes]
|
|
480
509
|
|
|
510
|
+
(The following applies to [babel/quotes] as well.)
|
|
511
|
+
|
|
481
512
|
**This rule requires certain options and certain Prettier options.**
|
|
482
513
|
|
|
483
514
|
Usually, you don’t need this rule at all. But there are two cases where it could
|
|
@@ -577,6 +608,46 @@ Prettier:
|
|
|
577
608
|
}
|
|
578
609
|
```
|
|
579
610
|
|
|
611
|
+
### [vue/html-self-closing]
|
|
612
|
+
|
|
613
|
+
**This rule requires certain options.**
|
|
614
|
+
|
|
615
|
+
This rule enforces whether elements should be self-closing or not.
|
|
616
|
+
|
|
617
|
+
Prettier generally preserves the way you wrote your elements:
|
|
618
|
+
|
|
619
|
+
```vue
|
|
620
|
+
<div />
|
|
621
|
+
<div></div>
|
|
622
|
+
<MyComponent />
|
|
623
|
+
<MyComponent></MyComponent>
|
|
624
|
+
<svg><path d="" /></svg>
|
|
625
|
+
<svg><path d=""></path></svg>
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
But for known _void_ HTML elements, Prettier always uses the self-closing style.
|
|
629
|
+
For example, `<img>` is turned into `<img />`.
|
|
630
|
+
|
|
631
|
+
If you like this rule, it can be used just fine with Prettier as long as you
|
|
632
|
+
set `html.void` to `"any"`.
|
|
633
|
+
|
|
634
|
+
Example ESLint configuration:
|
|
635
|
+
|
|
636
|
+
```json
|
|
637
|
+
{
|
|
638
|
+
"rules": {
|
|
639
|
+
"vue/html-self-closing": [
|
|
640
|
+
"error",
|
|
641
|
+
{
|
|
642
|
+
"html": {
|
|
643
|
+
"void": "any"
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
]
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
```
|
|
650
|
+
|
|
580
651
|
## Other rules worth mentioning
|
|
581
652
|
|
|
582
653
|
These rules don’t conflict with Prettier, but have some gotchas when used with
|
|
@@ -641,15 +712,17 @@ You can also supply a custom message if you want:
|
|
|
641
712
|
|
|
642
713
|
eslint-config-prettier has been tested with:
|
|
643
714
|
|
|
644
|
-
- ESLint 5.
|
|
715
|
+
- ESLint 5.12.0
|
|
645
716
|
- eslint-config-prettier 2.10.0 and older were tested with ESLint 4.x
|
|
646
717
|
- eslint-config-prettier 2.1.1 and older were tested with ESLint 3.x
|
|
647
|
-
- prettier 1.15.
|
|
648
|
-
- eslint-plugin-
|
|
649
|
-
- eslint-plugin-
|
|
718
|
+
- prettier 1.15.3
|
|
719
|
+
- eslint-plugin-babel 5.3.0
|
|
720
|
+
- eslint-plugin-flowtype 3.2.1
|
|
721
|
+
- eslint-plugin-react 7.12.4
|
|
650
722
|
- eslint-plugin-standard 4.0.0
|
|
651
|
-
- eslint-plugin-
|
|
652
|
-
- eslint-plugin-
|
|
723
|
+
- eslint-plugin-typescript 1.0.0-rc.1
|
|
724
|
+
- eslint-plugin-unicorn 7.0.0
|
|
725
|
+
- eslint-plugin-vue 5.1.0
|
|
653
726
|
|
|
654
727
|
Have new rules been added since those versions? Have we missed any rules? Is
|
|
655
728
|
there a plugin you would like to see exclusions for? Open an issue or a pull
|
|
@@ -677,7 +750,7 @@ Then, create `test-lint/foobar.js`:
|
|
|
677
750
|
"use strict";
|
|
678
751
|
|
|
679
752
|
// Prettier does not want spaces before the parentheses, but
|
|
680
|
-
//
|
|
753
|
+
// `plugin:foobar/recommended` wants one.
|
|
681
754
|
console.log();
|
|
682
755
|
```
|
|
683
756
|
|
|
@@ -715,12 +788,16 @@ several other npm scripts:
|
|
|
715
788
|
|
|
716
789
|
[MIT](LICENSE).
|
|
717
790
|
|
|
791
|
+
[ESlint 5.7.0]: https://eslint.org/blog/2018/10/eslint-v5.7.0-released
|
|
718
792
|
[Prettier]: https://github.com/prettier/prettier
|
|
793
|
+
[babel/quotes]: https://github.com/babel/eslint-plugin-babel#rules
|
|
719
794
|
[curly]: https://eslint.org/docs/rules/curly
|
|
795
|
+
[eslint-plugin-babel]: https://github.com/babel/eslint-plugin-babel
|
|
720
796
|
[eslint-plugin-flowtype]: https://github.com/gajus/eslint-plugin-flowtype
|
|
721
797
|
[eslint-plugin-prettier]: https://github.com/prettier/eslint-plugin-prettier
|
|
722
798
|
[eslint-plugin-react]: https://github.com/yannickcr/eslint-plugin-react
|
|
723
799
|
[eslint-plugin-standard]: https://github.com/xjamundx/eslint-plugin-standard
|
|
800
|
+
[eslint-plugin-typescript]: https://github.com/bradzacher/eslint-plugin-typescript
|
|
724
801
|
[eslint-plugin-unicorn]: https://github.com/sindresorhus/eslint-plugin-unicorn
|
|
725
802
|
[eslint-plugin-vue]: https://github.com/vuejs/eslint-plugin-vue
|
|
726
803
|
[lines-around-comment]: https://eslint.org/docs/rules/lines-around-comment
|
|
@@ -739,3 +816,4 @@ several other npm scripts:
|
|
|
739
816
|
[string formatting rules]: https://prettier.io/docs/en/rationale.html#strings
|
|
740
817
|
[travis-badge]: https://travis-ci.org/prettier/eslint-config-prettier.svg?branch=master
|
|
741
818
|
[travis]: https://travis-ci.org/prettier/eslint-config-prettier
|
|
819
|
+
[vue/html-self-closing]: https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/html-self-closing.md
|
package/babel.js
ADDED
package/bin/validators.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
// These validator functions answer the question “Is the config valid?” – return
|
|
4
|
+
// `false` if the options DO conflict with Prettier, and `true` if they don’t.
|
|
5
|
+
|
|
3
6
|
module.exports = {
|
|
4
7
|
curly(options) {
|
|
5
8
|
if (options.length === 0) {
|
|
@@ -34,5 +37,18 @@ module.exports = {
|
|
|
34
37
|
|
|
35
38
|
const firstOption = options[0];
|
|
36
39
|
return !(firstOption && firstOption.allowParens);
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
"vue/html-self-closing"(options) {
|
|
43
|
+
if (options.length === 0) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const firstOption = options[0];
|
|
48
|
+
return Boolean(
|
|
49
|
+
firstOption && (firstOption.html && firstOption.html.void === "any")
|
|
50
|
+
// Enable when Prettier supports SVG: https://github.com/prettier/prettier/issues/5322
|
|
51
|
+
// && firstOption.svg === "any"
|
|
52
|
+
);
|
|
37
53
|
}
|
|
38
54
|
};
|
package/package.json
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-prettier",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.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
|
+
"babel.js",
|
|
10
11
|
"flowtype.js",
|
|
11
12
|
"index.js",
|
|
12
13
|
"react.js",
|
|
13
14
|
"standard.js",
|
|
15
|
+
"typescript.js",
|
|
14
16
|
"unicorn.js",
|
|
15
17
|
"vue.js"
|
|
16
18
|
],
|
|
@@ -23,9 +25,9 @@
|
|
|
23
25
|
"prettier"
|
|
24
26
|
],
|
|
25
27
|
"scripts": {
|
|
26
|
-
"doctoc": "doctoc README.md && replace \"\\[(\\[[\\w
|
|
28
|
+
"doctoc": "doctoc README.md && replace \"\\[(\\[[\\w/-]+\\])\\]\" \"\\$1\" README.md",
|
|
27
29
|
"test:lint": "eslint .",
|
|
28
|
-
"test:lint-verify-fail": "eslint \"test-lint/*.{js,vue}\" --config .eslintrc.base.js --format json",
|
|
30
|
+
"test:lint-verify-fail": "eslint \"test-lint/*.{js,ts,vue}\" --config .eslintrc.base.js --format json",
|
|
29
31
|
"test:lint-rules": "eslint index.js --config test-config/.eslintrc.js --format json",
|
|
30
32
|
"test:jest": "jest",
|
|
31
33
|
"test:cli-sanity": "eslint --print-config . | node ./bin/cli.js",
|
|
@@ -38,19 +40,22 @@
|
|
|
38
40
|
"devDependencies": {
|
|
39
41
|
"babel-eslint": "10.0.1",
|
|
40
42
|
"cross-spawn": "6.0.5",
|
|
41
|
-
"doctoc": "1.
|
|
42
|
-
"eslint": "5.
|
|
43
|
+
"doctoc": "1.4.0",
|
|
44
|
+
"eslint": "5.12.0",
|
|
43
45
|
"eslint-config-google": "0.11.0",
|
|
44
|
-
"eslint-plugin-
|
|
45
|
-
"eslint-plugin-
|
|
46
|
-
"eslint-plugin-
|
|
46
|
+
"eslint-plugin-babel": "5.3.0",
|
|
47
|
+
"eslint-plugin-flowtype": "3.2.1",
|
|
48
|
+
"eslint-plugin-prettier": "3.0.1",
|
|
49
|
+
"eslint-plugin-react": "7.12.4",
|
|
47
50
|
"eslint-plugin-standard": "4.0.0",
|
|
48
|
-
"eslint-plugin-
|
|
49
|
-
"eslint-plugin-
|
|
51
|
+
"eslint-plugin-typescript": "1.0.0-rc.1",
|
|
52
|
+
"eslint-plugin-unicorn": "7.0.0",
|
|
53
|
+
"eslint-plugin-vue": "github:vuejs/eslint-plugin-vue#9c49dcc8ff792ec6798037bd6b7f4ac3d26fdf68",
|
|
50
54
|
"jest": "23.6.0",
|
|
51
|
-
"prettier": "1.15.
|
|
52
|
-
"replace": "1.0.
|
|
53
|
-
"rimraf": "2.6.
|
|
55
|
+
"prettier": "1.15.3",
|
|
56
|
+
"replace": "1.0.1",
|
|
57
|
+
"rimraf": "2.6.3",
|
|
58
|
+
"typescript": "3.2.4"
|
|
54
59
|
},
|
|
55
60
|
"peerDependencies": {
|
|
56
61
|
"eslint": ">=3.14.1"
|
package/typescript.js
ADDED
package/vue.js
CHANGED
|
@@ -2,17 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
4
|
rules: {
|
|
5
|
+
"vue/html-self-closing": 0,
|
|
6
|
+
|
|
7
|
+
"vue/array-bracket-spacing": "off",
|
|
5
8
|
"vue/html-closing-bracket-newline": "off",
|
|
6
9
|
"vue/html-closing-bracket-spacing": "off",
|
|
7
10
|
"vue/html-end-tags": "off",
|
|
8
11
|
"vue/html-indent": "off",
|
|
9
12
|
"vue/html-quotes": "off",
|
|
13
|
+
"vue/key-spacing": "off",
|
|
10
14
|
"vue/max-attributes-per-line": "off",
|
|
11
15
|
"vue/multiline-html-element-content-newline": "off",
|
|
12
16
|
"vue/mustache-interpolation-spacing": "off",
|
|
13
17
|
"vue/no-multi-spaces": "off",
|
|
14
18
|
"vue/no-spaces-around-equal-signs-in-attribute": "off",
|
|
19
|
+
"vue/object-curly-spacing": "off",
|
|
15
20
|
"vue/script-indent": "off",
|
|
16
|
-
"vue/singleline-html-element-content-newline": "off"
|
|
21
|
+
"vue/singleline-html-element-content-newline": "off",
|
|
22
|
+
"vue/space-infix-ops": "off",
|
|
23
|
+
"vue/space-unary-ops": "off"
|
|
17
24
|
}
|
|
18
25
|
};
|