@@ -49,6 +49,12 @@ export default createRule('no-navigation-without-resolve', {
49
49
} ,
50
50
create ( context ) {
51
51
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
+
52
58
return {
53
59
Program ( ) {
54
60
const referenceTracker = new ReferenceTracker ( context . sourceCode . scopeManager . globalScope ! ) ;
@@ -58,12 +64,12 @@ export default createRule('no-navigation-without-resolve', {
58
64
pushState : pushStateCalls ,
59
65
replaceState : replaceStateCalls
60
66
} = extractFunctionCallReferences ( referenceTracker ) ;
61
- if ( context . options [ 0 ] ?. ignoreGoto !== true ) {
67
+ if ( ! ignoreGoto ) {
62
68
for ( const gotoCall of gotoCalls ) {
63
69
checkGotoCall ( context , gotoCall , resolveReferences ) ;
64
70
}
65
71
}
66
- if ( context . options [ 0 ] ?. ignorePushState !== true ) {
72
+ if ( ! ignorePushState ) {
67
73
for ( const pushStateCall of pushStateCalls ) {
68
74
checkShallowNavigationCall (
69
75
context ,
@@ -73,7 +79,7 @@ export default createRule('no-navigation-without-resolve', {
73
79
) ;
74
80
}
75
81
}
76
- if ( context . options [ 0 ] ?. ignoreReplaceState !== true ) {
82
+ if ( ! ignoreReplaceState ) {
77
83
for ( const replaceStateCall of replaceStateCalls ) {
78
84
checkShallowNavigationCall (
79
85
context ,
@@ -86,7 +92,7 @@ export default createRule('no-navigation-without-resolve', {
86
92
} ,
87
93
SvelteShorthandAttribute ( node ) {
88
94
if (
89
- context . options [ 0 ] ?. ignoreLinks === true ||
95
+ ignoreLinks ||
90
96
node . parent . parent . type !== 'SvelteElement' ||
91
97
node . parent . parent . kind !== 'html' ||
92
98
node . parent . parent . name . type !== 'SvelteName' ||
@@ -106,7 +112,7 @@ export default createRule('no-navigation-without-resolve', {
106
112
} ,
107
113
SvelteAttribute ( node ) {
108
114
if (
109
- context . options [ 0 ] ?. ignoreLinks === true ||
115
+ ignoreLinks ||
110
116
node . parent . parent . type !== 'SvelteElement' ||
111
117
node . parent . parent . kind !== 'html' ||
112
118
node . parent . parent . name . type !== 'SvelteName' ||
0 commit comments