Skip to content

Commit e75a776

Browse files
authored
chore: update eslint-plugin-svelte to v3 (#1095)
* chore: update eslint-plugin-svelte * fix: lint docs/**/*.svelte
1 parent 1644cd4 commit e75a776

File tree

6 files changed

+109
-40
lines changed

6 files changed

+109
-40
lines changed

Diff for: eslint.config.js

+11-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import markdown from 'eslint-plugin-markdown';
22
import globals from 'globals';
33
import n from 'eslint-plugin-n';
44
import svelteOrgEslintConfig from '@sveltejs/eslint-config';
5-
import svelteParser from 'svelte-eslint-parser';
65
export default [
76
{
87
name: 'local/ignores',
@@ -19,6 +18,17 @@ export default [
1918
]
2019
},
2120
...svelteOrgEslintConfig, // contains setup for svelte and typescript
21+
{
22+
name: 'local/typescript-parser-options',
23+
files: ['docs/*.md/*.svelte'],
24+
languageOptions: {
25+
parserOptions: {
26+
projectService: {
27+
allowDefaultProject: ['docs/*.md/*.svelte']
28+
}
29+
}
30+
}
31+
},
2232
n.configs['flat/recommended-module'],
2333
...markdown.configs.recommended,
2434
{
@@ -120,13 +130,6 @@ export default [
120130
'prefer-const': 'off' // this turns let foo = $derived into a const otherwise
121131
}
122132
},
123-
{
124-
name: 'local/svelte-runes-globals',
125-
files: ['**/*.svelte.js', '**/*.svelte.ts', '**/*.svelte.*.js', '**/*.svelte.*.ts'],
126-
languageOptions: {
127-
parser: svelteParser
128-
}
129-
},
130133
{
131134
name: 'local/markdown-codefences',
132135
files: ['**/*.md/*.js', '**/*.md/*.ts', '**/*.md/*.svelte'],

Diff for: package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"@eslint/eslintrc": "^3.3.0",
2828
"@eslint/js": "^9.21.0",
2929
"@stylistic/eslint-plugin-js": "^4.2.0",
30-
"@sveltejs/eslint-config": "8.1.0",
30+
"@sveltejs/eslint-config": "^8.2.0",
3131
"@svitejs/changesets-changelog-github-compact": "^1.2.0",
3232
"@types/fs-extra": "^11.0.4",
3333
"@types/node": "^22.13.9",
@@ -38,7 +38,7 @@
3838
"eslint-plugin-markdown": "^5.1.0",
3939
"eslint-plugin-n": "^17.16.2",
4040
"eslint-plugin-prettier": "^5.2.3",
41-
"eslint-plugin-svelte": "^2.46.1",
41+
"eslint-plugin-svelte": "^3.0.3",
4242
"execa": "^8.0.1",
4343
"fs-extra": "^11.3.0",
4444
"globals": "^15.15.0",

Diff for: packages/playground/big/jsconfig.json

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"compilerOptions": {
3+
"moduleResolution": "bundler",
4+
"target": "ESNext",
5+
"module": "ESNext",
6+
/**
7+
* svelte-preprocess cannot figure out whether you have
8+
* a value or a type, so tell TypeScript to enforce using
9+
* `import type` instead of `import` for Types.
10+
*/
11+
"verbatimModuleSyntax": true,
12+
"isolatedModules": true,
13+
"resolveJsonModule": true,
14+
/**
15+
* To have warnings / errors of the Svelte compiler at the
16+
* correct position, enable source maps by default.
17+
*/
18+
"sourceMap": true,
19+
"esModuleInterop": true,
20+
"skipLibCheck": true,
21+
/**
22+
* Typecheck JS in `.svelte` and `.js` files by default.
23+
* Disable this if you'd like to use dynamic types.
24+
*/
25+
"checkJs": true
26+
},
27+
/**
28+
* Use global.d.ts instead of compilerOptions.types
29+
* to avoid limiting type declarations.
30+
*/
31+
"include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.svelte"]
32+
}

Diff for: packages/playground/big/src/App.svelte

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
<nav>
1414
<h2>This is a huge app</h2>
1515
{#each Object.entries(pages) as [name, cmp] (cmp)}
16-
<a class="App-link" href on:click|preventDefault={go(cmp)}>{name.replace('_', ' ')}</a>
16+
<a class="App-link" href={`?page=${name}`} on:click|preventDefault={go(cmp)}
17+
>{name.replace('_', ' ')}</a
18+
>
1719
{/each}
1820
</nav>
1921

Diff for: packages/playground/kit-demo-app/src/routes/sverdle/+page.svelte

+4-2
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,11 @@
6767
const key = /** @type {HTMLButtonElement} */ (event.target).getAttribute('data-key');
6868
6969
if (key === 'backspace') {
70+
// eslint-disable-next-line svelte/no-reactive-reassign
7071
currentGuess = currentGuess.slice(0, -1);
7172
if (form?.badGuess) form.badGuess = false;
7273
} else if (currentGuess.length < 5) {
74+
// eslint-disable-next-line svelte/no-reactive-reassign
7375
currentGuess += key;
7476
}
7577
}
@@ -166,9 +168,9 @@
166168
back
167169
</button>
168170
169-
{#each ['qwertyuiop', 'asdfghjkl', 'zxcvbnm'] as row}
171+
{#each ['qwertyuiop', 'asdfghjkl', 'zxcvbnm'] as row (row)}
170172
<div class="row">
171-
{#each row as letter}
173+
{#each row as letter, index (index)}
172174
<button
173175
on:click|preventDefault={update}
174176
data-key={letter}

Diff for: pnpm-lock.yaml

+57-27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)