File tree 1 file changed +10
-10
lines changed
packages/eslint-plugin/src/rules
1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -579,16 +579,6 @@ export default createRule<Options, MessageIds>({
579
579
for ( const unusedVar of unusedVars ) {
580
580
// Report the first declaration.
581
581
if ( unusedVar . defs . length > 0 ) {
582
- const writeReferences = unusedVar . references . filter (
583
- ref =>
584
- ref . isWrite ( ) &&
585
- ref . from . variableScope === unusedVar . scope . variableScope ,
586
- ) ;
587
-
588
- const id = writeReferences . length
589
- ? writeReferences [ writeReferences . length - 1 ] . identifier
590
- : unusedVar . identifiers [ 0 ] ;
591
-
592
582
const usedOnlyAsType = unusedVar . references . some ( ref =>
593
583
referenceContainsTypeQuery ( ref . identifier ) ,
594
584
) ;
@@ -602,6 +592,16 @@ export default createRule<Options, MessageIds>({
602
592
continue ;
603
593
}
604
594
595
+ const writeReferences = unusedVar . references . filter (
596
+ ref =>
597
+ ref . isWrite ( ) &&
598
+ ref . from . variableScope === unusedVar . scope . variableScope ,
599
+ ) ;
600
+
601
+ const id = writeReferences . length
602
+ ? writeReferences [ writeReferences . length - 1 ] . identifier
603
+ : unusedVar . identifiers [ 0 ] ;
604
+
605
605
const messageId = usedOnlyAsType ? 'usedOnlyAsType' : 'unusedVar' ;
606
606
607
607
const { start } = id . loc ;
You can’t perform that action at this time.
0 commit comments