diff --git a/.changeset/perfect-goats-exercise.md b/.changeset/perfect-goats-exercise.md new file mode 100644 index 00000000..956f5838 --- /dev/null +++ b/.changeset/perfect-goats-exercise.md @@ -0,0 +1,5 @@ +--- +"svelte-eslint-parser": patch +--- + +fix: compatibility with eslint-plugin-prettier diff --git a/src/main.ts b/src/main.ts index c8227535..60bdec0a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -10,8 +10,13 @@ export { type StyleContextSuccess, type StyleContextUnknownLang, } from "./parser/index.js"; -export * as meta from "./meta.js"; export { name } from "./meta.js"; +// If we use `export * as meta from "./meta.js"`, +// the structuredClone performed by eslint-plugin-prettier will fail, +// so we will need to re-export it as a plain object. +// https://github.com/prettier/eslint-plugin-prettier/blob/b307125faeb58b6dbfd5d8812b2dffcfdc8358df/eslint-plugin-prettier.js#L199 +import * as metaModule from "./meta.js"; +export const meta = { ...metaModule }; export type { SvelteConfig } from "./svelte-config/index.js"; export { AST, ParseError }; diff --git a/tests/fixtures/integrations/prettier-plugin/prettier.config.cjs b/tests/fixtures/integrations/prettier-plugin/prettier.config.cjs new file mode 100644 index 00000000..74301b30 --- /dev/null +++ b/tests/fixtures/integrations/prettier-plugin/prettier.config.cjs @@ -0,0 +1,3 @@ +module.exports = { + plugins: ["prettier-plugin-svelte"], +}; diff --git a/tests/fixtures/integrations/prettier-plugin/x-input.svelte b/tests/fixtures/integrations/prettier-plugin/x-input.svelte new file mode 100644 index 00000000..d38c4896 --- /dev/null +++ b/tests/fixtures/integrations/prettier-plugin/x-input.svelte @@ -0,0 +1,5 @@ + + +