Comments (16)
Another issue about this functionality — #356.
Unfortunately, I could not come up with a decent algorithm that allowed me to implement this functionality without completely rewriting the pattern-matching mechanism when reading in depth.
I will try again later, after the major release of this package. Most likely, it's time to reconsider the approach to how we process patterns in the pattern manager and their further application to directories.
I cannot promise any specific dates.
from fast-glob.
@mrmlnc, I too have a situation where we want to use negative ignore patterns to allow certain files to be included in the output, which would otherwise, be excluded due to other ignore patterns. Would be great to see some progress on this!
from fast-glob.
Hello, @evilebottnawi,
You really want to use negative patterns in the ignore
property? Right now you can use positive patterns instead of negative and it's works fine.
from fast-glob.
@mrmlnc yes, i have tool which check file contents with extension and report if something wrong, i want get all files exclude some extensions which i don't support. Also '**/*'
pattern can be configured by users (i.e. images/**/*
).
from fast-glob.
Sounds like a feature request.
JFYI: Right now you can use the following work around:
const fg = require('fast-glob');
await fg(['**/*'], {
absolute: true,
dot: true,
ignore: ['{**/*,*}.txt'], // without !
onlyFiles: true
})
from fast-glob.
Just one question:
Why you use the
{**/*,*}
pattern instead of just a**/*
?
As I know, **/*
involve *
and can be interpreted as «entries with txt
extension on any nesting level».
from fast-glob.
@mrmlnc yes, any nesting levels. For me it was breaking change, because node-glob
support this behavior by default. Workaround glob all files except *.txt
, i need vice versa logic.
from fast-glob.
I think this feature related to xojs/xo#65 issue.
from fast-glob.
@reklatsmasters, I think these things are different. Based on the description of this issue – we just want to allow the use !
in the ignore
option.
from fast-glob.
@reklatsmasters @mrmlnc yep, difference
from fast-glob.
@mrmlnc problem still exists. Example usage https://github.com/itgalaxy/file-type-lint/blob/master/src/standalone.js#L65
.
patterns
- {**/*,*}.*
from fast-glob.
@evilebottnawi, you can provide real case with FS structure (ls -R
or tree
) and actual/expected results?
from fast-glob.
@mrmlnc https://github.com/itgalaxy/file-type-lint/tree/master/src/__tests__/fixtures
Using {**/*,*}.*
and "ignore: [!{**/*,*}.{svg,jpg,xml,yarml}
]" should get all valid*.*
files exclude valid.bar
and nested/valid.bar
from fast-glob.
So, look like misunderstanding in the issue description :)
I just let you use the negative patterns in the ignore
option.
from fast-glob.
@mrmlnc Are there any news here? This feature would fix a problem with exclude
option in https://github.com/bmewburn/vscode-intelephense (it uses the ignore
option of fs-glob).
Use case:
- intelephense should scan all PHP files in a project directory
- it should exclude any
tests
directory belowvendor
, so it has a default"**/vendor/**/{Tests,tests}/**",
asexclude
(=fast-globignore
) option - it should not exclude a specific
**/vendor/abc/tests
directory, so a developer can add"!**/vendor/abc/tests"
toexclude
So the full ignore
patterns used with fast-glob are:
[
"**/vendor/**/{Tests,tests}/**",
"!**/vendor/abc/tests"
]
Without this feature we'd have to list all vendor/xyz/tests
directory instead of using vendor/**/tests
.
from fast-glob.
Negated patterns would be really nice for a package.json npm script like this:
"format:check:ci:non-ts": "yarn prettier --check '**/*.{js,jsx,ts,tsx,mjs,cjs,mts,cts}'"
This helps ensure prettier format check is comprehensive, but doesn't repeat what eslint may already be checking.
from fast-glob.
Related Issues (20)
- The `fixtures/{first,}/*` pattern returns incorrect results HOT 2
- Release v3.3.0 [xx.06.2023] HOT 1
- Provide `glob`, `globSync` and `globSteam` aliases HOT 1
- `glob` method errors in the latest release HOT 1
- TypeError: patterns.reduce is not a function HOT 10
- Breaking changes in v3.3.0 HOT 1
- Type definitions erroneously disallow passing an explicitly readonly array of strings HOT 1
- Use `os.availableParallelism` instead of `os.cpus().length` when available HOT 1
- Merging DEFAULT_FILE_SYSTEM_ADAPTER to fs HOT 4
- Regression in v3.3.1 HOT 3
- Case sensitive file paths are returned as potentially the wrong case when using WSL with window's paths HOT 1
- Inconsistent File Format Handling Between Windows and POSIX in fast-glob HOT 7
- Unable to match correctly HOT 1
- fast glob ramdisk issue
- [doc] what is the behaviour of passing an array of patterns?
- Allow abort glob progress
- In Node.js v20.11.0, it's not possible to match directories containing emojis.
- Directory globs with and without trailing slash in ignore patterns have different results
- No results returned if the file is a socket HOT 1
- [QUESTION] - Awilix.fast-glob Fails to Autoload Modules in Tests with TypeScript Setup
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 fast-glob.