@@ -49,6 +49,12 @@ export default createRule('no-navigation-without-resolve', {
4949 } ,
5050 create ( context ) {
5151 let resolveReferences : Set < TSESTree . Identifier > = new Set < TSESTree . Identifier > ( ) ;
52+
53+ const ignoreGoto = context . options [ 0 ] ?. ignoreGoto ?? false ;
54+ const ignorePushState = context . options [ 0 ] ?. ignorePushState ?? false ;
55+ const ignoreReplaceState = context . options [ 0 ] ?. ignoreReplaceState ?? false ;
56+ const ignoreLinks = context . options [ 0 ] ?. ignoreLinks ?? false ;
57+
5258 return {
5359 Program ( ) {
5460 const referenceTracker = new ReferenceTracker ( context . sourceCode . scopeManager . globalScope ! ) ;
@@ -58,12 +64,12 @@ export default createRule('no-navigation-without-resolve', {
5864 pushState : pushStateCalls ,
5965 replaceState : replaceStateCalls
6066 } = extractFunctionCallReferences ( referenceTracker ) ;
61- if ( context . options [ 0 ] ?. ignoreGoto !== true ) {
67+ if ( ! ignoreGoto ) {
6268 for ( const gotoCall of gotoCalls ) {
6369 checkGotoCall ( context , gotoCall , resolveReferences ) ;
6470 }
6571 }
66- if ( context . options [ 0 ] ?. ignorePushState !== true ) {
72+ if ( ! ignorePushState ) {
6773 for ( const pushStateCall of pushStateCalls ) {
6874 checkShallowNavigationCall (
6975 context ,
@@ -73,7 +79,7 @@ export default createRule('no-navigation-without-resolve', {
7379 ) ;
7480 }
7581 }
76- if ( context . options [ 0 ] ?. ignoreReplaceState !== true ) {
82+ if ( ! ignoreReplaceState ) {
7783 for ( const replaceStateCall of replaceStateCalls ) {
7884 checkShallowNavigationCall (
7985 context ,
@@ -86,7 +92,7 @@ export default createRule('no-navigation-without-resolve', {
8692 } ,
8793 SvelteShorthandAttribute ( node ) {
8894 if (
89- context . options [ 0 ] ?. ignoreLinks === true ||
95+ ignoreLinks ||
9096 node . parent . parent . type !== 'SvelteElement' ||
9197 node . parent . parent . kind !== 'html' ||
9298 node . parent . parent . name . type !== 'SvelteName' ||
@@ -106,7 +112,7 @@ export default createRule('no-navigation-without-resolve', {
106112 } ,
107113 SvelteAttribute ( node ) {
108114 if (
109- context . options [ 0 ] ?. ignoreLinks === true ||
115+ ignoreLinks ||
110116 node . parent . parent . type !== 'SvelteElement' ||
111117 node . parent . parent . kind !== 'html' ||
112118 node . parent . parent . name . type !== 'SvelteName' ||
0 commit comments