File tree Expand file tree Collapse file tree 8 files changed +1371
-5
lines changed
tests/fixtures/parser/ast/svelte5/unknown-runes-mode Expand file tree Collapse file tree 8 files changed +1371
-5
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " svelte-eslint-parser " : patch
3+ ---
4+
5+ fix: resolve issues in Runes mode detection causing parser malfunctions
Original file line number Diff line number Diff line change @@ -191,7 +191,8 @@ export function analyzePropsScope(
191191 }
192192 }
193193 } else if ( node . type === "VariableDeclaration" ) {
194- if ( svelteParseContext . runes ) {
194+ // Process if not confirmed as non-Runes mode.
195+ if ( svelteParseContext . runes !== false ) {
195196 // Process for Svelte v5 Runes props. e.g. `let { x = $bindable() } = $props()`;
196197 for ( const decl of node . declarations ) {
197198 if (
Original file line number Diff line number Diff line change @@ -16,15 +16,17 @@ type Global =
1616export function getGlobalsForSvelte (
1717 svelteParseContext : SvelteParseContext ,
1818) : readonly Global [ ] {
19- if ( svelteParseContext . runes ) {
19+ // Process if not confirmed as non-Runes mode.
20+ if ( svelteParseContext . runes !== false ) {
2021 return [ ...globalsForSvelte , ...globalsForRunes ] ;
2122 }
2223 return globalsForSvelte ;
2324}
2425export function getGlobalsForSvelteScript (
2526 svelteParseContext : SvelteParseContext ,
2627) : readonly Global [ ] {
27- if ( svelteParseContext . runes ) {
28+ // Process if not confirmed as non-Runes mode.
29+ if ( svelteParseContext . runes !== false ) {
2830 return globalsForRunes ;
2931 }
3032 return [ ] ;
Original file line number Diff line number Diff line change @@ -377,7 +377,10 @@ function analyzeRuneVariables(
377377 ctx : VirtualTypeScriptContext ,
378378 svelteParseContext : SvelteParseContext ,
379379) {
380- if ( ! svelteParseContext . runes ) return ;
380+ // No processing is needed if the user is determined not to be in Runes mode.
381+ if ( svelteParseContext . runes === false ) {
382+ return ;
383+ }
381384 const scopeManager = result . scopeManager ;
382385 for ( const globalName of globalsForRunes ) {
383386 if (
@@ -583,7 +586,8 @@ function* analyzeDollarDerivedScopes(
583586 result : TSESParseForESLintResult ,
584587 svelteParseContext : SvelteParseContext ,
585588) : Iterable < TransformInfo > {
586- if ( ! svelteParseContext . runes ) return ;
589+ // No processing is needed if the user is determined not to be in Runes mode.
590+ if ( svelteParseContext . runes === false ) return ;
587591 const scopeManager = result . scopeManager ;
588592 const derivedReferences = scopeManager . globalScope ! . through . filter (
589593 ( reference ) => reference . identifier . name === "$derived" ,
Original file line number Diff line number Diff line change 1+ <script >
2+ const { p } = $props ();
3+ </script >
4+
5+ <span >{p }</span >
You can’t perform that action at this time.
0 commit comments