Support njsscan-ignore above the current line
Closed this issue · 1 comments
I'm trying to ignore the following regex
if (!/^URU?/i.test(country)) {
which was reported as REGEX DOS by nodejsscan
However, due to eslint rules, I cannot add comments to the same line (after brackets) or else it throws formatting errors.
Invalid
if (!/^URU?/i.test(country)) { // njsscan-ignore: regex_dos
It would be nice if we could add the "njscan-ignore" line above the current line
// njsscan-ignore: regex_dos
if (!/^URU?/i.test(country)) {
I know eslint is another tool and I could just change the rules, but I've seen a lot of code analysis tools which support "above the line" rules.
Thanks!!
I think we cannot do that since we look for the ignore comment from match lines and the line above will not be present in the match. Another option is to define it below, but I am afraid this will break the logic if multiple findings are in consecutive lines.