From 7fe039f3c1516c31dd35134be55f2baab02dd0f1 Mon Sep 17 00:00:00 2001 From: Krist Ponpairin Date: Sat, 7 Oct 2023 20:37:10 +0700 Subject: [PATCH 1/3] fix: parserPath type Compatibility with Eslint Flat Config. parserPath might be undefined it will fail on worker --- worker.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worker.js b/worker.js index 5e36ad6c..d29fa26c 100644 --- a/worker.js +++ b/worker.js @@ -2,7 +2,7 @@ /** * @typedef {import('prettier').FileInfoOptions} FileInfoOptions - * @typedef {import('prettier').Options & { onDiskFilepath: string, parserPath: string, usePrettierrc?: boolean }} Options + * @typedef {import('prettier').Options & { onDiskFilepath: string, parserPath?: string, usePrettierrc?: boolean }} Options */ const { runAsWorker } = require('synckit'); @@ -112,7 +112,7 @@ runAsWorker( // it could be processed by `@ota-meshi/eslint-plugin-svelte`, `eslint-plugin-svelte` or `eslint-plugin-svelte3` case 'svelte': { // The `source` would be modified by `eslint-plugin-svelte3` - if (!parserPath.includes('svelte-eslint-parser')) { + if (typeof parserPath === "string" && !parserPath.includes('svelte-eslint-parser')) { // We do not support `eslint-plugin-svelte3`, // the users should run `prettier` on `.svelte` files manually return; From 31a28046fe2652b24a40d4ceb595dea60e64b185 Mon Sep 17 00:00:00 2001 From: JounQin Date: Sat, 7 Oct 2023 23:23:34 +0800 Subject: [PATCH 2/3] Create thick-birds-share.md --- .changeset/thick-birds-share.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/thick-birds-share.md diff --git a/.changeset/thick-birds-share.md b/.changeset/thick-birds-share.md new file mode 100644 index 00000000..8293e14b --- /dev/null +++ b/.changeset/thick-birds-share.md @@ -0,0 +1,5 @@ +--- +"eslint-plugin-prettier": patch +--- + +fix: `parserPath` type might be `undefined` on Eslint Falt Config From 092a6dd514c0817c26b6ff02538db98e0749dbf7 Mon Sep 17 00:00:00 2001 From: Krist Ponpairin Date: Tue, 10 Oct 2023 19:19:53 +0700 Subject: [PATCH 3/3] chore: format --- worker.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/worker.js b/worker.js index d29fa26c..d4cadc05 100644 --- a/worker.js +++ b/worker.js @@ -112,7 +112,10 @@ runAsWorker( // it could be processed by `@ota-meshi/eslint-plugin-svelte`, `eslint-plugin-svelte` or `eslint-plugin-svelte3` case 'svelte': { // The `source` would be modified by `eslint-plugin-svelte3` - if (typeof parserPath === "string" && !parserPath.includes('svelte-eslint-parser')) { + if ( + typeof parserPath === 'string' && + !parserPath.includes('svelte-eslint-parser') + ) { // We do not support `eslint-plugin-svelte3`, // the users should run `prettier` on `.svelte` files manually return;