0

I want to sort file in alphabetic before commit.

package.json:

"scripts": {
    ....,
    "sort": "sort-json ./app/locales/de.json",
   ......
  },
  "husky": {
        "hooks": {
          "pre-commit": "npm run sort && npm run eslint",
          "pre-push": "npm run test"
        }
      },

But it commit current version and then overwrite file with sorting.

1 Answers1

0

its miracle, but works for me:

 "husky": {
        "hooks": {
          "pre-commit": "npm run sort && git status && npm run eslint",
          "pre-push": "npm run test"
        }
      },