You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[`parserOptions`] has the same properties as what [espree](https://github.com/eslint/espree#usage), the default parser of ESLint, is supporting.
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.
154
129
155
130
For example in `eslint.config.js`:
@@ -183,32 +158,6 @@ export default [
183
158
];
184
159
```
185
160
186
-
For example in `.eslintrc.*`:
187
-
188
-
```js
189
-
module.exports= {
190
-
// ...
191
-
parser:"@typescript-eslint/parser",
192
-
parserOptions: {
193
-
// ...
194
-
project:"path/to/your/tsconfig.json",
195
-
extraFileExtensions: [".svelte"], // This is a required setting in `@typescript-eslint/parser` v4.24.0.
196
-
},
197
-
overrides: [
198
-
{
199
-
files: ["*.svelte"],
200
-
parser:"svelte-eslint-parser",
201
-
// Parse the `<script>` in `.svelte` as TypeScript by adding the following configuration.
202
-
parserOptions: {
203
-
parser:"@typescript-eslint/parser",
204
-
},
205
-
},
206
-
// ...
207
-
],
208
-
// ...
209
-
};
210
-
```
211
-
212
161
#### Multiple parsers
213
162
214
163
If you want to switch the parser for each lang, specify the object.
@@ -235,21 +184,6 @@ export default [
235
184
];
236
185
```
237
186
238
-
For example in `.eslintrc.*`:
239
-
240
-
```json
241
-
{
242
-
"parser": "svelte-eslint-parser",
243
-
"parserOptions": {
244
-
"parser": {
245
-
"ts": "@typescript-eslint/parser",
246
-
"js": "espree",
247
-
"typescript": "@typescript-eslint/parser"
248
-
}
249
-
}
250
-
}
251
-
```
252
-
253
187
### parserOptions.svelteConfig
254
188
255
189
If you are using `eslint.config.js`, you can provide a `svelte.config.js` in the `parserOptions.svelteConfig` property.
@@ -289,8 +223,6 @@ export default [
289
223
parser: svelteParser,
290
224
parserOptions: {
291
225
svelteFeatures: {
292
-
/* -- Experimental Svelte Features -- */
293
-
/* It may be changed or removed in minor versions without notice. */
294
226
// This option is for Svelte 5. The default value is `true`.
295
227
// If `false`, ESLint will not recognize rune symbols.
296
228
// If not configured this option, The parser will try to read the option from `compilerOptions.runes` from `svelte.config.js`.
@@ -303,29 +235,8 @@ export default [
303
235
];
304
236
```
305
237
306
-
For example in `.eslintrc.*`:
307
-
308
-
```jsonc
309
-
{
310
-
"parser":"svelte-eslint-parser",
311
-
"parserOptions": {
312
-
"svelteFeatures": {
313
-
/* -- Experimental Svelte Features -- */
314
-
/* It may be changed or removed in minor versions without notice. */
315
-
// This option is for Svelte 5. The default value is `true`.
316
-
// If `false`, ESLint will not recognize rune symbols.
317
-
// If not configured this option, The parser will try to read the option from `compilerOptions.runes` from `svelte.config.js`.
318
-
// If `parserOptions.svelteConfig` is not specified and the file cannot be parsed by static analysis, it will behave as `true`.
319
-
"runes":true,
320
-
},
321
-
},
322
-
}
323
-
```
324
-
325
238
### Runes support
326
239
327
-
**_This is an experimental feature. It may be changed or removed in minor versions without notice._**
328
-
329
240
If you install Svelte v5 the parser will be able to parse runes, and will also be able to parse `*.js` and `*.ts` files.
330
241
If you don't want to use Runes, you may need to configure. Please read [parserOptions.svelteFeatures](#parseroptionssveltefeatures) for more details.
331
242
@@ -371,38 +282,6 @@ export default [
371
282
];
372
283
```
373
284
374
-
For example in `.eslintrc.*`:
375
-
376
-
```jsonc
377
-
{
378
-
"overrides": [
379
-
{
380
-
"files": ["*.svelte"],
381
-
"parser":"svelte-eslint-parser",
382
-
"parserOptions": {
383
-
"parser":"...",
384
-
/* ... */
385
-
},
386
-
},
387
-
{
388
-
"files": ["*.svelte.js"],
389
-
"parser":"svelte-eslint-parser",
390
-
"parserOptions": {
391
-
/* ... */
392
-
},
393
-
},
394
-
{
395
-
"files": ["*.svelte.ts"],
396
-
"parser":"svelte-eslint-parser",
397
-
"parserOptions": {
398
-
"parser":"...(ts parser)...",
399
-
/* ... */
400
-
},
401
-
},
402
-
],
403
-
}
404
-
```
405
-
406
285
## :computer: Editor Integrations
407
286
408
287
### Visual Studio Code
@@ -441,4 +320,3 @@ See the [LICENSE](LICENSE) file for license rights and limitations (MIT).
0 commit comments