Skip to content

Commit 1520305

Browse files
authored
Merge pull request github#15523 from erik-krogh/exclude-tagged
JS: exclude tagged template literals from `js/superfluous-trailing-arguments`
2 parents b2ee580 + 94b7bda commit 1520305

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

javascript/ql/src/LanguageFeatures/SpuriousArguments.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ class SpuriousArguments extends Expr {
4646

4747
SpuriousArguments() {
4848
this = invk.getArgument(maxArity(invk)).asExpr() and
49-
not invk.isIncomplete()
49+
not invk.isIncomplete() and
50+
not invk.getAstNode() instanceof TaggedTemplateExpr
5051
}
5152

5253
/**

javascript/ql/test/query-tests/LanguageFeatures/SpuriousArguments/tst.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,13 @@ function sum2() {
129129
}
130130

131131
// OK
132-
sum2(1, 2, 3);
132+
sum2(1, 2, 3);
133+
134+
const $ = function (x, arr) {
135+
console.log(x, arr);
136+
};
137+
138+
// OK
139+
async function tagThing(repoUrl, directory) {
140+
await $`git clone ${repoUrl} ${directory}`;
141+
}

0 commit comments

Comments
 (0)