mirror of
https://github.com/Jeuners/ECC.git
synced 2026-09-09 15:02:30 +02:00
fix(gateguard): drop \x00 placeholder in glob-to-regex (eslint no-control-regex) (#2439)
Replace the NUL-byte '**' placeholder trick with split('**')/join('.*'),
which is semantically identical and lint-clean under eslint 10.
This commit is contained in:
parent
0a35a0216b
commit
3167852753
1 changed files with 3 additions and 4 deletions
|
|
@ -116,10 +116,9 @@ function getExemptMatchers() {
|
|||
.map(glob => {
|
||||
const source = glob
|
||||
.replace(/[.+^${}()|[\]\\]/g, '\\$&') // escape regex metachars, keep * and ?
|
||||
.replace(/\*\*/g, '\x00') // ** placeholder (cross-segment)
|
||||
.replace(/\*/g, '[^/]*') // * -> within a segment
|
||||
.replace(/\x00/g, '.*') // ** -> across segments
|
||||
.replace(/\?/g, '.');
|
||||
.split('**') // ** boundaries (cross-segment)
|
||||
.map(part => part.replace(/\*/g, '[^/]*').replace(/\?/g, '.'))
|
||||
.join('.*'); // ** -> across segments
|
||||
try {
|
||||
return new RegExp(source);
|
||||
} catch (_) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue