Skip to content

Commit a4f290b

Browse files
committed
fix
1 parent 9486c88 commit a4f290b

File tree

1 file changed

+10
-3
lines changed
  • packages/eslint-plugin-svelte/src/shared/svelte-compile-warns

1 file changed

+10
-3
lines changed

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import type { IgnoreItem } from './ignore-comment.js';
1515
import { getSvelteIgnoreItems } from './ignore-comment.js';
1616
import { extractLeadingComments } from './extract-leading-comments.js';
1717
import { findAttribute, getLangValue } from '../../utils/ast-utils.js';
18+
import { getSvelteVersion } from '../../utils/svelte-context.js';
1819
import path from 'path';
1920
import fs from 'fs';
2021

@@ -395,6 +396,8 @@ function isCustomElement(program: AST.SvelteProgram) {
395396
});
396397
}
397398

399+
const svelteVersion = getSvelteVersion();
400+
398401
/**
399402
* Get compile warnings
400403
*/
@@ -409,9 +412,13 @@ function getWarningsFromCode(
409412
const svelteConfig = context.sourceCode.parserServices.svelteParseContext?.svelteConfig;
410413
const compilerOptions = svelteConfig?.compilerOptions ?? {};
411414
const result = compiler.compile(code, {
412-
experimental: {
413-
async: compilerOptions.experimental?.async
414-
},
415+
...(svelteVersion === '5'
416+
? {
417+
experimental: {
418+
async: compilerOptions.experimental?.async
419+
}
420+
}
421+
: {}),
415422
generate: false,
416423
...(isCustomElement(context.sourceCode.ast) ? { customElement: true } : {})
417424
});

0 commit comments

Comments
 (0)