Comments (5)
Hi @yuri-scarbaci-lenio, this is by design, as this project follows bash, extglob, and globstar specs, which differ from gitignore specs in several ways, as you've pointed out.
Given that this is expected behavior, I'd be happy to keep this open to discuss ideas for adding gitignore support. Thoughts?
On a related note, I'm pretty sure I created a library that uses micromatch to create gitignore-compliant glob patterns. I'll try to see where that is, or if I even published it. All I could find was https://github.com/jonschlinkert/parse-gitignore, which only parses the files (I think).
from micromatch.
Created #245
from micromatch.
I think that if this is meant by design altering the scope of the project would be counter productive on the long run,
In my opinion the best thing would be just being as straightforward about this as possible,
as someone not familiar with the nuances of the difference between all the possible matching specs it has took me a lot of analysis and back and forth to even understand that syntax that looks so very similar can be interpreted in so many different way,
Since you are already mentioning comparison with similar matching libraries specifically, maybe adding a callout for this there in the comparison table
Feature | minimatch |
micromatch |
picomatch |
nanomatch |
extglob |
braces |
expand-brackets |
ignore |
---|---|---|---|---|---|---|---|---|
... | ||||||||
File system operations | - | - | - | - | - | - | - | - |
Support for gitIgnore specs | - | - | - | - | - | - | - | ✔ |
would help this, I can't imagine being the first one to get confused here :)
from micromatch.
as someone not familiar with the nuances of the difference between all the possible matching specs it has took me a lot of analysis and back and forth to even understand that syntax that looks so very similar can be interpreted in so many different way
As someone who is quite familiar with most of the matching specs, it took me forever to understand lol. I know exactly what you mean.
I can't imagine being the first one to get confused here :)
Don't be too hard on yourself, lol. I'm sure other people have asked, but even if they haven't, if you've spent enough time around my projects you'll know that I'm more confused than anyone.
maybe adding a callout for this there in the comparison table
That's a good idea. Instead of a table maybe we should just add a brief mention to the readme, probably in the section that mentions bash (I'm pretty sure that's on the readme but don't quote me, I can't look at the moment but I will in a little bit.). We could just say something like, "if you're looking for something to help with matching gitignore patterns, there are some important differences in behavior in how bash and gitignore... etc. etc."
I'd be happy to take a PR if you feel like writing something.
from micromatch.
I'd be happy to take a PR if you feel like writing something.
Sure, I will create a PR ASAP
Do you know what's the name of the specs
your libraries are matching?
For reference gitIgnore
is based on the fnmatch
specs as per
CLI man(ual)
git ignore : man 5 gitignore
GITIGNORE(5) Git Manual GITIGNORE(5)
NAME
gitignore - Specifies intentionally untracked files to ignore
specifically:
DESCRIPTION
[...]
Each line in a gitignore file specifies a pattern.
[...]
PATTERN FORMAT
[...]
See fnmatch(3) and the FNM_PATHNAME flag for a more detailed description.
https://man7.org/linux/man-pages/man3/fnmatch.3.html
--> https://man7.org/linux/man-pages/man7/glob.7.html
from micromatch.
Related Issues (20)
- Add a way to generate a glob from a file name HOT 1
- Basename breaks matching complex pattern HOT 2
- Will micromatch gradually phase out CJS support instead of abruptly (cf multimatch)? HOT 2
- Documentation incomplete for `scan`
- Alternatives in extglobs not matching correctly? HOT 5
- micromatch('.prettierrc.json', '**/*.json') => false HOT 3
- Image for sponsorships
- [BUG] Vulnerabilities Found in Micromatch and Braces HOT 2
- `micromatch.not` returns nothing if empty pattern list provided
- [BUG] Vulnerabilities Found in Micromatch and Braces HOT 38
- Question: Globstar and trailing slashes
- Inefficient Regular Expression Complexity vulnerability with High severity found HOT 6
- Negation style ignores dot option?
- High vulnerability in 'braces' dependency HOT 5
- CVE-2024-4067 and CVE-2024-4068 - Real vulnerabilities or just non-security bugs? HOT 5
- Behavior on Windows seems to have changed with v4.0.6. HOT 1
- Version 4.0.6 is no longer compatible with Node 8.6 HOT 7
- [CVE-2024-4067] Vulnerability detected in micromatch.braces() HOT 8
- What's the deal with 4.0.7? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from micromatch.