File tree 2 files changed +34
-5
lines changed
tests/rules/no-unused-vars
2 files changed +34
-5
lines changed Original file line number Diff line number Diff line change @@ -426,9 +426,7 @@ function isMergableExported(variable: TSESLint.Scope.Variable): boolean {
426
426
* @returns True if the variable is exported, false if not.
427
427
*/
428
428
function isExported ( variable : TSESLint . Scope . Variable ) : boolean {
429
- const definition = variable . defs [ 0 ] ;
430
-
431
- if ( definition ) {
429
+ return variable . defs . some ( definition => {
432
430
let node = definition . node ;
433
431
434
432
if ( node . type === AST_NODE_TYPES . VariableDeclarator ) {
@@ -438,8 +436,7 @@ function isExported(variable: TSESLint.Scope.Variable): boolean {
438
436
}
439
437
440
438
return node . parent ! . type . indexOf ( 'Export' ) === 0 ;
441
- }
442
- return false ;
439
+ } ) ;
443
440
}
444
441
445
442
/**
Original file line number Diff line number Diff line change @@ -1080,6 +1080,18 @@ export class Foo {
1080
1080
typescript : '4.4' ,
1081
1081
} ,
1082
1082
} ,
1083
+ `
1084
+ interface Foo {
1085
+ bar: string;
1086
+ }
1087
+ export const Foo = 'bar';
1088
+ ` ,
1089
+ `
1090
+ export const Foo = 'bar';
1091
+ interface Foo {
1092
+ bar: string;
1093
+ }
1094
+ ` ,
1083
1095
] ,
1084
1096
1085
1097
invalid : [
@@ -1805,5 +1817,25 @@ x = foo(x);
1805
1817
} ,
1806
1818
] ,
1807
1819
} ,
1820
+ {
1821
+ code : `
1822
+ interface Foo {
1823
+ bar: string;
1824
+ }
1825
+ const Foo = 'bar';
1826
+ ` ,
1827
+ errors : [
1828
+ {
1829
+ messageId : 'unusedVar' ,
1830
+ line : 5 ,
1831
+ column : 7 ,
1832
+ data : {
1833
+ varName : 'Foo' ,
1834
+ action : 'assigned a value' ,
1835
+ additional : '' ,
1836
+ } ,
1837
+ } ,
1838
+ ] ,
1839
+ } ,
1808
1840
] ,
1809
1841
} ) ;
You can’t perform that action at this time.
0 commit comments