-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
feat: Add new negatedExtglob
state to result of scan
#79
Conversation
This allows consumers to see if the glob starts with a negated extglob similar to parse. At first I wondered if this should maybe set negated to true, but that might be a breaking change and also is then completely different from parse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! As you noted this does not catch negated extglobs when they are not the first thing in the glob. Perhaps we should also detect non-starting negated extglobs as well? Or we could change the flag name to negatedStartingExtglob
or something like that. Otherwise this might be misleading. Thoughts?
I tried to align the property with the state of |
Good point, and that reminds me that the point of this is feature detection, so it's okay to simply return Really nice work! Feel free to merge and publish. |
I will first try to propose a different change to jest, swapping |
Okay we went with |
This allows consumers to see if the glob starts with a negated extglob similar to parse.
At first I wondered if this should maybe set negated to true, but that might be a breaking change and also is then completely different from parse.
One example is jest which uses
scan
andmatcher
to mimic micromatchs main api. https://github.com/facebook/jest/blob/d49cb30fb2540efa8c451fb6cb24e8997284bc67/packages/jest-util/src/globsToMatcher.ts#L49-L52This makes it possible to solve this issue micromatch/micromatch#179 in jest as well as basically support all negated extglobs as non of them work correctly atm.