Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

glob configuration as an array #888

Open
BurnerWah opened this issue Dec 6, 2024 · 1 comment
Open

glob configuration as an array #888

BurnerWah opened this issue Dec 6, 2024 · 1 comment
Labels
feature request A new lefthook feature description

Comments

@BurnerWah
Copy link

⚡ Summary

I'd love to see the glob option have support for an array of multiple globs

glob:
  - '*.{yml,yaml}'
  - .ansible-lint

Value

It can be rather difficult to construct or maintain a singular glob that selects all the files a single command can operate on, and that holds especially true for multi-language formatters like prettier.
This is one of the globs that I've had in one of my repos:

glob: '{*.{css,md,html,json,jsonc,code-snippets,rb,xml,plist,yml,yaml,ansible-lint}{,.tmpl},{Gem,Brew}file}'

It's 101 characters on its own, and still requires some excludes excludes to skip files that I know it should skip but still let match the glob because it's easier to edit that way.
It'd be much easier to split that up into six globs, like so:

glob:
  - '*.{css,md,html,json,jsonc,rb}'
  - '*.{xml,plist,yml,yaml}{,.tmpl}'
  - .vscode/*.code-snippets
  - .ansible-lint
  - Gemfile
  - Brewfile

And it'd be much easier to update in the future to work with more files.

Behavior and configuration changes

The glob option would be able to be a string with a single glob (to avoid breaking existing configs), or an array of multiple globs.

@BurnerWah BurnerWah added the feature request A new lefthook feature description label Dec 6, 2024
@mrexox
Copy link
Member

mrexox commented Dec 9, 2024

Nice suggestion! I'm not sure I have enough time to make it until 2025, but if you want, you can submit a PR 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request A new lefthook feature description
Projects
None yet
Development

No branches or pull requests

2 participants