0

我想在提交之前按字母顺序对文件进行排序。

包.json:

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

但它提交当前版本,然后用排序覆盖文件。

4

1 回答 1

0

它的奇迹,但对我有用:

 "husky": {
        "hooks": {
          "pre-commit": "npm run sort && git status && npm run eslint",
          "pre-push": "npm run test"
        }
      },
于 2019-01-25T09:53:38.847 回答