Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(eslint): autofix code style after scaffolding on older versions of cli #4740

Merged
merged 1 commit into from Oct 22, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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