evilmartians/lefthook

`exclude` configuration as array

dalisoft opened this issue · 1 comments

⚡ Summary

I would like to see exclude array support

Value

exclude:
  - bun.lockb
  - package-lock.json
  - yarn.lock
  - pnpm-lock.yaml

Behavior and configuration changes

Currently configuration is like this:

prepare-commit-msg:
  commands:
    commitlint:
      env:
        PATH: $PATH:./node_modules/.bin
      run: commitlint --edit

pre-commit:
  parallel: true
  commands:
    biome:
      env:
        PATH: $PATH:./node_modules/.bin
      glob: "*.{js,ts,jsx,tsx,json,jsonc}"
      run: biome check {staged_files} --apply
    markdown:
      env:
        PATH: $PATH:./node_modules/.bin
      glob: "*.md"
      run: dprint fmt {staged_files}
    docker:
      env:
        PATH: $PATH:./node_modules/.bin
      glob: "Dockerfile"
      run: dprint fmt {staged_files}
    typos:
      env:
        PATH: $PATH:./node_modules/.bin
      exclude: "bun.lockb|package-lock.json|yarn.lock|pnpm-lock.yaml"
      run: typos {staged_files}

pre-push:
  parallel: true
  commands:
    biome:
      env:
        PATH: $PATH:./node_modules/.bin
      glob: "*.{js,ts,jsx,tsx,json,jsonc}"
      run: biome check {all_files}
    markdown:
      env:
        PATH: $PATH:./node_modules/.bin
      glob: "*.md"
      run: dprint check {all_files}
    docker:
      env:
        PATH: $PATH:./node_modules/.bin
      glob: "Dockerfile"
      run: dprint check {all_files}
    typos:
      env:
        PATH: $PATH:./node_modules/.bin
      exclude: "bun.lockb|package-lock.json|yarn.lock|pnpm-lock.yaml"
      run: typos {all_files}

And i would like to see like this

prepare-commit-msg:
  commands:
    commitlint:
      env:
        PATH: $PATH:./node_modules/.bin
      run: commitlint --edit

pre-commit:
  parallel: true
  commands:
    biome:
      env:
        PATH: $PATH:./node_modules/.bin
      glob: "*.{js,ts,jsx,tsx,json,jsonc}"
      run: biome check {staged_files} --apply
    markdown:
      env:
        PATH: $PATH:./node_modules/.bin
      glob: "*.md"
      run: dprint fmt {staged_files}
    docker:
      env:
        PATH: $PATH:./node_modules/.bin
      glob: "Dockerfile"
      run: dprint fmt {staged_files}
    typos:
      env:
        PATH: $PATH:./node_modules/.bin
-    exclude: "bun.lockb|package-lock.json|yarn.lock|pnpm-lock.yaml"
+    exclude:
        - bun.lockb
        - package-lock.json
        - yarn.lock
        - pnpm-lock.yaml
      run: typos {staged_files}

pre-push:
  parallel: true
  commands:
    biome:
      env:
        PATH: $PATH:./node_modules/.bin
      glob: "*.{js,ts,jsx,tsx,json,jsonc}"
      run: biome check {all_files}
    markdown:
      env:
        PATH: $PATH:./node_modules/.bin
      glob: "*.md"
      run: dprint check {all_files}
    docker:
      env:
        PATH: $PATH:./node_modules/.bin
      glob: "Dockerfile"
      run: dprint check {all_files}
    typos:
      env:
        PATH: $PATH:./node_modules/.bin
-     exclude: "bun.lockb|package-lock.json|yarn.lock|pnpm-lock.yaml"
+     exclude:
        - bun.lockb
        - package-lock.json
        - yarn.lock
        - pnpm-lock.yaml
      run: typos {all_files}

I too would like this feature.
It's hard with regular expressions when I want to set up multiple files in different directory hierarchies.