From d8b96fd76777f37613700602e456f114666dd1c4 Mon Sep 17 00:00:00 2001 From: Robert Rossmann Date: Wed, 15 Aug 2018 16:52:32 +0200 Subject: [PATCH] feat(rule): add require-unicode-regexp (warn) --- environments/shared/recommended.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/environments/shared/recommended.js b/environments/shared/recommended.js index 5f4eddc..2291025 100644 --- a/environments/shared/recommended.js +++ b/environments/shared/recommended.js @@ -611,6 +611,17 @@ module.exports = { // refactoring. 'require-await': 'warn', + // Enforce the use of u flag on RegExp + // RegExp u flag has two effects: + // - Make the regular expression handling UTF-16 surrogate pairs correctly + // - Make the regular expression throw syntax errors early by disabling Annex B extensions + // + // The u flag disables the recovering logic Annex B defined. As a result, you can find errors + // early. This is similar to the strict mode. Therefore, the u flag lets us work better with + // regular expressions. + // @TODO (semver-major): Raise to `error` + 'require-unicode-regexp': 'warn', + // Disallow generator functions that do not have yield 'require-yield': 'error',