Closed duniul closed 3 years ago
I think I know what's causing it, but I'll double check with the sandbox, thanks for doing that!
edit: in your code snippet here, you are using micromatch in the mini
(minimatch) example. Do you want to update that first so we can see what the behavior is for minimatch?
The pattern !(*.d).ts
should should not match (or negate) file.d.something.ts
since there is a segment between d
and .js
. There needs to be another *.
there somewhere, probably as a second condition in the parens. I'll play around with it and see what works.
fwiw I'm still playing around with the sandbox, I think that there might be a bug here. I'll report back when I'm finished looking into it.
in your code snippet here, you are using micromatch in the mini (minimatch) example. Do you want to update that first so we can see what the behavior is for minimatch?
@jonschlinkert Oops, incorrectly edited the example to make it more readable. I've cleaned it up now, the results are the same though (minimatch shows one result, picomatch and micromatch another).
Incredibly fast response, thanks a lot 🙌
The pattern !(.d).ts should should not match (or negate) file.d.something.ts since there is a segment between d and .js. There needs to be another . there somewhere, probably as a second condition in the parens.
Exactly, out of the paths in the example only file.d.ts
should be excluded.
Thanks for a great library and apologies in advance if this has been adressed somewhere else! 🙏
Issue
I'm trying to match a pattern that matches all
*.ts
files except*.d.ts
, and while it works most of the time it does not seem to work if whatever pattern you're negating is used anywhere else in the path.The glob
**/!(*.d).ts
should work for this case, but with picomatch and micromatch it excludes any file name that contains.d
at all, not just at the end. With minimatch and other globbing tools it works as expected.Example
I also created a CodeSandbox with an example for testing any glob (see the console output).