Merge pull request #3441 from erik-krogh/BabelDirectives

Approved by esbena
This commit is contained in:
semmle-qlci
2020-05-12 08:57:20 +01:00
committed by GitHub
3 changed files with 8 additions and 1 deletions

View File

@@ -16,5 +16,7 @@ where
// ignore ":" pseudo-directive sometimes seen in dual-use shell/node.js scripts
not d.getExpr().getStringValue() = ":" and
// but exclude attribute top-levels: `<a href="javascript:'some-attribute-string'">`
not d.getParent() instanceof CodeInAttribute
not d.getParent() instanceof CodeInAttribute and
// exclude babel generated directives like "@babel/helpers - typeof".
not d.getDirectiveText().prefix(14) = "@babel/helpers"
select d, "Unknown directive: '" + truncate(d.getDirectiveText(), 20, " ... (truncated)") + "'."

View File

@@ -45,3 +45,7 @@ function yui() {
":nomunge"; // NOT OK
"foo(), bar, baz:nomunge"; // NOT OK
}
function babel_typeof(obj) {
"@babel/helpers - typeof"
}