Skip to content

Commit 36b8e73

Browse files
Fix parseFlags (#571)
* Fix `parseFlags` * Create wicked-rules-rhyme.md
1 parent ac381bc commit 36b8e73

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

.changeset/wicked-rules-rhyme.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"eslint-plugin-regexp": patch
3+
---
4+
5+
Fix `parseFlags`

lib/utils/index.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,15 @@ type RegexpRule = ParsableRegexpRule & UnparsableRegexpRule
179179
const regexpRules = new WeakMap<ESTree.Program, RegexpRule[]>()
180180

181181
export const FLAG_GLOBAL = "g"
182-
export const FLAG_DOTALL = "s"
182+
export const FLAG_DOT_ALL = "s"
183+
export const FLAG_HAS_INDICES = "d"
183184
export const FLAG_IGNORECASE = "i"
184185
export const FLAG_MULTILINE = "m"
185186
export const FLAG_STICKY = "y"
186187
export const FLAG_UNICODE = "u"
188+
export const FLAG_UNICODE_SETS = "v"
187189

188-
const flagsCache = new Map<string, ReadonlyFlags>()
190+
const flagsCache = new Map<string, Required<ReadonlyFlags>>()
189191

190192
/**
191193
* Given some flags, this will return a parsed flags object.
@@ -196,12 +198,14 @@ export function parseFlags(flags: string): ReadonlyFlags {
196198
let cached = flagsCache.get(flags)
197199
if (cached === undefined) {
198200
cached = {
199-
dotAll: flags.includes(FLAG_DOTALL),
201+
dotAll: flags.includes(FLAG_DOT_ALL),
200202
global: flags.includes(FLAG_GLOBAL),
203+
hasIndices: flags.includes(FLAG_HAS_INDICES),
201204
ignoreCase: flags.includes(FLAG_IGNORECASE),
202205
multiline: flags.includes(FLAG_MULTILINE),
203206
sticky: flags.includes(FLAG_STICKY),
204207
unicode: flags.includes(FLAG_UNICODE),
208+
unicodeSets: flags.includes(FLAG_UNICODE_SETS),
205209
}
206210
flagsCache.set(flags, cached)
207211
}

0 commit comments

Comments
 (0)