eslint-plugin-prettier 3.4.0 → 3.4.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,12 @@
1
1
  # Changelog
2
2
 
3
+ ## v3.4.1 (2021-08-20)
4
+
5
+ * build(deps): Bump glob-parent from 5.0.0 to 5.1.2 ([#420](git@github.com:prettier/eslint-plugin-prettier/issues/420)) ([b6d075c](git@github.com:prettier/eslint-plugin-prettier/commit/b6d075cf7111468e8af4161c306c7f37f09f220e))
6
+ * build(deps): Bump path-parse from 1.0.6 to 1.0.7 ([#425](git@github.com:prettier/eslint-plugin-prettier/issues/425)) ([24f957e](git@github.com:prettier/eslint-plugin-prettier/commit/24f957ee2a5476bb9cc8e64921b9841fc751391e))
7
+ * feat: support `@graphql-eslint/eslint-plugin` out of box ([#413](git@github.com:prettier/eslint-plugin-prettier/issues/413)) ([ec6fbb1](git@github.com:prettier/eslint-plugin-prettier/commit/ec6fbb159e2454c6e145db55480932dc953cf7c1))
8
+ * chore: add tests for Node 16 ([#410](git@github.com:prettier/eslint-plugin-prettier/issues/410)) ([76bd45e](git@github.com:prettier/eslint-plugin-prettier/commit/76bd45ece6d56eb52f75db6b4a1efdd2efb56392))
9
+
3
10
  ## v3.4.0 (2021-04-15)
4
11
 
5
12
  * feat: support processor virtual filename ([#401](git@github.com:prettier/eslint-plugin-prettier/issues/401)) ([ee0ccc6](git@github.com:prettier/eslint-plugin-prettier/commit/ee0ccc6ac06d13cd546e78b444e53164f59eb27f))
@@ -165,7 +165,7 @@ module.exports = {
165
165
  })
166
166
  : null;
167
167
 
168
- const prettierFileInfo = prettier.getFileInfo.sync(
168
+ const { ignored, inferredParser } = prettier.getFileInfo.sync(
169
169
  onDiskFilepath,
170
170
  Object.assign(
171
171
  {},
@@ -175,7 +175,7 @@ module.exports = {
175
175
  );
176
176
 
177
177
  // Skip if file is ignored using a .prettierignore file
178
- if (prettierFileInfo.ignored) {
178
+ if (ignored) {
179
179
  return;
180
180
  }
181
181
 
@@ -206,11 +206,21 @@ module.exports = {
206
206
  // * Prettier supports parsing the file type
207
207
  // * There is an ESLint processor that extracts JavaScript snippets
208
208
  // from the file type.
209
- const parserBlocklist = [null, 'graphql', 'markdown', 'html'];
209
+ const parserBlocklist = [null, 'markdown', 'html'];
210
+
211
+ let inferParserToBabel =
212
+ parserBlocklist.indexOf(inferredParser) !== -1;
213
+
210
214
  if (
211
- filepath === onDiskFilepath &&
212
- parserBlocklist.indexOf(prettierFileInfo.inferredParser) !== -1
215
+ // it could be processed by `@graphql-eslint/eslint-plugin` or `eslint-plugin-graphql`
216
+ inferredParser === 'graphql' &&
217
+ // for `eslint-plugin-graphql`, see https://github.com/apollographql/eslint-plugin-graphql/blob/master/src/index.js#L416
218
+ source.startsWith('ESLintPluginGraphQLFile`')
213
219
  ) {
220
+ inferParserToBabel = true;
221
+ }
222
+
223
+ if (filepath === onDiskFilepath && inferParserToBabel) {
214
224
  // Prettier v1.16.0 renamed the `babylon` parser to `babel`
215
225
  // Use the modern name if available
216
226
  const supportBabelParser = prettier
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-prettier",
3
- "version": "3.4.0",
3
+ "version": "3.4.1",
4
4
  "description": "Runs prettier as an eslint rule",
5
5
  "keywords": [
6
6
  "eslint",