Skip to content

Commit

Permalink
docs: update require-unicode-regexp.md as following up #17402 (#17441)
Browse files Browse the repository at this point in the history
* docs: add `further_reading` links

* docs: mention about `v`

* Update docs/src/rules/require-unicode-regexp.md

---------

Co-authored-by: Nicholas C. Zakas <nicholas@humanwhocodes.com>
  • Loading branch information
sosukesuzuki and nzakas committed Aug 2, 2023
1 parent 53d7508 commit 47a0859
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
14 changes: 14 additions & 0 deletions docs/src/_data/further_reading_links.json
Expand Up @@ -726,5 +726,19 @@
"logo": "https://v8.dev/favicon.ico",
"title": "Faster async functions and promises · V8",
"description": "Faster and easier-to-debug async functions and promises are coming to V8 v7.2 / Chrome 72."
},
"https://github.com/tc39/proposal-regexp-v-flag": {
"domain": "github.com",
"url": "https://github.com/tc39/proposal-regexp-v-flag",
"logo": "https://github.com/fluidicon.png",
"title": "GitHub - tc39/proposal-regexp-v-flag: UTS18 set notation in regular expressions",
"description": "UTS18 set notation in regular expressions. Contribute to tc39/proposal-regexp-v-flag development by creating an account on GitHub."
},
"https://v8.dev/features/regexp-v-flag": {
"domain": "v8.dev",
"url": "https://v8.dev/features/regexp-v-flag",
"logo": "https://v8.dev/favicon.ico",
"title": "RegExp v flag with set notation and properties of strings · V8",
"description": "The new RegExp `v` flag enables `unicodeSets` mode, unlocking support for extended character classes, including Unicode properties of strings, set notation, and improved case-insensitive matching."
}
}
9 changes: 5 additions & 4 deletions docs/src/rules/require-unicode-regexp.md
@@ -1,6 +1,9 @@
---
title: require-unicode-regexp
rule_type: suggestion
further_reading:
- https://github.com/tc39/proposal-regexp-v-flag
- https://v8.dev/features/regexp-v-flag
---


Expand Down Expand Up @@ -49,13 +52,11 @@ The RegExp `v` flag, introduced in ECMAScript 2024, is a superset of the `u` fla
re.test('\u2028'); // → false
```

Please see <https://github.com/tc39/proposal-regexp-v-flag> and <https://v8.dev/features/regexp-v-flag> for more details.

Therefore, the `u` and `v` flags let us work better with regular expressions.

## Rule Details

This rule aims to enforce the use of `u` flag on regular expressions.
This rule aims to enforce the use of `u` or `v` flag on regular expressions.

Examples of **incorrect** code for this rule:

Expand Down Expand Up @@ -99,4 +100,4 @@ function f(flags) {

## When Not To Use It

If you don't want to notify regular expressions with no `u` flag, then it's safe to disable this rule.
If you don't want to warn on regular expressions without either a `u` or a `v` flag, then it's safe to disable this rule.

0 comments on commit 47a0859

Please sign in to comment.