Skip to content
Discussion options

You must be logged in to vote

So, you want to run the linter only in a specific folder, right?

You can use root option. Besides filtering by directory it also changes the pwd to the given directory, so if you have the following project structure, you can use yarn lint {staged_files} and it will be executed in the vue directory:

.
├── dot-net/
├── lefthook.yml
└── vue/
    ├── package.json
    └── yarn.lock

Example lefthook.yml config

pre-commit:
  commands:
    lint:
      root: vue # filter by directory
      glob: "*.{ts,js}" # filter by glob
      run: yarn lint {staged_files}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by neptunecentury
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants