fix(config): normalize migrated package rule matchers#44452
fix(config): normalize migrated package rule matchers#44452jonathanmorley wants to merge 3 commits into
Conversation
RahulGautamSingh
left a comment
There was a problem hiding this comment.
Nice fix on the core bug, but I think the normalization pass is over-scoped.
The real defect is narrow:
The old migration wrapped match-all patterns as regexes (/*/, !/*/), and validation rejects those because they fail to compile.
The two-line fix in migratePattern / migrateExcludePattern (emit * and !** instead) resolves that completely, since both are globs and skip the regex check.
Everything in normalizeRegexOrGlobMatchers / normalizeMatchers and the supporting Sets and predicates only collapses combinations that already pass validation:
['*', '!/foo/'] to ['!/foo/']
['**', 'foo'] to ['**']
['!**', 'foo'] to ['!**']
None of those trigger a validation error, so none of it is needed to fix the reported issue.
|
I think there are two migration failures at play here, that are potentially getting conflated:
Without normalization, that becomes:
|
|
Can we fix this by adding a helper function which after migration checks the failing case ie. that * pattern is not combined with others? The current solution looks very bloated to me, and I don;t want it to be a maintenance issue in future. |
Changes
This addresses #43936.
In summary, the current matcher normalization causes some configurations to fail when evaluated against the recently tightened matcher validations.
This changes the normalization of matchers to comply with the new requirements.
Context
Please select one of the following:
AI assistance disclosure
Did you use AI tools to create any part of this pull request?
Please select one option and, if yes, briefly describe how AI was used (e.g., code, tests, docs) and which tool(s) you used.
Documentation (please check one with an [x])
How I've tested my work (please select one)
I have verified these changes via:
The public repository: