fix(linter): improve wildcard import parsing to allow full regex (#12877)

This commit is contained in:
Miroslav Jonaš 2022-10-28 16:00:24 +02:00 committed by GitHub
parent 6448274cf8
commit 758956d13d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -333,7 +333,8 @@ export function isDirectDependency(target: ProjectGraphExternalNode): boolean {
* @returns
*/
function parseImportWildcards(importDefinition: string): RegExp {
const mappedWildcards = importDefinition.split('*').join('.*');
// we replace all instances of `*`, `**..*` and `.*` with `.*`
const mappedWildcards = importDefinition.split(/(?:\.\*)|\*+/).join('.*');
return new RegExp(`^${new RegExp(mappedWildcards).source}$`);
}