Git lint-staged+;适合命令行和Intellij的混合配置
我正在尝试构建这样一个配置,它将同时适用于命令行和Intellij 这是我的Git lint-staged+;适合命令行和Intellij的混合配置,git,intellij-idea,husky,lint-staged,commitizen,Git,Intellij Idea,Husky,Lint Staged,Commitizen,我正在尝试构建这样一个配置,它将同时适用于命令行和Intellij 这是我的包.json的一部分 "config": { "commitizen": { "path": "cz-conventional-changelog" } }, "husky": { "hooks": { "pre-commit": "lint-staged", "prepare-commit-msg": "exec < /dev/tty && git cz --h
包.json的一部分
"config": {
"commitizen": {
"path": "cz-conventional-changelog"
}
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"prepare-commit-msg": "exec < /dev/tty && git cz --hook",
"commit-msg": "validate-commit-msg"
}
},
"devDependencies": {
"commitizen": "^3.1.1",
"cz-conventional-changelog": "^2.1.0",
"eslint": "^5.15.1",
"eslint-config-airbnb-base": "^13.1.0",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-jest": "^22.4.1",
"husky": "^1.3.1",
"lint-staged": "^8.1.5",
"standard-version": "^5.0.1",
"validate-commit": "^3.4.0"
“配置”:{
“混合”:{
“路径”:“cz常规变更日志”
}
},
“哈士奇”:{
“挂钩”:{
“预提交”:“lint staged”,
“准备提交消息”:“exec
它在命令行中运行良好,但在使用Intellji提交时,它会说
0 files committed, 1 file failed to commit: feat(asdf): asdfasd fasdf asdfa333 husky > pre-commit (node v10.13.0) Stashing changes... [started] Stashing changes... [skipped] → No partially staged files found... Running linters... [started] Running tasks for *.js [started] eslint --fix [started] eslint --fix [completed] git add [started] git add [completed] Running tasks for *.js [completed] Running linters... [completed] husky > prepare-commit-msg (node v10.13.0) /bin/sh: 1: cannot open /dev/tty: No such device or address husky > prepare-commit-msg hook failed (cannot be bypassed with --no-verify due to Git specs)
已提交0个文件,1个文件未能提交:feat(asdf):asdfasd fasdf asdfa333 husky>预提交(节点v10.13.0)隐藏更改…[已启动]隐藏更改…[已跳过]→ 找不到部分暂存的文件…正在运行linters…[已启动]为*.js运行任务[已启动]eslint--fix[已启动]eslint--fix[已完成]git add[已启动]git add[已完成]为*.js运行任务[已完成]运行linters…[已完成]husky>准备提交消息(节点v10.13.0)/bin/sh:1:无法打开/dev/tty:没有这样的设备或地址husky>prepare commit msg hook失败(无法通过--No verify绕过,因为Git规范)
这有解决办法吗?我自己刚遇到这个问题
这个问题很容易解决,只要在TTY发生故障时添加一个短路即可
exec