Skip to content

Commit b8230a0

Browse files
committed
fix(prefer-const): remove state.raw check
1 parent 86ca1c8 commit b8230a0

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

packages/eslint-plugin-svelte/src/rules/prefer-const.ts

-7
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,6 @@ function shouldSkipDeclaration(declaration: TSESTree.Expression | null) {
4646
) {
4747
return true;
4848
}
49-
if (
50-
callee.object.name === '$state' &&
51-
callee.property.type === 'Identifier' &&
52-
callee.property.name === 'raw'
53-
) {
54-
return true;
55-
}
5649

5750
return false;
5851
}

packages/eslint-plugin-svelte/tests/fixtures/rules/prefer-const/invalid/test01-errors.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
line: 4
77
column: 6
88
suggestions: null
9+
- message: "'raw' is never reassigned. Use 'const' instead."
10+
line: 5
11+
column: 6
12+
suggestions: null
913
- message: "'doubled' is never reassigned. Use 'const' instead."
1014
line: 6
1115
column: 6

packages/eslint-plugin-svelte/tests/fixtures/rules/prefer-const/invalid/test01-output.svelte

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
let { prop1, prop2 } = $props();
33
const zero = 0;
44
const state = $state(0);
5-
let raw = $state.raw(0);
5+
const raw = $state.raw(0);
66
const doubled = state * 2;
77
let derived = $derived(state * 2);
88
const calculated = calc();

0 commit comments

Comments
 (0)