Skip to content
This repository was archived by the owner on Mar 7, 2019. It is now read-only.

Commit d8b96fd

Browse files
feat(rule): add require-unicode-regexp (warn)
1 parent 2bb65c2 commit d8b96fd

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

environments/shared/recommended.js

+11
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,17 @@ module.exports = {
611611
// refactoring.
612612
'require-await': 'warn',
613613

614+
// Enforce the use of u flag on RegExp
615+
// RegExp u flag has two effects:
616+
// - Make the regular expression handling UTF-16 surrogate pairs correctly
617+
// - Make the regular expression throw syntax errors early by disabling Annex B extensions
618+
//
619+
// The u flag disables the recovering logic Annex B defined. As a result, you can find errors
620+
// early. This is similar to the strict mode. Therefore, the u flag lets us work better with
621+
// regular expressions.
622+
// @TODO (semver-major): Raise to `error`
623+
'require-unicode-regexp': 'warn',
624+
614625
// Disallow generator functions that do not have yield
615626
'require-yield': 'error',
616627

0 commit comments

Comments
 (0)