Skip to content

Commit 80c20db

Browse files
李瑞丰haoqunjiang
李瑞丰
authored andcommitted
fix(eslint-generator): add ts file check to lint-staged (#4347)
fix #3947
1 parent 448dbdb commit 80c20db

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

+8-2
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,14 @@ module.exports = (api, { config, lintOn = [] }, _, invoking) => {
8080
pkg.gitHooks = {
8181
'pre-commit': 'lint-staged'
8282
}
83-
pkg['lint-staged'] = {
84-
'*.{js,vue}': ['vue-cli-service lint', 'git add']
83+
if (api.hasPlugin('typescript')) {
84+
pkg['lint-staged'] = {
85+
'*.{js,vue,ts}': ['vue-cli-service lint', 'git add']
86+
}
87+
} else {
88+
pkg['lint-staged'] = {
89+
'*.{js,vue}': ['vue-cli-service lint', 'git add']
90+
}
8591
}
8692
}
8793

0 commit comments

Comments
 (0)