Skip to content

Latest commit

 

History

History
56 lines (37 loc) · 1.38 KB

control-character-escape.md

File metadata and controls

56 lines (37 loc) · 1.38 KB
pageClass sidebarDepth title description since
rule-details
0
regexp/control-character-escape
enforce consistent escaping of control characters
v0.9.0

regexp/control-character-escape

💼 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

📖 Rule Details

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");

🔧 Options

Nothing.

🚀 Version

This rule was introduced in eslint-plugin-regexp v0.9.0

🔍 Implementation