sonarjs/no-control-regex
eslint-plugin-sonarjs
No autofixRecommended
eslint.config.js
export default [
{
rules: {
"sonarjs/no-control-regex": "error",
},
},
];Regular expressions should not contain control characters
const pattern1 = /\x1a/;
const pattern2 = new RegExp('\x1a');const pattern1 = /\x20/;
const pattern2 = new RegExp('\x20');Examples from the ESLint documentation.
sonarjs/no-control-regex
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/no-control-regex": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Disallow control characters in regular expressions
Collection size and array length comparisons should make sense
Tests should not execute any code after "done()" is called
Lodash and Underscore.js debounced or throttled functions should not be recreated on every React render