@@ -5,6 +5,7 @@ import { FindVariableContext } from '../utils/ast-utils.js';
55import { findVariable } from '../utils/ast-utils.js' ;
66import type { RuleContext } from '../types.js' ;
77import type { AST } from 'svelte-eslint-parser' ;
8+ import { type TSTools , getTypeScriptTools } from 'src/utils/ts-utils/index.js' ;
89
910export default createRule ( 'no-navigation-without-resolve' , {
1011 meta : {
@@ -48,6 +49,8 @@ export default createRule('no-navigation-without-resolve', {
4849 ]
4950 } ,
5051 create ( context ) {
52+ const tsTools = getTypeScriptTools ( context ) ;
53+
5154 let resolveReferences : Set < TSESTree . Identifier > = new Set < TSESTree . Identifier > ( ) ;
5255
5356 const ignoreGoto = context . options [ 0 ] ?. ignoreGoto ?? false ;
@@ -66,7 +69,7 @@ export default createRule('no-navigation-without-resolve', {
6669 } = extractFunctionCallReferences ( referenceTracker ) ;
6770 if ( ! ignoreGoto ) {
6871 for ( const gotoCall of gotoCalls ) {
69- checkGotoCall ( context , gotoCall , resolveReferences ) ;
72+ checkGotoCall ( context , gotoCall , resolveReferences , tsTools ) ;
7073 }
7174 }
7275 if ( ! ignorePushState ) {
@@ -75,6 +78,7 @@ export default createRule('no-navigation-without-resolve', {
7578 context ,
7679 pushStateCall ,
7780 resolveReferences ,
81+ tsTools ,
7882 'pushStateWithoutResolve'
7983 ) ;
8084 }
@@ -85,6 +89,7 @@ export default createRule('no-navigation-without-resolve', {
8589 context ,
8690 replaceStateCall ,
8791 resolveReferences ,
92+ tsTools ,
8893 'replaceStateWithoutResolve'
8994 ) ;
9095 }
@@ -185,7 +190,8 @@ function extractFunctionCallReferences(referenceTracker: ReferenceTracker): {
185190function checkGotoCall (
186191 context : RuleContext ,
187192 call : TSESTree . CallExpression ,
188- resolveReferences : Set < TSESTree . Identifier >
193+ resolveReferences : Set < TSESTree . Identifier > ,
194+ tsTools : TSTools | null
189195) : void {
190196 if (
191197 call . arguments . length > 0 &&
@@ -199,6 +205,7 @@ function checkShallowNavigationCall(
199205 context : RuleContext ,
200206 call : TSESTree . CallExpression ,
201207 resolveReferences : Set < TSESTree . Identifier > ,
208+ tsTools : TSTools | null ,
202209 messageId : string
203210) : void {
204211 if (
0 commit comments