File tree 7 files changed +45
-2
lines changed
fixtures/integrations/prettier-plugin
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 {
10
10
type StyleContextSuccess ,
11
11
type StyleContextUnknownLang ,
12
12
} from "./parser/index.js" ;
13
- export * as meta from "./meta.js" ;
14
13
export { 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 } ;
15
20
export type { SvelteConfig } from "./svelte-config/index.js" ;
16
21
17
22
export { 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 = {
9
9
10
10
describe ( "Test for meta object" , ( ) => {
11
11
it ( "A parser should have a meta object." , ( ) => {
12
- assert . deepStrictEqual ( { ... parser . meta } , expectedMeta ) ;
12
+ assert . deepStrictEqual ( parser . meta , expectedMeta ) ;
13
13
} ) ;
14
14
} ) ;
You can’t perform that action at this time.
0 commit comments