New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Basename breaks matching complex pattern #230
Comments
From docs looks like basename matcher should not be used if pattern contains slashes.
And this actually matches minimatch bahavior. With filtered patterns I was able to pass prettier tests. const withSlashes = [];
const withoutSlashes = [];
for (const pattern of patternList) {
if (pattern.includes("/")) {
withSlashes.push(pattern);
} else {
withoutSlashes.push(pattern);
}
}
const result = micromatch.isMatch(filePath, withoutSlashes, {
ignore: excludedPatternList,
matchBase: true,
dot: true,
}) ||
micromatch.isMatch(filePath, withSlashes, {
ignore: excludedPatternList,
matchBase: false,
dot: true,
}) |
Root issue seems to be micromatch/picomatch#89. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(Thanks for reporting an issue to micromatch! If you haven't already read the contributor guidelines, Please do that now, then proceed to fill out the details below.)
Please describe the minimum necessary steps to reproduce this issue:
Hi, I tried to use micromatch for prettier I got a failed test with this case
I wasn't able to make it work with absolute path as well
What is happening that shouldn't be?
Correct pattern doesn't work with basename: true
What should be happening instead?
It should match. But I'm not sure. Works with minimatch.
The text was updated successfully, but these errors were encountered: