sonarjs/no-invalid-regexp
eslint-plugin-sonarjs
No autofixRecommended
eslint.config.js
export default [
{
rules: {
"sonarjs/no-invalid-regexp": "error",
},
},
];Regular expressions should be syntactically valid
new RegExp("([");
str.match("([");new RegExp("\\(\\[");
str.match("\\(\\[");
str.replace("([", "{");Examples from the ESLint documentation.
sonarjs/no-invalid-regexp
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/no-invalid-regexp": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Disallow invalid regular expression strings in RegExp constructors
Inline snapshots should not contain interpolations