| 1 | # es/no-regexp-unicode-property-escapes-2019 |
| 2 | > disallow the new values of RegExp Unicode property escape sequences in ES2019 |
| 3 | |
| 4 | - ✅ The following configurations enable this rule: `plugin:es/no-new-in-es2019`, `plugin:es/restrict-to-es3`, `plugin:es/restrict-to-es5`, `plugin:es/restrict-to-es2015`, `plugin:es/restrict-to-es2016`, `plugin:es/restrict-to-es2017`, and `plugin:es/restrict-to-es2018` |
| 5 | |
| 6 | This rule reports the new values of ES2018 [RegExp Unicode property escape sequences](https://github.com/tc39/proposal-regexp-unicode-property-escapes#readme) which were added in ES2019. |
| 7 | |
| 8 | For example, the following patterns are valid in ES2019, but syntax error in ES2018 environments: |
| 9 | |
| 10 | - `\p{Extended_Pictographic}` |
| 11 | - `\p{Script=Dogr}` |
| 12 | - `\p{Script=Dogra}` |
| 13 | - `\p{Script=Gong}` |
| 14 | - `\p{Script=Gunjala_Gondi}` |
| 15 | - `\p{Script=Hanifi_Rohingya}` |
| 16 | - `\p{Script=Maka}` |
| 17 | - `\p{Script=Makasar}` |
| 18 | - `\p{Script=Medefaidrin}` |
| 19 | - `\p{Script=Medf}` |
| 20 | - `\p{Script=Old_Sogdian}` |
| 21 | - `\p{Script=Rohg}` |
| 22 | - `\p{Script=Sogd}` |
| 23 | - `\p{Script=Sogdian}` |
| 24 | - `\p{Script=Sogo}` |
| 25 | |
| 26 | ## Examples |
| 27 | |
| 28 | ⛔ Examples of **incorrect** code for this rule: |
| 29 | |
| 30 | <eslint-playground type="bad" code="/*eslint es/no-regexp-unicode-property-escapes-2019: error */ |
| 31 | const r1 = /\p{Extended_Pictographic}/u |
| 32 | const r2 = /\p{Script=Dogr}/u |
| 33 | " /> |
| 34 | |
| 35 | ## 📚 References |
| 36 | |
| 37 | - [Rule source](https://github.com/mysticatea/eslint-plugin-es/blob/v4.1.0/lib/rules/no-regexp-unicode-property-escapes-2019.js) |
| 38 | - [Test source](https://github.com/mysticatea/eslint-plugin-es/blob/v4.1.0/tests/lib/rules/no-regexp-unicode-property-escapes-2019.js) |