Skip to content

Commit 31df36d

Browse files
authored
fix(eslint): autofix code style after scaffolding on older versions of cli (#4740)
1 parent 8093630 commit 31df36d

File tree

1 file changed

+12
-0
lines changed
  • packages/@vue/cli-plugin-eslint/generator

1 file changed

+12
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,18 @@ module.exports = (api, { config, lintOn = [] }, _, invoking) => {
101101
require('@vue/cli-plugin-unit-jest/generator').applyESLint(api)
102102
}
103103
}
104+
105+
// lint & fix after create to ensure files adhere to chosen config
106+
// for older versions that do not support the `hooks` feature
107+
try {
108+
api.assertCliVersion('^4.0.0-beta.0')
109+
} catch (e) {
110+
if (config && config !== 'base') {
111+
api.onCreateComplete(() => {
112+
require('../lint')({ silent: true }, api)
113+
})
114+
}
115+
}
104116
}
105117

106118
// In PNPM v4, due to their implementation of the module resolution mechanism,

0 commit comments

Comments
 (0)