eslint-plugin-prettier 3.1.1 → 3.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,57 @@
1
1
  # Changelog
2
2
 
3
+ ## v3.2.0 (2020-12-03)
4
+
5
+ * 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))
6
+ * 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))
7
+ * Create dependabot.yml ([f58b6c7](git@github.com:prettier/eslint-plugin-prettier/commit/f58b6c7c356a37b437593cd6ff8d1dca1c437b13))
8
+ * 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))
9
+ * 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))
10
+ * build(deps-dev): bump eslint from 7.3.0 to 7.3.1 ([12d9ed8](git@github.com:prettier/eslint-plugin-prettier/commit/12d9ed877aacfad2c27f01161cc2eb28a445725f))
11
+ * build(deps-dev): bump eslint from 7.2.0 to 7.3.0 ([5a6f42e](git@github.com:prettier/eslint-plugin-prettier/commit/5a6f42e4eda871a294da1eb55f214c475450faa6))
12
+ * chore: update CI badge in readme ([5012b66](git@github.com:prettier/eslint-plugin-prettier/commit/5012b665f981edbc21feaaccb3cd297f49ca40d3))
13
+ * 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))
14
+
15
+ ## v3.1.4 (2020-06-14)
16
+
17
+ * 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))
18
+ * 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))
19
+ * build(deps-dev): bump eslint from 7.1.0 to 7.2.0 ([650ac7a](git@github.com:prettier/eslint-plugin-prettier/commit/650ac7a40c1f4d46b0bd37efad3eed84f8155a44))
20
+ * 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))
21
+ * build(deps-dev): bump eslint from 7.0.0 to 7.1.0 ([fd30022](git@github.com:prettier/eslint-plugin-prettier/commit/fd30022a51a57a4e96dd4ab3e04956b945886874))
22
+ * 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))
23
+ * 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))
24
+
25
+ ## v3.1.3 (2020-04-13)
26
+
27
+ * 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))
28
+ * 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))
29
+ * build(deps): [security] bump acorn from 6.1.0 to 6.4.1 ([bba5881](git@github.com:prettier/eslint-plugin-prettier/commit/bba588151e860b1a644096441b31a0f3144db611))
30
+ * 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))
31
+ * 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))
32
+ * 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))
33
+ * 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))
34
+ * 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))
35
+ * build(deps-dev): bump eslint from 6.7.2 to 6.8.0 ([dea1b30](git@github.com:prettier/eslint-plugin-prettier/commit/dea1b30361921d7160aaf44d5302c5cc6490f87a))
36
+
37
+ ## v3.1.2 (2019-12-15)
38
+
39
+ * Resolve config when getting list of inferred parsers ([1ad45be](git@github.com:prettier/eslint-plugin-prettier/commit/1ad45be48ea1ed16e0eb3ba6247163724b956516))
40
+ * Fix tests now they to stop them inheriting from base prettierrc file ([14840fa](git@github.com:prettier/eslint-plugin-prettier/commit/14840fa4c88c938bf30c1fdf1c26c32b2708a3b6))
41
+ * Move prettier config into dedicated file, so vscode plugins pick it up ([c49334a](git@github.com:prettier/eslint-plugin-prettier/commit/c49334a846afa6f688695a4774f7824ee3a05e1c))
42
+ * build(deps-dev): bump eslint from 6.7.1 to 6.7.2 ([15e6cf9](git@github.com:prettier/eslint-plugin-prettier/commit/15e6cf91509cb5b819d2e1fb19dbe9bc71c87893))
43
+ * build(deps-dev): bump eslint from 6.6.0 to 6.7.1 ([e8ad019](git@github.com:prettier/eslint-plugin-prettier/commit/e8ad0195000af416f3315396e9c02fea261391cc))
44
+ * build(deps-dev): bump eslint-config-prettier from 6.6.0 to 6.7.0 ([44f4bfe](git@github.com:prettier/eslint-plugin-prettier/commit/44f4bfe0b6f63234afeba266928b39b762269282))
45
+ * build(deps-dev): bump eslint-config-prettier from 6.5.0 to 6.6.0 ([46580c5](git@github.com:prettier/eslint-plugin-prettier/commit/46580c55914057dee5089e9c6e525e41996888d1))
46
+ * build(deps-dev): bump prettier from 1.18.2 to 1.19.1 ([10b4676](git@github.com:prettier/eslint-plugin-prettier/commit/10b46763fd007a8f939e43635831aec590717e87))
47
+ * build(deps-dev): bump eslint from 6.5.1 to 6.6.0 ([53eaeae](git@github.com:prettier/eslint-plugin-prettier/commit/53eaeaec91c158b66cc04dbf80f9631bb82285bf))
48
+ * build(deps-dev): bump eslint-config-prettier from 6.4.0 to 6.5.0 ([ad3321c](git@github.com:prettier/eslint-plugin-prettier/commit/ad3321c3ae6e963317fedcdd205ba719bf933d74))
49
+ * build(deps-dev): bump mocha from 6.2.1 to 6.2.2 ([b7280b6](git@github.com:prettier/eslint-plugin-prettier/commit/b7280b68eaae243aa33de364576cddf0844c6848))
50
+ * build(deps-dev): bump eslint-config-prettier from 6.3.0 to 6.4.0 ([4c1d69a](git@github.com:prettier/eslint-plugin-prettier/commit/4c1d69a8022c709cd62e964a82c7dbc7963f0544))
51
+ * build(deps-dev): bump eslint from 6.5.0 to 6.5.1 ([c109a7a](git@github.com:prettier/eslint-plugin-prettier/commit/c109a7a5acca9533feae6258e9ac4934359ed9b3))
52
+ * build(deps-dev): bump mocha from 6.2.0 to 6.2.1 ([3134bea](git@github.com:prettier/eslint-plugin-prettier/commit/3134beab61dee13aa2c73762a55f51f868553e8a))
53
+ * build(deps-dev): bump eslint from 6.4.0 to 6.5.0 ([7c290d7](git@github.com:prettier/eslint-plugin-prettier/commit/7c290d799e319b39519d81a110b62846894bc7ba))
54
+
3
55
  ## v3.1.1 (2019-09-18)
4
56
 
5
57
  * build(deps-dev): bump eslint from 6.3.0 to 6.4.0 ([8a793eb](git@github.com:prettier/eslint-plugin-prettier/commit/8a793eba54ff01493e3ee83daf4dcb782d039fdd))
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
  },
@@ -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,7 +154,12 @@ module.exports = {
151
154
  const filepath = context.getFilename();
152
155
  const source = sourceCode.text;
153
156
 
154
- if (prettier && prettier.clearConfigCache) {
157
+ // This allows long-running ESLint processes (e.g. vscode-eslint) to
158
+ // pick up changes to .prettierrc without restarting the editor. This
159
+ // will invalidate the prettier plugin cache on every file as well which
160
+ // will make ESLint very slow, so it would probably be a good idea to
161
+ // find a better way to do this.
162
+ if (usePrettierrc && prettier && prettier.clearConfigCache) {
155
163
  prettier.clearConfigCache();
156
164
  }
157
165
 
@@ -174,7 +182,7 @@ module.exports = {
174
182
  filepath,
175
183
  Object.assign(
176
184
  {},
177
- { ignorePath: '.prettierignore' },
185
+ { resolveConfig: true, ignorePath: '.prettierignore' },
178
186
  eslintFileInfoOptions
179
187
  )
180
188
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-prettier",
3
- "version": "3.1.1",
3
+ "version": "3.2.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": ">= 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",