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 => {
|
.map(glob => {
|
||||||
const source = glob
|
const source = glob
|
||||||
.replace(/[.+^${}()|[\]\\]/g, '\\$&') // escape regex metachars, keep * and ?
|
.replace(/[.+^${}()|[\]\\]/g, '\\$&') // escape regex metachars, keep * and ?
|
||||||
.replace(/\*\*/g, '\x00') // ** placeholder (cross-segment)
|
.split('**') // ** boundaries (cross-segment)
|
||||||
.replace(/\*/g, '[^/]*') // * -> within a segment
|
.map(part => part.replace(/\*/g, '[^/]*').replace(/\?/g, '.'))
|
||||||
.replace(/\x00/g, '.*') // ** -> across segments
|
.join('.*'); // ** -> across segments
|
||||||
.replace(/\?/g, '.');
|
|
||||||
try {
|
try {
|
||||||
return new RegExp(source);
|
return new RegExp(source);
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue