Npm pre commit not working

I use the npm precommit hook, but it does not stop the file with the problems that need to be fixed, and I do not get the "Pre commit checks" message when I try to commit the file.

Package Json: { "name": "myfolder", "version": "1.0.0", "description": "", "main": "", "scripts": { "test": "echo \"Error: no test specified\" && exit 0", "precommit-msg": "echo 'Pre-commit checks...' && exit 0", "lint": "csslint global/css" }, "author": "SR", "license": "ISC", "dependencies": { "csslint": "^1.0.4", "jshint": "^2.9.4", "pre-commit": "^1.2.2" }, "pre-commit": [ "precommit-msg", "lint" ], "devDependencies": { "pre-commit": "^1.2.2" } } 
+5
source share
1 answer

Please make sure your package.json file is in the same folder as the .git folder (where the git repository is initialized). When you install the pre-commit package, the pre-commit file should display under .git / hooks / '.

enter image description here

+2
source

Source: https://habr.com/ru/post/1265622/


All Articles