Support for negated ignore patterns
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- tooling
Research direction
Start by locating tinyglobby’s handling of the ignore option and its existing globbing tests. Compare the requested negated-pattern example with current behavior, then define coverage for preserving excluded paths and restoring .yarn/patches/index.js; done means the shown input returns index.js and .yarn/patches/index.js.
Written by the indexing model from the issue text.
Description
Would be great to support negated patterns in the ignore option.
Use case: respect files like .gitignore (or others like .prettierignore etc) when globbing.
E.g. globby has the gitignore option which does the .gitignore reading, parsing and evaluation.
I wouldn't expect tinyglobby to include this feature (to read and parse such ignore files), but would be great to support negated ignore patterns so tinyglobby could be extended to support the use case.
The same has been requested in both node-glob and fast-glob, but neither of them currently supports it. Refs:
It would make migration more interesting for globby (with gitignore: true) users. Also I understand tinyglobby wants to stay tiny so feel free to reject!
Here's an example simplified use case to clarify things a bit. Let's say we want to glob all **/index.js files in a workspace that has this .gitignore:
.yarn/*
!.yarn/patches
...
And files:
.
├── index.js
└── .yarn
├── patches
│ └── index.js
└── index.js
After reading the .gitignore file(s) and converting the patterns the options look like this:
glob(["**/*.js"], {
dot: true,
ignore: ["**/.yarn/*", "!**/.yarn/patches/**"],
});
Expected result:
["index.js", ".yarn/patches/index.js"]
Just saying, for users to stuff it all into patterns argument directly is likely not a good idea. I think this doesn't and shouldn't work:
glob(["**/*.{js,ts}", "!.yarn", ".yarn/patches/**/*.{js,ts}"], { dot: true })
- Dominant language
- TypeScript
- Stars
- 544
- Forks
- 30
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from SuperchupuDev/tinyglobby
-
bug upstream
Difficulty 3/5 1-2 days Newbie friendliness 67/100
SuperchupuDev/tinyglobby#188 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 58/100
SuperchupuDev/tinyglobby#187 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
SuperchupuDev/tinyglobby#186 · 3 comments ·
-
Setting `onlyDirectories` to `true` results in a returned value with an additional trailing slash. Open
Difficulty 3/5 1-2 days Newbie friendliness 45/100
SuperchupuDev/tinyglobby#185 ·
-
upstream
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
SuperchupuDev/tinyglobby#182 · 2 comments · 2 reactions ·
All issues in SuperchupuDev/tinyglobby
Similar issues
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 76/100
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
vercel/react-tweet#225 ·