@@ -184,7 +184,7 @@ const rule = {
184
184
// Get the current scope.
185
185
const scope = scopeManager . acquire ( node ) ;
186
186
if ( ! scope ) {
187
- return ;
187
+ throw new Error ( 'Unable to acquire scope for the current node.' ) ;
188
188
}
189
189
190
190
// Find all our "pure scopes". On every re-render of a component these
@@ -255,7 +255,7 @@ const rule = {
255
255
// Detect primitive constants
256
256
// const foo = 42
257
257
let declaration = defNode . parent ;
258
- if ( declaration == null && componentScope ) {
258
+ if ( declaration == null && componentScope != null ) {
259
259
// This might happen if variable is declared after the callback.
260
260
// In that case ESLint won't set up .parent refs.
261
261
// So we'll set them up manually.
@@ -266,7 +266,7 @@ const rule = {
266
266
}
267
267
}
268
268
if (
269
- declaration &&
269
+ declaration != null &&
270
270
'kind' in declaration &&
271
271
declaration . kind === 'const' &&
272
272
init . type === 'Literal' &&
@@ -454,7 +454,7 @@ const rule = {
454
454
function isInsideEffectCleanup ( reference : Scope . Reference ) : boolean {
455
455
let curScope : Scope . Scope | null = reference . from ;
456
456
let isInReturnedFunction = false ;
457
- while ( curScope && curScope . block !== node ) {
457
+ while ( curScope != null && curScope . block !== node ) {
458
458
if ( curScope . type === 'function' ) {
459
459
isInReturnedFunction =
460
460
curScope . block . parent != null &&
@@ -529,7 +529,7 @@ const rule = {
529
529
continue ;
530
530
}
531
531
// Ignore references to the function itself as it's not defined yet.
532
- if ( def . node && def . node . init === node . parent ) {
532
+ if ( def . node != null && def . node . init === node . parent ) {
533
533
continue ;
534
534
}
535
535
// Ignore Flow type parameters
@@ -660,7 +660,7 @@ const rule = {
660
660
}
661
661
662
662
let fnScope : Scope . Scope | null = reference . from ;
663
- while ( fnScope && fnScope . type !== 'function' ) {
663
+ while ( fnScope != null && fnScope . type !== 'function' ) {
664
664
fnScope = fnScope . upper ;
665
665
}
666
666
const isDirectlyInsideEffect = fnScope ?. block === node ;
0 commit comments