diff --git a/src/validator.ts b/src/validator.ts index 6417ab5..c6c9574 100644 --- a/src/validator.ts +++ b/src/validator.ts @@ -3569,7 +3569,7 @@ export class RegExpValidator { validFlags.add(LATIN_SMALL_LETTER_Y) if (this.ecmaVersion >= 2018) { validFlags.add(LATIN_SMALL_LETTER_S) - if (this.ecmaVersion >= 2021) { + if (this.ecmaVersion >= 2022) { validFlags.add(LATIN_SMALL_LETTER_D) if (this.ecmaVersion >= 2024) { validFlags.add(LATIN_SMALL_LETTER_V) diff --git a/test/fixtures/parser/literal/flags-2021.json b/test/fixtures/parser/literal/flags-2022.json similarity index 100% rename from test/fixtures/parser/literal/flags-2021.json rename to test/fixtures/parser/literal/flags-2022.json diff --git a/test/fixtures/parser/literal/flags-invalid-2017.json b/test/fixtures/parser/literal/flags-invalid-2017.json new file mode 100644 index 0000000..2dc3b9c --- /dev/null +++ b/test/fixtures/parser/literal/flags-invalid-2017.json @@ -0,0 +1,14 @@ +{ + "options": { + "strict": true, + "ecmaVersion": 2017 + }, + "patterns": { + "/./s": { + "error": { + "message": "Invalid regular expression: /./s: Invalid flag 's'", + "index": 3 + } + } + } +} \ No newline at end of file diff --git a/test/fixtures/parser/literal/flags-invalid-2021.json b/test/fixtures/parser/literal/flags-invalid-2021.json new file mode 100644 index 0000000..1b45ea2 --- /dev/null +++ b/test/fixtures/parser/literal/flags-invalid-2021.json @@ -0,0 +1,14 @@ +{ + "options": { + "strict": true, + "ecmaVersion": 2021 + }, + "patterns": { + "/./d": { + "error": { + "message": "Invalid regular expression: /./d: Invalid flag 'd'", + "index": 3 + } + } + } +} \ No newline at end of file diff --git a/test/fixtures/parser/literal/flags-invalid-2023.json b/test/fixtures/parser/literal/flags-invalid-2023.json new file mode 100644 index 0000000..d15f2ce --- /dev/null +++ b/test/fixtures/parser/literal/flags-invalid-2023.json @@ -0,0 +1,14 @@ +{ + "options": { + "strict": true, + "ecmaVersion": 2023 + }, + "patterns": { + "/./v": { + "error": { + "message": "Invalid regular expression: /./v: Invalid flag 'v'", + "index": 3 + } + } + } +} \ No newline at end of file diff --git a/test/fixtures/parser/literal/flags-invalid-5.json b/test/fixtures/parser/literal/flags-invalid-5.json new file mode 100644 index 0000000..72cec20 --- /dev/null +++ b/test/fixtures/parser/literal/flags-invalid-5.json @@ -0,0 +1,20 @@ +{ + "options": { + "strict": true, + "ecmaVersion": 5 + }, + "patterns": { + "/./u": { + "error": { + "message": "Invalid regular expression: /./u: Invalid flag 'u'", + "index": 3 + } + }, + "/./y": { + "error": { + "message": "Invalid regular expression: /./y: Invalid flag 'y'", + "index": 3 + } + } + } +} \ No newline at end of file