Skip to content

Commit e370871

Browse files
committed
fix(valid-compile): use compiler options if provided
1 parent 426cc10 commit e370871

File tree

6 files changed

+37
-0
lines changed

6 files changed

+37
-0
lines changed

.changeset/late-waves-wonder.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'eslint-plugin-svelte': patch
3+
---
4+
5+
fix(valid-compile): use compiler options if provided

packages/eslint-plugin-svelte/src/shared/svelte-compile-warns/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ function getWarningsFromCode(
407407
} {
408408
try {
409409
const result = compiler.compile(code, {
410+
...context.sourceCode.parserServices.svelteParseContext?.svelteConfig?.compilerOptions,
410411
generate: false,
411412
...(isCustomElement(context.sourceCode.ast) ? { customElement: true } : {})
412413
});
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"languageOptions": {
3+
"parserOptions": {
4+
"svelteConfig": {
5+
"compilerOptions": {
6+
"runes": true
7+
}
8+
}
9+
}
10+
}
11+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
- message: >-
2+
`count` is updated, but is not declared with `$state(...)`. Changing its
3+
value will not correctly trigger updates
4+
5+
https://svelte.dev/e/non_reactive_update(non_reactive_update)
6+
line: 2
7+
column: 6
8+
suggestions: null
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<script lang="ts">
2+
let count = 0;
3+
function increment() {
4+
count += 1;
5+
}
6+
</script>
7+
8+
{count}<br />
9+
<button onclick={increment} type="button">Increment</button>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"svelte": ">=5.0.0"
3+
}

0 commit comments

Comments
 (0)