File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
packages/eslint-plugin-svelte/src/shared/svelte-compile-warns Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import type { IgnoreItem } from './ignore-comment.js';
1515import { getSvelteIgnoreItems } from './ignore-comment.js' ;
1616import { extractLeadingComments } from './extract-leading-comments.js' ;
1717import { findAttribute , getLangValue } from '../../utils/ast-utils.js' ;
18+ import { getSvelteVersion } from '../../utils/svelte-context.js' ;
1819import path from 'path' ;
1920import 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 } ) ;
You can’t perform that action at this time.
0 commit comments