8000 fix(eslint-generator): add ts file check to lint-staged (#4347) · vuejs/vue-cli@66c410b · GitHub
[go: up one dir, main page]

Skip to content

Commit 66c410b

Browse files
李瑞丰haoqunjiang
李瑞丰
authored andcommitted
fix(eslint-generator): add ts file check to lint-staged (#4347)
fix #3947 (cherry picked from commit 80c20db)
1 parent 470c94e commit 66c410b

File tree

1 file changed

+8
-2
lines changed
  • packages/@vue/cli-plugin-eslint/generator

1 file changed

+8
-2
lines changed

packages/@vue/cli-plugin-eslint/generator/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,14 @@ module.exports = (api, { config, lintOn = [] }, _, invoking) => {
7878
pkg.gitHooks = {
7979
'pre-commit': 'lint-staged'
8080
}
81-
pkg['lint-staged'] = {
82-
'*.{js,vue}': ['vue-cli-service lint', 'git add']
81+
if (api.hasPlugin('typescript')) {
82+
pkg['lint-staged'] = {
83+
'*.{js,vue,ts}': ['vue-cli-service lint', 'git add']
84+
}
85+
} else {
86+
pkg['lint-staged'] = {
87+
'*.{js,vue}': ['vue-cli-service lint', 'git add']
88+
}
8389
}
8490
}
8591

0 commit comments

Comments
 (0)
0