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:
Affaan Mustafa 2026-07-03 20:51:49 -07:00 committed by GitHub
parent 0a35a0216b
commit 3167852753
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 (_) {