Skip to content

Commit 5e5aba4

Browse files
authored
Update README.md
1 parent addd440 commit 5e5aba4

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,32 @@ For example:
121121
}
122122
```
123123

124+
For example, if you are using the `"@typescript-eslint/parser"`, and if you want to use TypeScript in `<script>` of `.svelte`, you need to add more `parserOptions` configuration.
125+
126+
```js
127+
module.exports = {
128+
// ...
129+
parser: "@typescript-eslint/parser",
130+
parserOptions: {
131+
// ...
132+
project: "path/to/your/tsconfig.json",
133+
extraFileExtensions: [".svelte"], // This is a required setting in `@typescript-eslint/parser` v4.24.0.
134+
},
135+
overrides: [
136+
{
137+
files: ["*.svelte"],
138+
parser: "svelte-eslint-parser",
139+
// Parse the `<script>` in `.svelte` as TypeScript by adding the following configuration.
140+
parserOptions: {
141+
parser: "@typescript-eslint/parser",
142+
},
143+
},
144+
// ...
145+
],
146+
// ...
147+
}
148+
```
149+
124150
#### Multiple parsers
125151

126152
If you want to switch the parser for each lang, specify the object.

0 commit comments

Comments
 (0)