Fix test cases to work with Semgrep constant propagation
Semgrep will propagate string constants, so we must use actual variables or user input to trigger rules that detect such
For example, eslint.detect-non-literal-regexp has the following definition
patterns:
- pattern: |
new RegExp(...)
- pattern-not: |
new RegExp("...", ...)
To see this rule fire, we must change the test case from
var myregexpText = "/abcd/";
var myregexp = new RegExp(myregexpText);
to
function dangerous_regexp(myregexpText) {
var myregexp = new RegExp(myregexpText);
}