fix(eslint-generator): add ts file check to lint-staged (#4347)

fix #3947

(cherry picked from commit 80c20db703)
This commit is contained in:
李瑞丰
2019-07-24 20:54:47 -05:00
committed by Haoqun Jiang
parent 470c94ee1a
commit 66c410b31a
@@ -78,8 +78,14 @@ module.exports = (api, { config, lintOn = [] }, _, invoking) => {
pkg.gitHooks = {
'pre-commit': 'lint-staged'
}
pkg['lint-staged'] = {
'*.{js,vue}': ['vue-cli-service lint', 'git add']
if (api.hasPlugin('typescript')) {
pkg['lint-staged'] = {
'*.{js,vue,ts}': ['vue-cli-service lint', 'git add']
}
} else {
pkg['lint-staged'] = {
'*.{js,vue}': ['vue-cli-service lint', 'git add']
}
}
}