Skip to content

Commit 9f55c49

Browse files
authored
Merge pull request #2198 from AtCoder-NoviSteps/#2197
💥 Bump eslint-plugin-svelte from 2.46.1 to 3.9.2 (#2197)
2 parents a6f67e2 + 60b024f commit 9f55c49

File tree

9 files changed

+71
-141
lines changed

9 files changed

+71
-141
lines changed

eslint.config.mjs

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,9 @@
44
import typescriptEslint from '@typescript-eslint/eslint-plugin';
55
import globals from 'globals';
66
import 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';
109
import 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

2111
export 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',

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"@vitest/ui": "3.2.4",
4747
"eslint": "9.29.0",
4848
"eslint-config-prettier": "10.1.5",
49-
"eslint-plugin-svelte": "2.46.1",
49+
"eslint-plugin-svelte": "3.9.2",
5050
"globals": "16.2.0",
5151
"husky": "9.1.7",
5252
"jsdom": "26.1.0",

0 commit comments

Comments
 (0)