eslint-plugin-prettier 3.0.1 → 3.1.3

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,94 @@
1
1
  # Changelog
2
2
 
3
+ ## v3.1.3 (2020-04-13)
4
+
5
+ * 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))
6
+ * 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))
7
+ * build(deps): [security] bump acorn from 6.1.0 to 6.4.1 ([bba5881](git@github.com:prettier/eslint-plugin-prettier/commit/bba588151e860b1a644096441b31a0f3144db611))
8
+ * 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))
9
+ * 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))
10
+ * 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))
11
+ * 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))
12
+ * 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))
13
+ * build(deps-dev): bump eslint from 6.7.2 to 6.8.0 ([dea1b30](git@github.com:prettier/eslint-plugin-prettier/commit/dea1b30361921d7160aaf44d5302c5cc6490f87a))
14
+
15
+ ## v3.1.2 (2019-12-15)
16
+
17
+ * Resolve config when getting list of inferred parsers ([1ad45be](git@github.com:prettier/eslint-plugin-prettier/commit/1ad45be48ea1ed16e0eb3ba6247163724b956516))
18
+ * Fix tests now they to stop them inheriting from base prettierrc file ([14840fa](git@github.com:prettier/eslint-plugin-prettier/commit/14840fa4c88c938bf30c1fdf1c26c32b2708a3b6))
19
+ * Move prettier config into dedicated file, so vscode plugins pick it up ([c49334a](git@github.com:prettier/eslint-plugin-prettier/commit/c49334a846afa6f688695a4774f7824ee3a05e1c))
20
+ * build(deps-dev): bump eslint from 6.7.1 to 6.7.2 ([15e6cf9](git@github.com:prettier/eslint-plugin-prettier/commit/15e6cf91509cb5b819d2e1fb19dbe9bc71c87893))
21
+ * build(deps-dev): bump eslint from 6.6.0 to 6.7.1 ([e8ad019](git@github.com:prettier/eslint-plugin-prettier/commit/e8ad0195000af416f3315396e9c02fea261391cc))
22
+ * 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))
23
+ * 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))
24
+ * build(deps-dev): bump prettier from 1.18.2 to 1.19.1 ([10b4676](git@github.com:prettier/eslint-plugin-prettier/commit/10b46763fd007a8f939e43635831aec590717e87))
25
+ * build(deps-dev): bump eslint from 6.5.1 to 6.6.0 ([53eaeae](git@github.com:prettier/eslint-plugin-prettier/commit/53eaeaec91c158b66cc04dbf80f9631bb82285bf))
26
+ * 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))
27
+ * build(deps-dev): bump mocha from 6.2.1 to 6.2.2 ([b7280b6](git@github.com:prettier/eslint-plugin-prettier/commit/b7280b68eaae243aa33de364576cddf0844c6848))
28
+ * 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))
29
+ * build(deps-dev): bump eslint from 6.5.0 to 6.5.1 ([c109a7a](git@github.com:prettier/eslint-plugin-prettier/commit/c109a7a5acca9533feae6258e9ac4934359ed9b3))
30
+ * build(deps-dev): bump mocha from 6.2.0 to 6.2.1 ([3134bea](git@github.com:prettier/eslint-plugin-prettier/commit/3134beab61dee13aa2c73762a55f51f868553e8a))
31
+ * build(deps-dev): bump eslint from 6.4.0 to 6.5.0 ([7c290d7](git@github.com:prettier/eslint-plugin-prettier/commit/7c290d799e319b39519d81a110b62846894bc7ba))
32
+
33
+ ## v3.1.1 (2019-09-18)
34
+
35
+ * build(deps-dev): bump eslint from 6.3.0 to 6.4.0 ([8a793eb](git@github.com:prettier/eslint-plugin-prettier/commit/8a793eba54ff01493e3ee83daf4dcb782d039fdd))
36
+ * build(deps-dev): bump eslint-config-prettier from 6.2.0 to 6.3.0 ([88c3f6c](git@github.com:prettier/eslint-plugin-prettier/commit/88c3f6cb510b758e6dc866a1ad1a0484ef074484))
37
+ * build(deps-dev): bump eslint-config-prettier from 6.0.0 to 6.2.0 ([5f9fbc1](git@github.com:prettier/eslint-plugin-prettier/commit/5f9fbc16f91d88a5c77b8b9d942b82424add77a5))
38
+ * build(deps-dev): bump eslint from 6.2.2 to 6.3.0 ([746b66d](git@github.com:prettier/eslint-plugin-prettier/commit/746b66dc701e8226930f6e4d8386bd500dcb303b))
39
+ * build(deps-dev): bump eslint from 6.1.0 to 6.2.2 ([97eedb4](git@github.com:prettier/eslint-plugin-prettier/commit/97eedb4734a4c569d4c24a62cffe024c2a26c178))
40
+ * build(deps-dev): bump eslint from 6.0.1 to 6.1.0 ([afef9d1](git@github.com:prettier/eslint-plugin-prettier/commit/afef9d137c8b7887c63e3f8d51cabf42851f5cf1))
41
+ * build(deps-dev): bump mocha from 6.1.4 to 6.2.0 ([0360a84](git@github.com:prettier/eslint-plugin-prettier/commit/0360a845ce530d8c25f390961d6446b4c58e85ac))
42
+ * build(deps): [security] bump lodash from 4.17.11 to 4.17.14 ([9eceb68](git@github.com:prettier/eslint-plugin-prettier/commit/9eceb6834fcd003c5680c3202b656ca3474c19c2))
43
+ * Fix: When forcing the JS parser, use the modern name ([#212](git@github.com:prettier/eslint-plugin-prettier/issues/212)) ([1385310](git@github.com:prettier/eslint-plugin-prettier/commit/1385310fce778a8c771d0dab0e400725c9f9d82e))
44
+ * Add eslint 6 to test matrix ([#210](git@github.com:prettier/eslint-plugin-prettier/issues/210)) ([bca77e6](git@github.com:prettier/eslint-plugin-prettier/commit/bca77e66ed1eba682eb13055862adc70478d472b))
45
+ * build(deps-dev): bump eslint-config-prettier from 5.0.0 to 6.0.0 ([4c069bd](git@github.com:prettier/eslint-plugin-prettier/commit/4c069bd0f3b907039569964e747479aa06279594))
46
+ * build(deps-dev): bump eslint-config-prettier from 4.3.0 to 5.0.0 ([60bb22f](git@github.com:prettier/eslint-plugin-prettier/commit/60bb22f4ae1d6af001ba55338a7cb08111db23d9))
47
+ * build(deps-dev): bump prettier from 1.18.0 to 1.18.2 ([a183560](git@github.com:prettier/eslint-plugin-prettier/commit/a1835600facebc819e31a0816061e62f8be2cd8b))
48
+ * build(deps-dev): bump prettier from 1.17.1 to 1.18.0 ([0cad479](git@github.com:prettier/eslint-plugin-prettier/commit/0cad4793abb6139eb9d6853b5adef7469aef756d))
49
+ * build(deps-dev): bump eslint-config-prettier from 4.2.0 to 4.3.0 ([6f3c76f](git@github.com:prettier/eslint-plugin-prettier/commit/6f3c76fd75dc4f982d1221e6b4802329b32176a9))
50
+ * build(deps-dev): bump prettier from 1.17.0 to 1.17.1 ([03aecfd](git@github.com:prettier/eslint-plugin-prettier/commit/03aecfd49b96d055ff54ec989c93408a9fb3f3ee))
51
+
52
+ ## v3.1.0 (2019-05-11)
53
+
54
+ * New: Allow options to be passed to prettier.getFileInfo ([#187](https://github.com/prettier/eslint-plugin-prettier/issues/187)) ([21fa69a](https://github.com/prettier/eslint-plugin-prettier/commit/21fa69a8ed3b6acfc5461f6c3332444c21e65e28))
55
+ * build(deps-dev): bump eslint-plugin-eslint-plugin from 2.0.1 to 2.1.0 ([bb597e1](https://github.com/prettier/eslint-plugin-prettier/commit/bb597e14aba46211fd4149d0b0f1bdc51fe76452))
56
+ * build(deps-dev): bump eslint-config-prettier from 4.1.0 to 4.2.0 ([0bb7c1d](https://github.com/prettier/eslint-plugin-prettier/commit/0bb7c1d361b581fddebd64bf172b5dedcad5149c))
57
+ * build(deps-dev): bump vue-eslint-parser from 6.0.3 to 6.0.4 ([2f77df4](https://github.com/prettier/eslint-plugin-prettier/commit/2f77df48f151d4975bbdb29ced8c74a72d011428))
58
+ * build(deps-dev): bump mocha from 6.1.3 to 6.1.4 ([222b87a](https://github.com/prettier/eslint-plugin-prettier/commit/222b87a347331b20b3e7f65dcdfaa491bd277b3a))
59
+ * build(deps-dev): bump prettier from 1.16.4 to 1.17.0 ([58d8ff8](https://github.com/prettier/eslint-plugin-prettier/commit/58d8ff8ab2b1f73c904f5492eb523d7ea585ed8f))
60
+ * build(deps-dev): bump mocha from 6.1.2 to 6.1.3 ([e94e56c](https://github.com/prettier/eslint-plugin-prettier/commit/e94e56c36018aab6e08452fbe05bb16a23d64197))
61
+ * build(deps-dev): bump mocha from 6.1.1 to 6.1.2 ([c02244b](https://github.com/prettier/eslint-plugin-prettier/commit/c02244b197893f4e2a214d43f755b726cecbd03c))
62
+ * build(deps-dev): bump mocha from 6.0.2 to 6.1.1 ([a9a2e4e](https://github.com/prettier/eslint-plugin-prettier/commit/a9a2e4e3c0a243ec73061c10d9c4a5ae0c0e6f68))
63
+ * build(deps-dev): bump eslint from 5.15.3 to 5.16.0 ([073c14c](https://github.com/prettier/eslint-plugin-prettier/commit/073c14c2ae5c43d0939fe6f475561f1cf3d7a3e5))
64
+ * build(deps-dev): bump eslint from 5.15.2 to 5.15.3 ([bda931f](https://github.com/prettier/eslint-plugin-prettier/commit/bda931f4f1344f6927fbfd3a35965d1a4d319642))
65
+ * build(deps-dev): bump eslint from 5.15.1 to 5.15.2 ([19f53d6](https://github.com/prettier/eslint-plugin-prettier/commit/19f53d6a94a701e0aab9630bef93051aec4dfd36))
66
+ * build(deps-dev): bump eslint from 5.15.0 to 5.15.1 ([34b39de](https://github.com/prettier/eslint-plugin-prettier/commit/34b39dec2e6e283da1ca6faa0c636c5361efb5b9))
67
+ * build(deps-dev): bump eslint from 5.14.1 to 5.15.0 ([13bcc66](https://github.com/prettier/eslint-plugin-prettier/commit/13bcc66c120d614c17040e329360510feab47e7d))
68
+ * build(deps-dev): bump eslint-plugin-self from 1.1.0 to 1.2.0 ([5b4adb8](https://github.com/prettier/eslint-plugin-prettier/commit/5b4adb8ce683a93feddad07eda17d99b41849342))
69
+ * build(deps-dev): bump vue-eslint-parser from 6.0.2 to 6.0.3 ([e676cd1](https://github.com/prettier/eslint-plugin-prettier/commit/e676cd19387e70102467d9a82014906561f3c225))
70
+ * build(deps-dev): bump eslint-config-prettier from 4.0.0 to 4.1.0 ([b8a9215](https://github.com/prettier/eslint-plugin-prettier/commit/b8a9215515cdcb75faf212caeb00dfbcae11ee42))
71
+ * build(deps-dev): bump mocha from 6.0.1 to 6.0.2 ([cde36e4](https://github.com/prettier/eslint-plugin-prettier/commit/cde36e4db18ac4442eba3c75a20c1a6605e937d4))
72
+ * build(deps-dev): bump mocha from 6.0.0 to 6.0.1 ([eb39699](https://github.com/prettier/eslint-plugin-prettier/commit/eb39699b9bdf7c406a3134cc26c404947534661d))
73
+ * build(deps-dev): bump mocha from 5.2.0 to 6.0.0 ([5d75421](https://github.com/prettier/eslint-plugin-prettier/commit/5d75421d5e3ee5f8293b47a5825e1f2415f7e6b9))
74
+ * build(deps-dev): bump eslint from 5.14.0 to 5.14.1 ([829156e](https://github.com/prettier/eslint-plugin-prettier/commit/829156e467e53f554691afa687c13715086974f7))
75
+ * build(deps-dev): bump eslint from 5.13.0 to 5.14.0 ([b76d0b4](https://github.com/prettier/eslint-plugin-prettier/commit/b76d0b4471845143630b3603b97607665bf66ca0))
76
+ * build(deps-dev): bump vue-eslint-parser from 6.0.0 to 6.0.2 ([15439e8](https://github.com/prettier/eslint-plugin-prettier/commit/15439e8e0dcfa11a19f0cf249a1f4ad5f7fa5b96))
77
+ * build(deps-dev): bump vue-eslint-parser from 5.0.0 to 6.0.0 ([0ea70e5](https://github.com/prettier/eslint-plugin-prettier/commit/0ea70e5161d315ab93e6c4eb93f76d5304b8c162))
78
+ * build(deps-dev): bump eslint from 5.12.1 to 5.13.0 ([5f18729](https://github.com/prettier/eslint-plugin-prettier/commit/5f18729dbe359fe0df10730fd768a1ca6949b0a2))
79
+ * build(deps-dev): bump prettier from 1.16.3 to 1.16.4 ([ef637fe](https://github.com/prettier/eslint-plugin-prettier/commit/ef637fea4d6028b472cfe56dcb4fe30ee7939e0d))
80
+ * build(deps-dev): bump prettier from 1.16.1 to 1.16.3 ([58ab20c](https://github.com/prettier/eslint-plugin-prettier/commit/58ab20cc03f81a7d668998e64168eef7ad5b4365))
81
+ * build(deps-dev): bump eslint-config-prettier from 3.6.0 to 4.0.0 ([14393bd](https://github.com/prettier/eslint-plugin-prettier/commit/14393bdbcfd6114e810c10b4b7f905485474a36f))
82
+ * build(deps-dev): bump prettier from 1.16.0 to 1.16.1 ([00198b9](https://github.com/prettier/eslint-plugin-prettier/commit/00198b9795d1341f4c4a488c83f656e74f6bfdb0))
83
+ * build(deps-dev): bump prettier from 1.15.3 to 1.16.0 ([7890a87](https://github.com/prettier/eslint-plugin-prettier/commit/7890a876fc1c22b1fdee8724296eaa56eb6df1a3))
84
+ * build(deps-dev): bump eslint from 5.12.0 to 5.12.1 ([92a8984](https://github.com/prettier/eslint-plugin-prettier/commit/92a898470fbd88a4f5f4d8e1b15cf53bd7f8a92e))
85
+ * build(deps-dev): bump eslint-config-prettier from 3.5.0 to 3.6.0 ([5292d12](https://github.com/prettier/eslint-plugin-prettier/commit/5292d127dfd4f90ec6695d4060b5f5447a2c0119))
86
+ * build(deps-dev): bump eslint-config-prettier from 3.4.0 to 3.5.0 ([44a2558](https://github.com/prettier/eslint-plugin-prettier/commit/44a2558820d1c733f1572c98503e7b00b16b3fb7))
87
+ * build(deps-dev): bump eslint-config-prettier from 3.3.0 to 3.4.0 ([425cfce](https://github.com/prettier/eslint-plugin-prettier/commit/425cfce1bb712c96dfdd2292b04d89cceb375681))
88
+ * build(deps-dev): bump eslint from 5.11.1 to 5.12.0 ([3e9aa39](https://github.com/prettier/eslint-plugin-prettier/commit/3e9aa399ee3c0394a397f6ed3f8ec7c5e1597991))
89
+ * build(deps-dev): bump eslint-plugin-node from 8.0.0 to 8.0.1 ([e913afd](https://github.com/prettier/eslint-plugin-prettier/commit/e913afdd7291b5e58adf567f5e7a5bb9257dc9e3))
90
+ * build(deps-dev): bump vue-eslint-parser from 4.0.3 to 5.0.0 ([ecfd5ba](https://github.com/prettier/eslint-plugin-prettier/commit/ecfd5bab7bfb36e0203a334808243cb85aaeb512))
91
+
3
92
  ## v3.0.1 (2018-12-28)
4
93
 
5
94
  * Catch and format SyntaxErrors as eslint violations ([#141](https://github.com/prettier/eslint-plugin-prettier/issues/141)) ([4a0e57d](https://github.com/prettier/eslint-plugin-prettier/commit/4a0e57ddcc0fa2ae8e8f7d8b65ddc4ac93d9f474))
package/README.md CHANGED
@@ -121,6 +121,16 @@ For the list of every available exclusion rule set, please see the [readme of es
121
121
  }]
122
122
  ```
123
123
 
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.
125
+
126
+ ```json
127
+ "prettier/prettier": ["error", {}, {
128
+ "fileInfoOptions": {
129
+ "withNodeModules": true
130
+ }
131
+ }]
132
+ ```
133
+
124
134
  - The rule is autofixable -- if you run `eslint` with the `--fix` flag, your code will be formatted according to `prettier` style.
125
135
 
126
136
  ---
@@ -120,6 +120,7 @@ module.exports = {
120
120
  docs: {
121
121
  url: 'https://github.com/prettier/eslint-plugin-prettier#options'
122
122
  },
123
+ type: 'layout',
123
124
  fixable: 'code',
124
125
  schema: [
125
126
  // Prettier options:
@@ -131,7 +132,12 @@ module.exports = {
131
132
  {
132
133
  type: 'object',
133
134
  properties: {
134
- usePrettierrc: { type: 'boolean' }
135
+ usePrettierrc: { type: 'boolean' },
136
+ fileInfoOptions: {
137
+ type: 'object',
138
+ properties: {},
139
+ additionalProperties: true
140
+ }
135
141
  },
136
142
  additionalProperties: true
137
143
  }
@@ -140,6 +146,8 @@ module.exports = {
140
146
  create(context) {
141
147
  const usePrettierrc =
142
148
  !context.options[1] || context.options[1].usePrettierrc !== false;
149
+ const eslintFileInfoOptions =
150
+ (context.options[1] && context.options[1].fileInfoOptions) || {};
143
151
  const sourceCode = context.getSourceCode();
144
152
  const filepath = context.getFilename();
145
153
  const source = sourceCode.text;
@@ -163,9 +171,14 @@ module.exports = {
163
171
  })
164
172
  : null;
165
173
 
166
- const prettierFileInfo = prettier.getFileInfo.sync(filepath, {
167
- ignorePath: '.prettierignore'
168
- });
174
+ const prettierFileInfo = prettier.getFileInfo.sync(
175
+ filepath,
176
+ Object.assign(
177
+ {},
178
+ { resolveConfig: true, ignorePath: '.prettierignore' },
179
+ eslintFileInfoOptions
180
+ )
181
+ );
169
182
 
170
183
  // Skip if file is ignored using a .prettierignore file
171
184
  if (prettierFileInfo.ignored) {
@@ -198,7 +211,13 @@ module.exports = {
198
211
  if (
199
212
  parserBlocklist.indexOf(prettierFileInfo.inferredParser) !== -1
200
213
  ) {
201
- initialOptions.parser = 'babylon';
214
+ // Prettier v1.16.0 renamed the `babylon` parser to `babel`
215
+ // Use the modern name if available
216
+ const supportBabelParser = prettier
217
+ .getSupportInfo()
218
+ .languages.some(language => language.parsers.includes('babel'));
219
+
220
+ initialOptions.parser = supportBabelParser ? 'babel' : 'babylon';
202
221
  }
203
222
 
204
223
  const prettierOptions = Object.assign(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-prettier",
3
- "version": "3.0.1",
3
+ "version": "3.1.3",
4
4
  "description": "Runs prettier as an eslint rule",
5
5
  "keywords": [
6
6
  "eslint",
@@ -36,15 +36,15 @@
36
36
  },
37
37
  "devDependencies": {
38
38
  "@not-an-aardvark/node-release-script": "^0.1.0",
39
- "eslint": "^5.6.0",
39
+ "eslint": "^6.0.0",
40
40
  "eslint-config-not-an-aardvark": "^2.1.0",
41
- "eslint-config-prettier": "^3.1.0",
41
+ "eslint-config-prettier": "^6.0.0",
42
42
  "eslint-plugin-eslint-plugin": "^2.0.0",
43
43
  "eslint-plugin-node": "^8.0.0",
44
44
  "eslint-plugin-self": "^1.1.0",
45
- "mocha": "^5.2.0",
45
+ "mocha": "^6.0.0",
46
46
  "prettier": "^1.15.3",
47
- "vue-eslint-parser": "^4.0.2"
47
+ "vue-eslint-parser": "^6.0.0"
48
48
  },
49
49
  "engines": {
50
50
  "node": ">=6.0.0"