git commit提交时报错husky > pre-commit (node v10.16.0) Stashing changes... [started] Stashing changes.

项目中使用了husky, 这个会在你git commit的时候先执行里面的严谨模式, 对代码进行检查,  有error就会终止提交

 一直想怎么关闭vue里的严谨模式, 后面问到后台有说可以忽略的,问题和方法如下:

 

git 提交的时候各种提示

$ git commit -m "提交页面"
husky > pre-commit (node v10.16.0)
Stashing changes... [started]
Stashing changes... [skipped]
→ No partially staged files found...
Running linters... [started]
Running tasks for src/**/*.{js,vue} [started]
eslint --fix [started]
eslint --fix [failed]
→
Running tasks for src/**/*.{js,vue} [failed]
→
Running linters... [failed]



× eslint --fix found some errors. Please fix them and try committing again.

E:\project\hlwl-siw-pc\src\views\informationManage\sealTemplate.vue
333:30  error  Expected '===' and instead saw '=='         eqeqeq
338:30  error  Expected '===' and instead saw '=='         eqeqeq
347:29  error  'msg' is assigned a value but never used    no-unused-vars
348:18  error  Expected '===' and instead saw '=='         eqeqeq
352:16  error  Expected error to be handled                handle-callback-err
379:29  error  'msg' is assigned a value but never used    no-unused-vars
379:34  error  'total' is assigned a value but never used  no-unused-vars
380:18  error  Expected '===' and instead saw '=='         eqeqeq
390:16  error  Expected error to be handled                handle-callback-err
410:27  error  Expected '===' and instead saw '=='         eqeqeq
425:23  error  'data' is assigned a value but never used   no-unused-vars
425:29  error  'msg' is assigned a value but never used    no-unused-vars
425:34  error  'total' is assigned a value but never used  no-unused-vars
426:18  error  Expected '===' and instead saw '=='         eqeqeq
433:16  error  Expected error to be handled                handle-callback-err
441:33  error  Expected '===' and instead saw '=='         eqeqeq
494:22  error  Expected '===' and instead saw '=='         eqeqeq
502:20  error  Expected error to be handled                handle-callback-err
519:23  error  Expected '===' and instead saw '=='         eqeqeq
531:23  error  Expected '===' and instead saw '=='         eqeqeq

✖ 20 problems (20 errors, 0 warnings)
husky > pre-commit hook failed (add --no-verify to bypass)

 

解决办法: 

git commit -m "提交页面备注" --no-verify

 

 不按要求改的话, 提交的时候这样提交, 就可以绕过了eslint的检查了

 

原因这位大哥描述的很详细: git commit前检测husky与pre-commit

 严谨模式规则什么的点这里看广告很多

上一篇:1042:Gone Fishing(贪心算法)


下一篇:IndentationError: expected an indented block