File tree Expand file tree Collapse file tree 7 files changed +45
-2
lines changed
fixtures/integrations/prettier-plugin Expand file tree Collapse file tree 7 files changed +45
-2
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " svelte-eslint-parser " : patch
3+ ---
4+
5+ fix: compatibility with eslint-plugin-prettier
Original file line number Diff line number Diff line change @@ -10,8 +10,13 @@ export {
1010 type StyleContextSuccess ,
1111 type StyleContextUnknownLang ,
1212} from "./parser/index.js" ;
13- export * as meta from "./meta.js" ;
1413export { name } from "./meta.js" ;
14+ // If we use `export * as meta from "./meta.js"`,
15+ // the structuredClone performed by eslint-plugin-prettier will fail,
16+ // so we will need to re-export it as a plain object.
17+ // https://github.com/prettier/eslint-plugin-prettier/blob/b307125faeb58b6dbfd5d8812b2dffcfdc8358df/eslint-plugin-prettier.js#L199
18+ import * as metaModule from "./meta.js" ;
19+ export const meta = { ...metaModule } ;
1520export type { SvelteConfig } from "./svelte-config/index.js" ;
1621
1722export { AST , ParseError } ;
Original file line number Diff line number Diff line change 1+ module . exports = {
2+ plugins : [ "prettier-plugin-svelte" ] ,
3+ } ;
Original file line number Diff line number Diff line change 1+ <script >
2+ let value = " Hello" ;
3+ </script >
4+
5+ <div >{value }</div >
Original file line number Diff line number Diff line change 1+ []
Original file line number Diff line number Diff line change 1+ import type { Linter } from "eslint" ;
2+ import { generateParserOptions } from "../../../src/parser/test-utils.js" ;
3+ import prettier from "eslint-plugin-prettier" ;
4+ import * as parser from "../../../../src/index.js" ;
5+ import globals from "globals" ;
6+
7+ export function getConfig ( ) : Linter . Config {
8+ return {
9+ plugins : {
10+ prettier,
11+ } ,
12+ languageOptions : {
13+ parser,
14+ parserOptions : generateParserOptions ( ) ,
15+ globals : {
16+ ...globals . browser ,
17+ ...globals . es2021 ,
18+ } ,
19+ } ,
20+ rules : {
21+ "prettier/prettier" : "error" ,
22+ } ,
23+ } ;
24+ }
Original file line number Diff line number Diff line change @@ -9,6 +9,6 @@ const expectedMeta = {
99
1010describe ( "Test for meta object" , ( ) => {
1111 it ( "A parser should have a meta object." , ( ) => {
12- assert . deepStrictEqual ( { ... parser . meta } , expectedMeta ) ;
12+ assert . deepStrictEqual ( parser . meta , expectedMeta ) ;
1313 } ) ;
1414} ) ;
You can’t perform that action at this time.
0 commit comments