pretty-quick: --pattern not works

Hi, i am trying replace lint-staged with pretty-quick Before

"lint-staged": {
        "*.{js,jsx}": [
            "prettier --print-width 120 --tab-width 2 --trailing-comma none --write \"src/main/js/**/*.js\"",
            "git add"
        ]
    },

After:

"husky": {
        "hooks": {
            "pre-commit": "pretty-quick --pattern \"src/main/js/**/*.js\" --staged --verbose"
        }
    },

But now files are not changed in this path. P.S. i have monorepo, so it is very important to fix files only in this folder and path…

Thanks in advance.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 20 (7 by maintainers)

Most upvoted comments

I’m experience a somewhat similar issue.

This works:

yarn exec pretty-quick -- --staged --pattern '**/*.js'
🎯  Found 1 changed file.

But this doesn’t work:

yarn exec pretty-quick -- --staged --pattern '**/*.(js|jsx)'
🎯  Found 0 changed files.

Could this be some issue with the minimatch library?

I’m using pretty-quick@^3.0.2 on macOS.

I’ve noticed the same. It seems the round brackets pattern doesn’t work as expected.

This doesn’t work: pretty-quick --staged --pattern "**/(apps|libs|tools)/**/*"

This does: pretty-quick --staged --pattern "**/apps/**/*" --pattern "**/libs/**/*" --pattern "**/tools/**/*"

It seems that somehow round brackets aren’t supported in this scenario.