|
1 | 1 | import prettier from 'eslint-config-prettier'; |
2 | | -import js from '@eslint/js'; |
3 | 2 | import { includeIgnoreFile } from '@eslint/compat'; |
| 3 | +import js from '@eslint/js'; |
4 | 4 | import svelte from 'eslint-plugin-svelte'; |
5 | 5 | import globals from 'globals'; |
6 | 6 | import { fileURLToPath } from 'node:url'; |
7 | 7 | import ts from 'typescript-eslint'; |
| 8 | +import svelteConfig from './svelte.config.js'; |
| 9 | + |
8 | 10 | const gitignorePath = fileURLToPath(new URL('./.gitignore', import.meta.url)); |
9 | 11 |
|
10 | 12 | export default ts.config( |
11 | 13 | includeIgnoreFile(gitignorePath), |
12 | 14 | js.configs.recommended, |
13 | 15 | ...ts.configs.recommended, |
14 | | - ...svelte.configs['flat/recommended'], |
| 16 | + ...svelte.configs.recommended, |
15 | 17 | prettier, |
16 | | - ...svelte.configs['flat/prettier'], |
| 18 | + ...svelte.configs.prettier, |
17 | 19 | { |
18 | 20 | languageOptions: { |
19 | | - globals: { |
20 | | - ...globals.browser, |
21 | | - ...globals.node |
22 | | - } |
| 21 | + globals: { ...globals.browser, ...globals.node } |
| 22 | + }, |
| 23 | + rules: { |
| 24 | + // typescript-eslint strongly recommend that you do not use the no-undef lint rule on TypeScript projects. |
| 25 | + // see: https://typescript-eslint.io/troubleshooting/faqs/eslint/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors |
| 26 | + 'no-undef': 'off' |
23 | 27 | } |
24 | 28 | }, |
25 | 29 | { |
26 | | - files: ['**/*.svelte'], |
27 | | - |
| 30 | + files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'], |
28 | 31 | languageOptions: { |
29 | 32 | parserOptions: { |
30 | | - parser: ts.parser |
| 33 | + projectService: true, |
| 34 | + extraFileExtensions: ['.svelte'], |
| 35 | + parser: ts.parser, |
| 36 | + svelteConfig |
31 | 37 | } |
32 | 38 | } |
33 | 39 | } |
|
0 commit comments