Closed cherepanov closed 1 year ago
Right, I made an assumption all values of type string refer to predefined values, for the sake of simplicity. So currently there is no support for defining regexes as strings. Is there any specific reason you can't switch to a js based config? I am not opposed to adding this functionality though.
Well, we simply use json configs in monorepo, so we need to change coding standards and this change will effect too many files.
Why we can't do like this?
if (typeof value === 'string') {
let predefinedRegex = aliases[value];
if (predefinedRegex) {
return [predefinedRegex, value];
}
try {
return [new RegExp(value), value];
} catch (e) {}
throw new Error(`Unrecognized option "${value}"`);
}
Where should be check for predefined values, not for value type. Currently where is no way to specify regexp inside json-config.