@@ -15,8 +15,8 @@ import type { ReadonlyFlags } from "regexp-ast-analysis"
15
15
import {
16
16
hasSomeDescendant ,
17
17
toCache ,
18
- toCharSet ,
19
18
getFirstCharAfter ,
19
+ toUnicodeSet ,
20
20
} from "regexp-ast-analysis"
21
21
22
22
const UTF16_MAX = 0xffff
@@ -146,22 +146,18 @@ function isCompatibleCharLike(
146
146
flags : ReadonlyFlags ,
147
147
uFlags : ReadonlyFlags ,
148
148
) : boolean {
149
- // FIXME: TS Error
150
- // @ts -expect-error -- FIXME
151
- const cs = toCharSet ( char , flags )
149
+ const cs = toUnicodeSet ( char , flags )
152
150
if ( ! cs . isDisjointWith ( SURROGATES ) ) {
153
151
// If the character (class/set) contains high or low
154
152
// surrogates, then we won't be able to guarantee that the
155
153
// Unicode pattern will behave the same way.
156
154
return false
157
155
}
158
156
159
- // FIXME: TS Error
160
- // @ts -expect-error -- FIXME
161
- const uCs = toCharSet ( char , uFlags )
157
+ const uCs = toUnicodeSet ( char , uFlags )
162
158
163
159
// Compare the ranges.
164
- return rangeEqual ( cs . ranges , uCs . ranges )
160
+ return rangeEqual ( cs . chars . ranges , uCs . chars . ranges )
165
161
}
166
162
167
163
/**
@@ -203,23 +199,19 @@ function isCompatibleQuantifier(
203
199
return undefined
204
200
}
205
201
206
- // FIXME: TS Error
207
- // @ts -expect-error -- FIXME
208
- const cs = toCharSet ( q . element , flags )
202
+ const cs = toUnicodeSet ( q . element , flags )
209
203
if ( ! cs . isSupersetOf ( SURROGATES ) ) {
210
204
// failed condition 1
211
205
return false
212
206
}
213
207
214
- // FIXME: TS Error
215
- // @ts -expect-error -- FIXME
216
- const uCs = toCharSet ( q . element , uFlags )
208
+ const uCs = toUnicodeSet ( q . element , uFlags )
217
209
if ( ! uCs . isSupersetOf ( SURROGATES ) || ! uCs . isSupersetOf ( ASTRAL ) ) {
218
210
// failed condition 2
219
211
return false
220
212
}
221
213
222
- if ( ! rangeEqual ( cs . ranges , uCs . without ( ASTRAL ) . ranges ) ) {
214
+ if ( ! rangeEqual ( cs . chars . ranges , uCs . without ( ASTRAL ) . chars . ranges ) ) {
223
215
// failed condition 3
224
216
return false
225
217
}
@@ -353,7 +345,7 @@ export default createRule("require-unicode-regexp", {
353
345
return { }
354
346
}
355
347
356
- if ( ! flags . unicode ) {
348
+ if ( ! flags . unicode && ! flags . unicodeSets ) {
357
349
context . report ( {
358
350
node,
359
351
loc : getFlagsLocation ( ) ,
0 commit comments