no-invalid-regexp
NOTE: this rule is part of the
recommended
rule set.Enable full set in
deno.json
:{ "lint": { "rules": { "tags": ["recommended"] } } }
Enable full set using the Deno CLI:
deno lint --rules-tags=recommended
This rule can be explictly included to or excluded from the rules present in the current tag by adding it to the
include
or exclude
array in deno.json
:{ "lint": { "rules": { "include": ["no-invalid-regexp"], "exclude": ["no-invalid-regexp"] } } }
Disallows specifying invalid regular expressions in RegExp constructors.
Specifying an invalid regular expression literal will result in a SyntaxError at compile time, however specifying an invalid regular expression string in the RegExp constructor will only be discovered at runtime.
Invalid:
const invalidRegExp = new RegExp(")");
Valid:
const goodRegExp = new RegExp(".");