File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,8 @@ const name = "no-unused-vars";
14
14
const meta = {
15
15
en : {
16
16
description : "All declared variables must be used at least once." ,
17
- howToFix : "Change the tag to something other than `<var>`." ,
17
+ howToFix :
18
+ "Change the tag to something other than `<var>` or add a `data-ignore-unused` attribute." ,
18
19
help : "See developer console." ,
19
20
} ,
20
21
} ;
@@ -45,9 +46,9 @@ function linterFunction(_, doc) {
45
46
elems . push ( varElem ) ;
46
47
}
47
48
48
- for ( const elems of varUsage . values ( ) ) {
49
- if ( elems . length === 1 ) {
50
- offendingElements . push ( elems [ 0 ] ) ;
49
+ for ( const vars of varUsage . values ( ) ) {
50
+ if ( vars . length === 1 && ! vars [ 0 ] . hasAttribute ( "data-ignore-unused" ) ) {
51
+ offendingElements . push ( vars [ 0 ] ) ;
51
52
}
52
53
}
53
54
}
You can’t perform that action at this time.
0 commit comments