Giter Site home page Giter Site logo

Comments (16)

mrmlnc avatar mrmlnc commented on August 23, 2024 2

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.

pbelbin avatar pbelbin commented on August 23, 2024 1

@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.

mrmlnc avatar mrmlnc commented on August 23, 2024

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.

alexander-akait avatar alexander-akait commented on August 23, 2024

@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.

mrmlnc avatar mrmlnc commented on August 23, 2024

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.

mrmlnc avatar mrmlnc commented on August 23, 2024

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.

alexander-akait avatar alexander-akait commented on August 23, 2024

@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.

reklatsmasters avatar reklatsmasters commented on August 23, 2024

I think this feature related to xojs/xo#65 issue.

from fast-glob.

mrmlnc avatar mrmlnc commented on August 23, 2024

@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.

alexander-akait avatar alexander-akait commented on August 23, 2024

@reklatsmasters @mrmlnc yep, difference

from fast-glob.

alexander-akait avatar alexander-akait commented on August 23, 2024

@mrmlnc problem still exists. Example usage https://github.com/itgalaxy/file-type-lint/blob/master/src/standalone.js#L65.
patterns - {**/*,*}.*

from fast-glob.

mrmlnc avatar mrmlnc commented on August 23, 2024

@evilebottnawi, you can provide real case with FS structure (ls -R or tree) and actual/expected results?

from fast-glob.

alexander-akait avatar alexander-akait commented on August 23, 2024

@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.

mrmlnc avatar mrmlnc commented on August 23, 2024

So, look like misunderstanding in the issue description :)

I just let you use the negative patterns in the ignore option.

from fast-glob.

mikehaertl avatar mikehaertl commented on August 23, 2024

@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 below vendor, so it has a default "**/vendor/**/{Tests,tests}/**", as exclude (=fast-glob ignore) option
  • it should not exclude a specific **/vendor/abc/tests directory, so a developer can add "!**/vendor/abc/tests" to exclude

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.

devinrhode2 avatar devinrhode2 commented on August 23, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.