pageClass | sidebarDepth | title | description | since |
---|---|---|---|---|
rule-details |
0 |
regexp/control-character-escape |
enforce consistent escaping of control characters |
v0.9.0 |
💼 This rule is enabled in the ✅ plugin:regexp/recommended
config.
🔧 This rule is automatically fixable by the --fix
CLI option.
enforce consistent escaping of control characters
This rule reports control characters that were not escaped using a control escape (\0
, t
, \n
, \v
, f
, \r
).
/* eslint regexp/control-character-escape: "error" */
/* ✓ GOOD */
var foo = /[\n\r]/;
var foo = /\t/;
var foo = RegExp("\t+\n");
/* ✗ BAD */
var foo = / /;
var foo = /\u0009/;
var foo = /\u{a}/u;
var foo = RegExp("\\u000a");
Nothing.
This rule was introduced in eslint-plugin-regexp v0.9.0