Skip to content

Commit 3a44584

Browse files
authored
Merge pull request #9695 from asgerf/js/unused-var-template-placeholder
JS: Fix unused variable FP in template placeholders
2 parents 381bcf7 + f5a19a1 commit 3a44584

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

javascript/ql/src/Declarations/UnusedVariable.ql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ predicate whitelisted(UnusedLocal v) {
165165
or
166166
// ignore ambient declarations - too noisy
167167
vd.isAmbient()
168+
or
169+
// ignore variables in template placeholders, as each placeholder sees a different copy of the variable
170+
vd.getTopLevel() instanceof Templating::TemplateTopLevel
168171
)
169172
or
170173
exists(Expr eval | eval instanceof DirectEval or eval instanceof GeneratedCodeExpr |

0 commit comments

Comments
 (0)