Skip to content

Commit

Permalink
fix(eslint): autofix code style after scaffolding on older versions o…
Browse files Browse the repository at this point in the history
…f cli (#4740)
  • Loading branch information
sodatea committed Oct 22, 2019
1 parent 8093630 commit 31df36d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/@vue/cli-plugin-eslint/generator/index.js
Expand Up @@ -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,
Expand Down

0 comments on commit 31df36d

Please sign in to comment.