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

Lines changed: 5 additions & 0 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 6 additions & 0 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy