eslint-plugin-prettier 3.1.2 → 3.3.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 +41 -0
- package/README.md +42 -20
- package/eslint-plugin-prettier.js +4 -5
- package/package.json +9 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v3.3.0 (2020-12-13)
|
|
4
|
+
|
|
5
|
+
* Minor: Perf improvement: Do not clear the config cache on each run ([#368](git@github.com:prettier/eslint-plugin-prettier/issues/368)) ([1b90ea7](git@github.com:prettier/eslint-plugin-prettier/commit/1b90ea752636959babb27ebca5d67093c346dab9))
|
|
6
|
+
* Add peerDependenciesMeta block ([#367](git@github.com:prettier/eslint-plugin-prettier/issues/367)) ([86608d5](git@github.com:prettier/eslint-plugin-prettier/commit/86608d5084692ab0d1f2f49a3df4909d04c39ae7))
|
|
7
|
+
* build(deps-dev): bump eslint from 7.14.0 to 7.15.0 ([885f484](git@github.com:prettier/eslint-plugin-prettier/commit/885f48405e0fc9f312acdd3e3487c824bd59c102))
|
|
8
|
+
* build(deps-dev): bump eslint from 7.3.1 to 7.14.0 ([cebc80b](git@github.com:prettier/eslint-plugin-prettier/commit/cebc80b39d3d09f957a73536e54f6d8dd4567080))
|
|
9
|
+
|
|
10
|
+
## v3.2.0 (2020-12-03)
|
|
11
|
+
|
|
12
|
+
* Skip CI for eslint 6 + node 8 ([#364](git@github.com:prettier/eslint-plugin-prettier/issues/364)) ([f8f08e4](git@github.com:prettier/eslint-plugin-prettier/commit/f8f08e483522d74bc4dd93d9813914aa7ba9314b))
|
|
13
|
+
* Turn off problematic rules in recommended config (prepare for next eslint-config-prettier version) ([#360](git@github.com:prettier/eslint-plugin-prettier/issues/360)) ([a1e5591](git@github.com:prettier/eslint-plugin-prettier/commit/a1e559112073eedfb0dd2041b9c2f6ef775844ec))
|
|
14
|
+
* Create dependabot.yml ([f58b6c7](git@github.com:prettier/eslint-plugin-prettier/commit/f58b6c7c356a37b437593cd6ff8d1dca1c437b13))
|
|
15
|
+
* docs(README): fix prettier getFileInfo link ([#335](git@github.com:prettier/eslint-plugin-prettier/issues/335)) ([5a690f1](git@github.com:prettier/eslint-plugin-prettier/commit/5a690f14d793ba5a08c55287fa3d6338dcda21ba))
|
|
16
|
+
* build(deps-dev): bump eslint-plugin-eslint-plugin from 2.2.2 to 2.3.0 ([8614c45](git@github.com:prettier/eslint-plugin-prettier/commit/8614c458ed284bc126034d432b49b07d7d67ef06))
|
|
17
|
+
* build(deps-dev): bump eslint from 7.3.0 to 7.3.1 ([12d9ed8](git@github.com:prettier/eslint-plugin-prettier/commit/12d9ed877aacfad2c27f01161cc2eb28a445725f))
|
|
18
|
+
* build(deps-dev): bump eslint from 7.2.0 to 7.3.0 ([5a6f42e](git@github.com:prettier/eslint-plugin-prettier/commit/5a6f42e4eda871a294da1eb55f214c475450faa6))
|
|
19
|
+
* chore: update CI badge in readme ([5012b66](git@github.com:prettier/eslint-plugin-prettier/commit/5012b665f981edbc21feaaccb3cd297f49ca40d3))
|
|
20
|
+
* Use Github Actions for CI ([#305](git@github.com:prettier/eslint-plugin-prettier/issues/305)) ([41eb64f](git@github.com:prettier/eslint-plugin-prettier/commit/41eb64fda33663ed1c43a85218f390c6cd4b6191))
|
|
21
|
+
|
|
22
|
+
## v3.1.4 (2020-06-14)
|
|
23
|
+
|
|
24
|
+
* Avoid clearing Prettier cache when not using prettierrc ([#303](git@github.com:prettier/eslint-plugin-prettier/issues/303)) ([3c8e2d9](git@github.com:prettier/eslint-plugin-prettier/commit/3c8e2d9871d86a82b10fe3d54f32bb5a54f2913b))
|
|
25
|
+
* build(deps-dev): bump eslint-plugin-eslint-plugin from 2.2.1 to 2.2.2 ([93f7c8b](git@github.com:prettier/eslint-plugin-prettier/commit/93f7c8be7c99a0c3e4b11be6a5311316f76e6e08))
|
|
26
|
+
* build(deps-dev): bump eslint from 7.1.0 to 7.2.0 ([650ac7a](git@github.com:prettier/eslint-plugin-prettier/commit/650ac7a40c1f4d46b0bd37efad3eed84f8155a44))
|
|
27
|
+
* build(deps-dev): bump eslint-plugin-self from 1.2.0 to 1.2.1 ([6449ec1](git@github.com:prettier/eslint-plugin-prettier/commit/6449ec151f119e98d69da91ad6d10dbb374162d8))
|
|
28
|
+
* build(deps-dev): bump eslint from 7.0.0 to 7.1.0 ([fd30022](git@github.com:prettier/eslint-plugin-prettier/commit/fd30022a51a57a4e96dd4ab3e04956b945886874))
|
|
29
|
+
* Chore: Add CI tests for ESLint 7 ([#291](git@github.com:prettier/eslint-plugin-prettier/issues/291)) ([cc2979b](git@github.com:prettier/eslint-plugin-prettier/commit/cc2979b68258b8545931ce37168adfe17b1d3a7b))
|
|
30
|
+
* build(deps-dev): bump eslint-config-prettier from 6.10.1 to 6.11.0 ([35a7ee6](git@github.com:prettier/eslint-plugin-prettier/commit/35a7ee68b02ea3088270210ac8dc85ff47ef65a9))
|
|
31
|
+
|
|
32
|
+
## v3.1.3 (2020-04-13)
|
|
33
|
+
|
|
34
|
+
* Fix: Set `meta.type` to "layout" ([#283](git@github.com:prettier/eslint-plugin-prettier/issues/283)) ([97152e2](git@github.com:prettier/eslint-plugin-prettier/commit/97152e2787bf9bb27f053d6a91ccf826dc96a505))
|
|
35
|
+
* build(deps-dev): bump eslint-config-prettier from 6.10.0 to 6.10.1 ([185b106](git@github.com:prettier/eslint-plugin-prettier/commit/185b1064d3dd674538456fb2fad97fbfcde49e0d))
|
|
36
|
+
* build(deps): [security] bump acorn from 6.1.0 to 6.4.1 ([bba5881](git@github.com:prettier/eslint-plugin-prettier/commit/bba588151e860b1a644096441b31a0f3144db611))
|
|
37
|
+
* build(deps-dev): bump eslint-config-prettier from 6.9.0 to 6.10.0 ([9a47a6f](git@github.com:prettier/eslint-plugin-prettier/commit/9a47a6feab691cf228d184c103d4cab99b464d0b))
|
|
38
|
+
* build(deps-dev): bump eslint-plugin-eslint-plugin from 2.2.0 to 2.2.1 ([aad671d](git@github.com:prettier/eslint-plugin-prettier/commit/aad671d5123a2fd20e4396d591e25335d7219950))
|
|
39
|
+
* build(deps-dev): bump eslint-plugin-eslint-plugin from 2.1.0 to 2.2.0 ([e2458c2](git@github.com:prettier/eslint-plugin-prettier/commit/e2458c2d41825f94441dc7d552da37aede95ffe7))
|
|
40
|
+
* build(deps-dev): bump eslint-config-prettier from 6.8.0 to 6.9.0 ([05ef06f](git@github.com:prettier/eslint-plugin-prettier/commit/05ef06ffdda2bb485a2175243e6a8a167a01466c))
|
|
41
|
+
* build(deps-dev): bump eslint-config-prettier from 6.7.0 to 6.8.0 ([ab80b3c](git@github.com:prettier/eslint-plugin-prettier/commit/ab80b3c5d30ea605aa363f13078aef9e0b697b6e))
|
|
42
|
+
* build(deps-dev): bump eslint from 6.7.2 to 6.8.0 ([dea1b30](git@github.com:prettier/eslint-plugin-prettier/commit/dea1b30361921d7160aaf44d5302c5cc6490f87a))
|
|
43
|
+
|
|
3
44
|
## v3.1.2 (2019-12-15)
|
|
4
45
|
|
|
5
46
|
* Resolve config when getting list of inferred parsers ([1ad45be](git@github.com:prettier/eslint-plugin-prettier/commit/1ad45be48ea1ed16e0eb3ba6247163724b956516))
|
package/README.md
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
# eslint-plugin-prettier [](https://github.com/prettier/eslint-plugin-prettier/actions?query=workflow%3ACI+branch%3Amaster)
|
|
2
2
|
|
|
3
3
|
Runs [Prettier](https://github.com/prettier/prettier) as an [ESLint](http://eslint.org) rule and reports differences as individual ESLint issues.
|
|
4
4
|
|
|
5
|
+
If your desired formatting does not match Prettier’s output, you should use a different tool such as [prettier-eslint](https://github.com/prettier/prettier-eslint) instead.
|
|
6
|
+
|
|
5
7
|
## Sample
|
|
6
8
|
|
|
7
9
|
```js
|
|
@@ -52,11 +54,9 @@ Then, in your `.eslintrc.json`:
|
|
|
52
54
|
|
|
53
55
|
## Recommended Configuration
|
|
54
56
|
|
|
55
|
-
This plugin works best if you disable all other ESLint rules relating to code formatting, and only enable rules that detect
|
|
56
|
-
|
|
57
|
-
If your desired formatting does not match the `prettier` output, you should use a different tool such as [prettier-eslint](https://github.com/prettier/prettier-eslint) instead.
|
|
57
|
+
This plugin works best if you disable all other ESLint rules relating to code formatting, and only enable rules that detect potential bugs. (If another active ESLint rule disagrees with `prettier` about how code should be formatted, it will be impossible to avoid lint errors.) You can use [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) to disable all formatting-related ESLint rules.
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
This plugin ships with a `plugin:prettier/recommended` config that sets up both the plugin and `eslint-config-prettier` in one go.
|
|
60
60
|
|
|
61
61
|
1. In addition to the above installation instructions, install `eslint-config-prettier`:
|
|
62
62
|
|
|
@@ -64,7 +64,7 @@ To integrate this plugin with `eslint-config-prettier`, you can use the `"recomm
|
|
|
64
64
|
npm install --save-dev eslint-config-prettier
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
2. Then you need to add `plugin:prettier/recommended` as the
|
|
67
|
+
2. Then you need to add `plugin:prettier/recommended` as the _last_ extension in your `.eslintrc.json`:
|
|
68
68
|
|
|
69
69
|
```json
|
|
70
70
|
{
|
|
@@ -72,28 +72,50 @@ To integrate this plugin with `eslint-config-prettier`, you can use the `"recomm
|
|
|
72
72
|
}
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
You can then set Prettier's own options inside a `.prettierrc` file.
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
3. Some ESLint plugins (such as [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react)) also contain rules that conflict with Prettier. Add extra exclusions for the plugins you use like so:
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"extends": [
|
|
82
|
+
"plugin:prettier/recommended",
|
|
83
|
+
"prettier/flowtype",
|
|
84
|
+
"prettier/react"
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
```
|
|
80
88
|
|
|
81
|
-
|
|
89
|
+
For the list of every available exclusion rule set, please see the [readme of eslint-config-prettier](https://github.com/prettier/eslint-config-prettier/blob/master/README.md).
|
|
82
90
|
|
|
83
|
-
|
|
91
|
+
Exactly what does `plugin:prettier/recommended` do? Well, this is what it expands to:
|
|
84
92
|
|
|
85
93
|
```json
|
|
86
94
|
{
|
|
87
|
-
"extends": [
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
"prettier/
|
|
91
|
-
"
|
|
92
|
-
|
|
95
|
+
"extends": ["prettier"],
|
|
96
|
+
"plugins": ["prettier"],
|
|
97
|
+
"rules": {
|
|
98
|
+
"prettier/prettier": "error",
|
|
99
|
+
"arrow-body-style": "off",
|
|
100
|
+
"prefer-arrow-callback": "off"
|
|
101
|
+
}
|
|
93
102
|
}
|
|
94
103
|
```
|
|
95
104
|
|
|
96
|
-
|
|
105
|
+
- `"extends": ["prettier"]` enables the main config from `eslint-config-prettier`, which turns off some ESLint core rules that conflict with Prettier.
|
|
106
|
+
- `"plugins": ["prettier"]` registers this plugin.
|
|
107
|
+
- `"prettier/prettier": "error"` turns on the rule provided by this plugin, which runs Prettier from within ESLint.
|
|
108
|
+
- `"arrow-body-style": "off"` and `"prefer-arrow-callback": "off"` turns off two ESLint core rules that unfortunately are problematic with this plugin – see the next section.
|
|
109
|
+
|
|
110
|
+
## `arrow-body-style` and `prefer-arrow-callback` issue
|
|
111
|
+
|
|
112
|
+
If you use [arrow-body-style](https://eslint.org/docs/rules/arrow-body-style) or [prefer-arrow-callback](https://eslint.org/docs/rules/prefer-arrow-callback) together with the `prettier/prettier` rule from this plugin, you can in some cases end up with invalid code due to a bug in ESLint’s autofix – see [issue #65](https://github.com/prettier/eslint-plugin-prettier/issues/65).
|
|
113
|
+
|
|
114
|
+
For this reason, it’s recommended to turn off these rules. The `plugin:prettier/recommended` config does that for you.
|
|
115
|
+
|
|
116
|
+
You _can_ still use these rules together with this plugin 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.
|
|
117
|
+
|
|
118
|
+
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.
|
|
97
119
|
|
|
98
120
|
## Options
|
|
99
121
|
|
|
@@ -121,7 +143,7 @@ For the list of every available exclusion rule set, please see the [readme of es
|
|
|
121
143
|
}]
|
|
122
144
|
```
|
|
123
145
|
|
|
124
|
-
- `fileInfoOptions`: Options that are passed to [prettier.getFileInfo](https://prettier.io/docs/en/api.html#prettiergetfileinfofilepath
|
|
146
|
+
- `fileInfoOptions`: Options that are passed to [prettier.getFileInfo](https://prettier.io/docs/en/api.html#prettiergetfileinfofilepath--options) to decide whether a file needs to be formatted. Can be used for example to opt-out from ignoring files located in `node_modules` directories.
|
|
125
147
|
|
|
126
148
|
```json
|
|
127
149
|
"prettier/prettier": ["error", {}, {
|
|
@@ -110,7 +110,9 @@ module.exports = {
|
|
|
110
110
|
extends: ['prettier'],
|
|
111
111
|
plugins: ['prettier'],
|
|
112
112
|
rules: {
|
|
113
|
-
'prettier/prettier': 'error'
|
|
113
|
+
'prettier/prettier': 'error',
|
|
114
|
+
'arrow-body-style': 'off',
|
|
115
|
+
'prefer-arrow-callback': 'off'
|
|
114
116
|
}
|
|
115
117
|
}
|
|
116
118
|
},
|
|
@@ -120,6 +122,7 @@ module.exports = {
|
|
|
120
122
|
docs: {
|
|
121
123
|
url: 'https://github.com/prettier/eslint-plugin-prettier#options'
|
|
122
124
|
},
|
|
125
|
+
type: 'layout',
|
|
123
126
|
fixable: 'code',
|
|
124
127
|
schema: [
|
|
125
128
|
// Prettier options:
|
|
@@ -151,10 +154,6 @@ module.exports = {
|
|
|
151
154
|
const filepath = context.getFilename();
|
|
152
155
|
const source = sourceCode.text;
|
|
153
156
|
|
|
154
|
-
if (prettier && prettier.clearConfigCache) {
|
|
155
|
-
prettier.clearConfigCache();
|
|
156
|
-
}
|
|
157
|
-
|
|
158
157
|
return {
|
|
159
158
|
Program() {
|
|
160
159
|
if (!prettier) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-prettier",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "Runs prettier as an eslint rule",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"prettier-linter-helpers": "^1.0.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"eslint": ">=
|
|
35
|
-
"prettier": ">=
|
|
34
|
+
"eslint": ">=5.0.0",
|
|
35
|
+
"prettier": ">=1.13.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@not-an-aardvark/node-release-script": "^0.1.0",
|
|
39
|
-
"eslint": "^
|
|
39
|
+
"eslint": "^7.0.0",
|
|
40
40
|
"eslint-config-not-an-aardvark": "^2.1.0",
|
|
41
41
|
"eslint-config-prettier": "^6.0.0",
|
|
42
42
|
"eslint-plugin-eslint-plugin": "^2.0.0",
|
|
@@ -46,6 +46,11 @@
|
|
|
46
46
|
"prettier": "^1.15.3",
|
|
47
47
|
"vue-eslint-parser": "^6.0.0"
|
|
48
48
|
},
|
|
49
|
+
"peerDependenciesMeta": {
|
|
50
|
+
"eslint-plugin-prettier": {
|
|
51
|
+
"optional": true
|
|
52
|
+
}
|
|
53
|
+
},
|
|
49
54
|
"engines": {
|
|
50
55
|
"node": ">=6.0.0"
|
|
51
56
|
},
|