eslint-plugin-prettier 3.1.3 → 3.3.1

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,5 +1,40 @@
1
1
  # Changelog
2
2
 
3
+ ## v3.3.1 (2021-01-04)
4
+
5
+ * fix: add eslint-config-prettier as an optional peer dependency ([#374](git@github.com:prettier/eslint-plugin-prettier/issues/374)) ([d59df27](git@github.com:prettier/eslint-plugin-prettier/commit/d59df27890aaffec9e528ceb3155831a0261848d))
6
+ * build(deps-dev): bump eslint from 7.16.0 to 7.17.0 ([b87985d](git@github.com:prettier/eslint-plugin-prettier/commit/b87985d8b1986743374b56691bcc1633df8f4eae))
7
+ * build(deps-dev): bump eslint from 7.15.0 to 7.16.0 ([11e427e](git@github.com:prettier/eslint-plugin-prettier/commit/11e427e5d6cedeb26e3e03c8143be3496a24955a))
8
+
9
+ ## v3.3.0 (2020-12-13)
10
+
11
+ * 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))
12
+ * Add peerDependenciesMeta block ([#367](git@github.com:prettier/eslint-plugin-prettier/issues/367)) ([86608d5](git@github.com:prettier/eslint-plugin-prettier/commit/86608d5084692ab0d1f2f49a3df4909d04c39ae7))
13
+ * build(deps-dev): bump eslint from 7.14.0 to 7.15.0 ([885f484](git@github.com:prettier/eslint-plugin-prettier/commit/885f48405e0fc9f312acdd3e3487c824bd59c102))
14
+ * build(deps-dev): bump eslint from 7.3.1 to 7.14.0 ([cebc80b](git@github.com:prettier/eslint-plugin-prettier/commit/cebc80b39d3d09f957a73536e54f6d8dd4567080))
15
+
16
+ ## v3.2.0 (2020-12-03)
17
+
18
+ * 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))
19
+ * 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))
20
+ * Create dependabot.yml ([f58b6c7](git@github.com:prettier/eslint-plugin-prettier/commit/f58b6c7c356a37b437593cd6ff8d1dca1c437b13))
21
+ * 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))
22
+ * 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))
23
+ * build(deps-dev): bump eslint from 7.3.0 to 7.3.1 ([12d9ed8](git@github.com:prettier/eslint-plugin-prettier/commit/12d9ed877aacfad2c27f01161cc2eb28a445725f))
24
+ * build(deps-dev): bump eslint from 7.2.0 to 7.3.0 ([5a6f42e](git@github.com:prettier/eslint-plugin-prettier/commit/5a6f42e4eda871a294da1eb55f214c475450faa6))
25
+ * chore: update CI badge in readme ([5012b66](git@github.com:prettier/eslint-plugin-prettier/commit/5012b665f981edbc21feaaccb3cd297f49ca40d3))
26
+ * 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))
27
+
28
+ ## v3.1.4 (2020-06-14)
29
+
30
+ * 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))
31
+ * 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))
32
+ * build(deps-dev): bump eslint from 7.1.0 to 7.2.0 ([650ac7a](git@github.com:prettier/eslint-plugin-prettier/commit/650ac7a40c1f4d46b0bd37efad3eed84f8155a44))
33
+ * 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))
34
+ * build(deps-dev): bump eslint from 7.0.0 to 7.1.0 ([fd30022](git@github.com:prettier/eslint-plugin-prettier/commit/fd30022a51a57a4e96dd4ab3e04956b945886874))
35
+ * 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))
36
+ * 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))
37
+
3
38
  ## v3.1.3 (2020-04-13)
4
39
 
5
40
  * 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))
package/README.md CHANGED
@@ -1,7 +1,9 @@
1
- # eslint-plugin-prettier [![Build Status](https://travis-ci.org/prettier/eslint-plugin-prettier.svg?branch=master)](https://travis-ci.org/prettier/eslint-plugin-prettier)
1
+ # eslint-plugin-prettier [![Build Status](https://github.com/prettier/eslint-plugin-prettier/workflows/CI/badge.svg?branch=master)](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 patterns in the AST. (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.
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
- To integrate this plugin with `eslint-config-prettier`, you can use the `"recommended"` configuration:
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 last extension in your `.eslintrc.json`:
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
- This does three things:
75
+ You can then set Prettier's own options inside a `.prettierrc` file.
76
76
 
77
- - Enables `eslint-plugin-prettier`.
78
- - Sets the `prettier/prettier` rule to `"error"`.
79
- - Extends the `eslint-config-prettier` configuration.
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
- You can then set Prettier's own options inside a `.prettierrc` file.
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
- 3. In order to support special ESLint plugins (e.g. [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react)), add extra exclusions for the plugins you use like so:
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
- "plugin:prettier/recommended",
89
- "prettier/flowtype",
90
- "prettier/react",
91
- "prettier/standard"
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
- 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).
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-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.
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
  },
@@ -152,10 +154,6 @@ module.exports = {
152
154
  const filepath = context.getFilename();
153
155
  const source = sourceCode.text;
154
156
 
155
- if (prettier && prettier.clearConfigCache) {
156
- prettier.clearConfigCache();
157
- }
158
-
159
157
  return {
160
158
  Program() {
161
159
  if (!prettier) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-prettier",
3
- "version": "3.1.3",
3
+ "version": "3.3.1",
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": ">= 5.0.0",
35
- "prettier": ">= 1.13.0"
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": "^6.0.0",
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-config-prettier": {
51
+ "optional": true
52
+ }
53
+ },
49
54
  "engines": {
50
55
  "node": ">=6.0.0"
51
56
  },