Skip to content

Commit c4852c9

Browse files
authored
fix: d should be invalid in ES2021 (#209)
1 parent 347b151 commit c4852c9

File tree

6 files changed

+63
-1
lines changed

6 files changed

+63
-1
lines changed

src/validator.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3569,7 +3569,7 @@ export class RegExpValidator {
35693569
validFlags.add(LATIN_SMALL_LETTER_Y)
35703570
if (this.ecmaVersion >= 2018) {
35713571
validFlags.add(LATIN_SMALL_LETTER_S)
3572-
if (this.ecmaVersion >= 2021) {
3572+
if (this.ecmaVersion >= 2022) {
35733573
validFlags.add(LATIN_SMALL_LETTER_D)
35743574
if (this.ecmaVersion >= 2024) {
35753575
validFlags.add(LATIN_SMALL_LETTER_V)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"options": {
3+
"strict": true,
4+
"ecmaVersion": 2017
5+
},
6+
"patterns": {
7+
"/./s": {
8+
"error": {
9+
"message": "Invalid regular expression: /./s: Invalid flag 's'",
10+
"index": 3
11+
}
12+
}
13+
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"options": {
3+
"strict": true,
4+
"ecmaVersion": 2021
5+
},
6+
"patterns": {
7+
"/./d": {
8+
"error": {
9+
"message": "Invalid regular expression: /./d: Invalid flag 'd'",
10+
"index": 3
11+
}
12+
}
13+
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"options": {
3+
"strict": true,
4+
"ecmaVersion": 2023
5+
},
6+
"patterns": {
7+
"/./v": {
8+
"error": {
9+
"message": "Invalid regular expression: /./v: Invalid flag 'v'",
10+
"index": 3
11+
}
12+
}
13+
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"options": {
3+
"strict": true,
4+
"ecmaVersion": 5
5+
},
6+
"patterns": {
7+
"/./u": {
8+
"error": {
9+
"message": "Invalid regular expression: /./u: Invalid flag 'u'",
10+
"index": 3
11+
}
12+
},
13+
"/./y": {
14+
"error": {
15+
"message": "Invalid regular expression: /./y: Invalid flag 'y'",
16+
"index": 3
17+
}
18+
}
19+
}
20+
}

0 commit comments

Comments
 (0)