Skip to content

Commit 8350bb5

Browse files
authored
fix: incorrect runes inference when having empty compiler options (#561)
1 parent 10992fa commit 8350bb5

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

.changeset/late-poems-collect.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"svelte-eslint-parser": patch
3+
---
4+
5+
fix: incorrect runes inference when having empty compiler options

src/svelte-config/parser.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,15 @@ function parseSvelteConfigExpression(
6262
if (compilerOptions?.type === EvaluatedType.object) {
6363
result.compilerOptions = {};
6464
const runes = compilerOptions.getProperty("runes")?.getStatic();
65-
if (runes) {
65+
if (runes?.value != null) {
6666
result.compilerOptions.runes = Boolean(runes.value);
6767
}
6868
}
6969
const kit = evaluated.getProperty("kit");
7070
if (kit?.type === EvaluatedType.object) {
7171
result.kit = {};
7272
const files = kit.getProperty("files")?.getStatic();
73-
if (files) result.kit.files = files.value as never;
73+
if (files?.value != null) result.kit.files = files.value as never;
7474
}
7575
return result;
7676
}

tests/src/svelte-config/parser.ts

+6
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ describe("parseConfig", () => {
6060
`,
6161
output: { compilerOptions: { runes: true } },
6262
},
63+
{
64+
code: `
65+
export default {compilerOptions:{}}
66+
`,
67+
output: { compilerOptions: {} },
68+
},
6369
];
6470
for (const { code, output } of testCases) {
6571
it(code, () => {

0 commit comments

Comments
 (0)