Skip to content

Husky pre-commit fails with code 1 (error)  #1014

@abhinavkgrd

Description

@abhinavkgrd

Committing from vs-code Source control returns this error but the command line works fine

vscode version - 1.58.2

Command output

husky - pre-commit hook exited with code 1 (error)

pre-commit

#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint-staged

package json

{
"scripts": {
    "lint-staged": "lint-staged",
    "postinstall": "husky install"
  },
"devDependencies":{
    "husky": "^7.0.0",
    "lint-staged": "^11.0.0",
}

 "lint-staged": {
    "src/**/*.{js,jsx,ts,tsx}": "eslint"
  },

"husky": {
    "hooks": {
      "pre-commit": "yarn run lint-staged"
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions