I’m initializing git
git init
Installing hasky
npx husky-init && yarn
I get this package.json and pre-commit
{
...
"scripts": {
...
"prepare": "husky install",
"lint": "eslint .",
"lint:fix": "eslint --fix ."
},
"devDependencies": {
...
"husky": "^7.0.0"
},
...
}
.husky/pre-commit
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
yarn lint:fix
Making changes to git
git add .
Starting a commit
git commit -m “test”
Result:
[master (root commit) 05f4037] test
17 files changed, 5495 insertions(+)
create mode 100644 .env.example
create mode 100644 .eslintignore
create mode 100644 .eslintrc.js
create mode 100644 .gitignore
create mode 100755 .husky/pre-commit
create mode 100644 .nvmrc
create mode 100644 .prettierrc
create mode 100644 jest.config.js
create mode 100644 nodemon.json
create mode 100644 package.json
create mode 100644 src/__tests__/math/add.test.ts
create mode 100644 src/index.ts
create mode 100644 src/math/add.test.ts
create mode 100644 src/math/add.ts
create mode 100644 tsconfig.json
create mode 100644 tsconfig.prod.json
create mode 100644 yarn.lock
I make changes in any file, commit; the files are committed as usual.
I can’t see the reasons why.