JS: whitelist js/unused-local-variable near direct eval calls

This commit is contained in:
Esben Sparre Andreasen
2018-10-30 07:55:13 +01:00
parent ce3b4a6400
commit 74642b9b81
2 changed files with 6 additions and 2 deletions

View File

@@ -156,6 +156,12 @@ predicate whitelisted(UnusedLocal v) {
isEnumMember(vd) or
// ignore ambient declarations - too noisy
vd.isAmbient()
) or
exists (DirectEval eval |
// eval nearby
eval.getEnclosingFunction() = v.getADeclaration().getEnclosingFunction() and
// ... but not on the RHS
not v.getAnAssignedExpr() = eval
)
}

View File

@@ -1,7 +1,5 @@
| decorated.ts:1:1:1:126 | import ... where'; | Unused import actionHandler. |
| decorated.ts:4:10:4:12 | fun | Unused function fun. |
| eval.js:2:9:2:20 | used_by_eval | Unused variable used_by_eval. |
| eval.js:7:9:7:20 | used_by_eval | Unused variable used_by_eval. |
| eval.js:10:9:10:24 | not_used_by_eval | Unused variable not_used_by_eval. |
| eval.js:19:9:19:24 | not_used_by_eval | Unused variable not_used_by_eval. |
| externs.js:6:5:6:13 | iAmUnused | Unused variable iAmUnused. |