observing / pre-commit

Automatically installs a git pre-commit script in your git repository which runs your `npm test` on pre-commit
MIT License
1.88k stars 153 forks source link

[Bug] pre-commit not hooked right #117

Open gengjiawen opened 6 years ago

gengjiawen commented 6 years ago

I have some script like this, but the prettier script looks execute after git commit, anything I do wrong or is it a bug

  "scripts": {
    "lint": "./node_modules/.bin/eslint --fix --ext .js ./",
    "prettier": "prettier */**/*.js --trailing-comma --single-quote es5 --ignore-path ./.prettierignore --no-semi --write '{./,__{tests,mocks}__}/**/*.js'",
  "pre-commit": [
    "prettier",
    "lint"
  ],
gengjiawen commented 6 years ago

I finally see the log, it because prettier config has a warning.

gengjiawen commented 6 years ago

Still exists

gengjiawen commented 6 years ago

Finally resolved by adding git add ., wondering should we add this in README.md

    "prettier": "prettier */**/*.js --ignore-path ./.prettierignore --write && git add . && git status",