eslint-plugin-prettier 3.0.0 → 3.0.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 +17 -0
- package/eslint-plugin-prettier.js +34 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v3.0.1 (2018-12-28)
|
|
4
|
+
|
|
5
|
+
* 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))
|
|
6
|
+
* build(deps-dev): bump eslint from 5.11.0 to 5.11.1 ([d34daed](https://github.com/prettier/eslint-plugin-prettier/commit/d34daed47fbda09cbd19a73c38323e0aed0c30d5))
|
|
7
|
+
* build(deps-dev): bump eslint from 5.10.0 to 5.11.0 ([7f4f45d](https://github.com/prettier/eslint-plugin-prettier/commit/7f4f45dd132ecd72207b536b86910bebf15693b6))
|
|
8
|
+
* build(deps-dev): bump eslint-plugin-eslint-plugin from 2.0.0 to 2.0.1 ([5be3bcf](https://github.com/prettier/eslint-plugin-prettier/commit/5be3bcfce11b741cd35c92b9c972e457a4038766))
|
|
9
|
+
* build(deps-dev): bump eslint from 5.9.0 to 5.10.0 ([11e7c44](https://github.com/prettier/eslint-plugin-prettier/commit/11e7c447a8ebcfae213afe6ba872f96adb43e6b9))
|
|
10
|
+
* build(deps-dev): bump eslint-plugin-eslint-plugin from 1.4.1 to 2.0.0 ([9e5bf14](https://github.com/prettier/eslint-plugin-prettier/commit/9e5bf140451f82a36c78042315a9f88a12cfe45f))
|
|
11
|
+
* build(deps-dev): bump vue-eslint-parser from 4.0.2 to 4.0.3 ([234583a](https://github.com/prettier/eslint-plugin-prettier/commit/234583a19a97ecd1f996542ccb1178a26d20c0fd))
|
|
12
|
+
* build(deps-dev): bump vue-eslint-parser from 3.3.0 to 4.0.2 ([8675d57](https://github.com/prettier/eslint-plugin-prettier/commit/8675d5713f5171981119b89c2e8a58fda6b81259))
|
|
13
|
+
* Upgrade: Bump vue-eslint-parser from 3.2.2 to 3.3.0 ([2379e93](https://github.com/prettier/eslint-plugin-prettier/commit/2379e93c7fb81ddfe306c1fe6a10d1833cfddf2c))
|
|
14
|
+
* Upgrade: Bump eslint-config-prettier from 3.1.0 to 3.3.0 ([3ea0021](https://github.com/prettier/eslint-plugin-prettier/commit/3ea00218961b75e475def14372f9eab0de5ad05d))
|
|
15
|
+
* Upgrade: Bump eslint from 5.8.0 to 5.9.0 ([c774fb8](https://github.com/prettier/eslint-plugin-prettier/commit/c774fb87fe53d19389964883f05e77309b321139))
|
|
16
|
+
* build(deps-dev): bump eslint-plugin-node from 7.0.1 to 8.0.0 ([#121](https://github.com/prettier/eslint-plugin-prettier/issues/121)) ([2a4fba0](https://github.com/prettier/eslint-plugin-prettier/commit/2a4fba01222f62a576da48478e3dcd832e3bff7e))
|
|
17
|
+
* build(deps-dev): bump eslint-plugin-eslint-plugin from 1.4.0 to 1.4.1 ([#120](https://github.com/prettier/eslint-plugin-prettier/issues/120)) ([29caa29](https://github.com/prettier/eslint-plugin-prettier/commit/29caa299612db8af7a188749a5dd8b9827f51a67))
|
|
18
|
+
* build(deps-dev): bump eslint from 5.6.0 to 5.8.0 ([#119](https://github.com/prettier/eslint-plugin-prettier/issues/119)) ([2836350](https://github.com/prettier/eslint-plugin-prettier/commit/2836350829dc3c19b4c1ebca33a3a7905c1b28a5))
|
|
19
|
+
|
|
3
20
|
## v3.0.0 (2018-10-01)
|
|
4
21
|
|
|
5
22
|
* Chore: Add eslint peer-dependency ([d55d79c](https://github.com/prettier/eslint-plugin-prettier/commit/d55d79c6a64f659f405788fc75f344704619979f))
|
|
@@ -209,7 +209,40 @@ module.exports = {
|
|
|
209
209
|
{ filepath }
|
|
210
210
|
);
|
|
211
211
|
|
|
212
|
-
|
|
212
|
+
// prettier.format() may throw a SyntaxError if it cannot parse the
|
|
213
|
+
// source code it is given. Ususally for JS files this isn't a
|
|
214
|
+
// problem as ESLint will report invalid syntax before trying to
|
|
215
|
+
// pass it to the prettier plugin. However this might be a problem
|
|
216
|
+
// for non-JS languages that are handled by a plugin. Notably Vue
|
|
217
|
+
// files throw an error if they contain unclosed elements, such as
|
|
218
|
+
// `<template><div></template>. In this case report an error at the
|
|
219
|
+
// point at which parsing failed.
|
|
220
|
+
let prettierSource;
|
|
221
|
+
try {
|
|
222
|
+
prettierSource = prettier.format(source, prettierOptions);
|
|
223
|
+
} catch (err) {
|
|
224
|
+
if (!(err instanceof SyntaxError)) {
|
|
225
|
+
throw err;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
let message = 'Parsing error: ' + err.message;
|
|
229
|
+
|
|
230
|
+
// Prettier's message contains a codeframe style preview of the
|
|
231
|
+
// invalid code and the line/column at which the error occured.
|
|
232
|
+
// ESLint shows those pieces of information elsewhere already so
|
|
233
|
+
// remove them from the message
|
|
234
|
+
if (err.codeFrame) {
|
|
235
|
+
message = message.replace(`\n${err.codeFrame}`, '');
|
|
236
|
+
}
|
|
237
|
+
if (err.loc) {
|
|
238
|
+
message = message.replace(/ \(\d+:\d+\)$/, '');
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
context.report({ message, loc: err.loc });
|
|
242
|
+
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
|
|
213
246
|
if (source !== prettierSource) {
|
|
214
247
|
const differences = generateDifferences(source, prettierSource);
|
|
215
248
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-prettier",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Runs prettier as an eslint rule",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"eslint": "^5.6.0",
|
|
40
40
|
"eslint-config-not-an-aardvark": "^2.1.0",
|
|
41
41
|
"eslint-config-prettier": "^3.1.0",
|
|
42
|
-
"eslint-plugin-eslint-plugin": "^
|
|
43
|
-
"eslint-plugin-node": "^
|
|
42
|
+
"eslint-plugin-eslint-plugin": "^2.0.0",
|
|
43
|
+
"eslint-plugin-node": "^8.0.0",
|
|
44
44
|
"eslint-plugin-self": "^1.1.0",
|
|
45
45
|
"mocha": "^5.2.0",
|
|
46
|
-
"prettier": "^1.
|
|
47
|
-
"vue-eslint-parser": "^
|
|
46
|
+
"prettier": "^1.15.3",
|
|
47
|
+
"vue-eslint-parser": "^4.0.2"
|
|
48
48
|
},
|
|
49
49
|
"engines": {
|
|
50
50
|
"node": ">=6.0.0"
|