6

I'm working with NodeJS Typescript and I wanted to set lint-staged to validate my files before commit but it is not working. I added from a guide as following:

"husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "*.{js, jsx, ts, tsx, md, html}": [
      "eslint --fix",
      "prettier --write",
      "git add"
    ]
  }

The error I'm getting:

No staged files match any of provided globs.

What is the right config for my package.json?

Jakub
  • 2,367
  • 6
  • 31
  • 82

2 Answers2

10

Spaces after commas can break the globs - try removing them:

"*.{js,jsx,ts,tsx,md,html}"
Perttu Haliseva
  • 530
  • 5
  • 16
1

Becase no file in Staged changes, change one file (make sure this file has error format) => git add . => npx lint-staged

Viết Kenji Gi
  • 400
  • 1
  • 2
  • 5