diff --git a/packages/@vue/cli-plugin-eslint/generator/index.js b/packages/@vue/cli-plugin-eslint/generator/index.js index 4f9233c9b9..211236bf17 100644 --- a/packages/@vue/cli-plugin-eslint/generator/index.js +++ b/packages/@vue/cli-plugin-eslint/generator/index.js @@ -101,6 +101,18 @@ module.exports = (api, { config, lintOn = [] }, _, invoking) => { require('@vue/cli-plugin-unit-jest/generator').applyESLint(api) } } + + // lint & fix after create to ensure files adhere to chosen config + // for older versions that do not support the `hooks` feature + try { + api.assertCliVersion('^4.0.0-beta.0') + } catch (e) { + if (config && config !== 'base') { + api.onCreateComplete(() => { + require('../lint')({ silent: true }, api) + }) + } + } } // In PNPM v4, due to their implementation of the module resolution mechanism,