44import typescriptEslint from '@typescript-eslint/eslint-plugin' ;
55import globals from 'globals' ;
66import tsParser from '@typescript-eslint/parser' ;
7- import parser from 'svelte-eslint-parser' ;
8- import path from 'node:path' ;
9- import { fileURLToPath } from 'node:url' ;
7+ import svelteParser from 'svelte-eslint-parser' ;
8+ import sveltePlugin from 'eslint-plugin-svelte' ;
109import js from '@eslint/js' ;
11- import { FlatCompat } from '@eslint/eslintrc' ;
12-
13- const __filename = fileURLToPath ( import . meta. url ) ;
14- const __dirname = path . dirname ( __filename ) ;
15- const compat = new FlatCompat ( {
16- baseDirectory : __dirname ,
17- recommendedConfig : js . configs . recommended ,
18- allConfig : js . configs . all ,
19- } ) ;
2010
2111export default [
2212 {
@@ -40,12 +30,11 @@ export default [
4030 'prisma/.fabbrica/index.ts' ,
4131 ] ,
4232 } ,
43- ...compat . extends (
44- 'eslint:recommended' ,
45- 'plugin:@typescript-eslint/recommended' ,
46- 'plugin:svelte/recommended' ,
47- 'prettier' ,
48- ) ,
33+ // Base JS rules first
34+ js . configs . recommended ,
35+ // Svelte rules override JS rules where appropriate (intentional)
36+ // This allows Svelte-specific handling of rules like no-undef, no-unused-vars
37+ ...sveltePlugin . configs [ 'flat/recommended' ] ,
4938 {
5039 plugins : {
5140 '@typescript-eslint' : typescriptEslint ,
@@ -55,6 +44,13 @@ export default [
5544 globals : {
5645 ...globals . browser ,
5746 ...globals . node ,
47+ // Add Svelte 5 runes as global variables
48+ $state : 'readonly' ,
49+ $derived : 'readonly' ,
50+ $effect : 'readonly' ,
51+ $props : 'readonly' ,
52+ $bindable : 'readonly' ,
53+ $inspect : 'readonly' ,
5854 } ,
5955
6056 parser : tsParser ,
@@ -74,15 +70,25 @@ export default [
7470 'ts-ignore' : false ,
7571 } ,
7672 ] ,
73+ // Add TypeScript ESLint rules manually
74+ '@typescript-eslint/no-unused-vars' : [ 'error' , { argsIgnorePattern : '^_' } ] ,
75+ '@typescript-eslint/no-explicit-any' : 'warn' ,
76+ // Disable some strict Svelte rules that are too aggressive
77+ 'svelte/require-each-key' : 'warn' ,
78+ 'svelte/no-useless-mustaches' : 'warn' ,
79+ 'svelte/prefer-writable-derived' : 'warn' , // New in 3.6.0 - prefer $derived over $state+$effect
80+ 'svelte/valid-prop-names-in-kit-pages' : 'warn' , // Allow props other than data/errors in pages
81+ 'no-unused-vars' : 'off' , // Use TypeScript version instead
82+ 'no-undef' : 'off' , // TypeScript handles this
7783 } ,
7884 } ,
7985 {
8086 files : [ '**/*.svelte' ] ,
8187
8288 languageOptions : {
83- parser : parser ,
84- ecmaVersion : 5 ,
85- sourceType : 'script' ,
89+ parser : svelteParser ,
90+ ecmaVersion : 'latest' , // ES2023+ features support
91+ sourceType : 'module' , // ESM import/export support
8692
8793 parserOptions : {
8894 parser : '@typescript-eslint/parser' ,
0 commit comments