eslint-plugin-prettier
Advanced tools
Comparing version 3.0.0 to 3.0.1
# Changelog | ||
## v3.0.1 (2018-12-28) | ||
* 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)) | ||
* build(deps-dev): bump eslint from 5.11.0 to 5.11.1 ([d34daed](https://github.com/prettier/eslint-plugin-prettier/commit/d34daed47fbda09cbd19a73c38323e0aed0c30d5)) | ||
* build(deps-dev): bump eslint from 5.10.0 to 5.11.0 ([7f4f45d](https://github.com/prettier/eslint-plugin-prettier/commit/7f4f45dd132ecd72207b536b86910bebf15693b6)) | ||
* 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)) | ||
* build(deps-dev): bump eslint from 5.9.0 to 5.10.0 ([11e7c44](https://github.com/prettier/eslint-plugin-prettier/commit/11e7c447a8ebcfae213afe6ba872f96adb43e6b9)) | ||
* 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)) | ||
* 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)) | ||
* 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)) | ||
* Upgrade: Bump vue-eslint-parser from 3.2.2 to 3.3.0 ([2379e93](https://github.com/prettier/eslint-plugin-prettier/commit/2379e93c7fb81ddfe306c1fe6a10d1833cfddf2c)) | ||
* Upgrade: Bump eslint-config-prettier from 3.1.0 to 3.3.0 ([3ea0021](https://github.com/prettier/eslint-plugin-prettier/commit/3ea00218961b75e475def14372f9eab0de5ad05d)) | ||
* Upgrade: Bump eslint from 5.8.0 to 5.9.0 ([c774fb8](https://github.com/prettier/eslint-plugin-prettier/commit/c774fb87fe53d19389964883f05e77309b321139)) | ||
* 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)) | ||
* 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)) | ||
* 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)) | ||
## v3.0.0 (2018-10-01) | ||
@@ -4,0 +21,0 @@ |
@@ -212,3 +212,36 @@ /** | ||
const prettierSource = prettier.format(source, prettierOptions); | ||
// prettier.format() may throw a SyntaxError if it cannot parse the | ||
// source code it is given. Ususally for JS files this isn't a | ||
// problem as ESLint will report invalid syntax before trying to | ||
// pass it to the prettier plugin. However this might be a problem | ||
// for non-JS languages that are handled by a plugin. Notably Vue | ||
// files throw an error if they contain unclosed elements, such as | ||
// `<template><div></template>. In this case report an error at the | ||
// point at which parsing failed. | ||
let prettierSource; | ||
try { | ||
prettierSource = prettier.format(source, prettierOptions); | ||
} catch (err) { | ||
if (!(err instanceof SyntaxError)) { | ||
throw err; | ||
} | ||
let message = 'Parsing error: ' + err.message; | ||
// Prettier's message contains a codeframe style preview of the | ||
// invalid code and the line/column at which the error occured. | ||
// ESLint shows those pieces of information elsewhere already so | ||
// remove them from the message | ||
if (err.codeFrame) { | ||
message = message.replace(`\n${err.codeFrame}`, ''); | ||
} | ||
if (err.loc) { | ||
message = message.replace(/ \(\d+:\d+\)$/, ''); | ||
} | ||
context.report({ message, loc: err.loc }); | ||
return; | ||
} | ||
if (source !== prettierSource) { | ||
@@ -215,0 +248,0 @@ const differences = generateDifferences(source, prettierSource); |
{ | ||
"name": "eslint-plugin-prettier", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Runs prettier as an eslint rule", | ||
@@ -42,8 +42,8 @@ "keywords": [ | ||
"eslint-config-prettier": "^3.1.0", | ||
"eslint-plugin-eslint-plugin": "^1.4.0", | ||
"eslint-plugin-node": "^7.0.1", | ||
"eslint-plugin-eslint-plugin": "^2.0.0", | ||
"eslint-plugin-node": "^8.0.0", | ||
"eslint-plugin-self": "^1.1.0", | ||
"mocha": "^5.2.0", | ||
"prettier": "^1.13.0", | ||
"vue-eslint-parser": "^3.2.2" | ||
"prettier": "^1.15.3", | ||
"vue-eslint-parser": "^4.0.2" | ||
}, | ||
@@ -50,0 +50,0 @@ "engines": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30658
252