|
1 |
| -const inquirer = require('inquirer') |
2 | 1 | const { semver } = require('@vue/cli-shared-utils')
|
3 | 2 |
|
4 | 3 | module.exports = async (api) => {
|
@@ -32,44 +31,35 @@ module.exports = async (api) => {
|
32 | 31 | return
|
33 | 32 | }
|
34 | 33 |
|
35 |
| - const { confirmUpgrade } = await inquirer.prompt([{ |
36 |
| - name: 'confirmUpgrade', |
37 |
| - type: 'confirm', |
38 |
| - message: |
39 |
| - `Your current ESLint version is v${localESLintMajor}.\n` + |
40 |
| - `The latest major version which supported by vue-cli is v6.\n` + |
41 |
| - `Do you want to upgrade? (May contain breaking changes)\n` |
42 |
| - }]) |
| 34 | + const { getDeps } = require('../eslintDeps') |
43 | 35 |
|
44 |
| - if (confirmUpgrade) { |
45 |
| - const { getDeps } = require('../eslintDeps') |
46 |
| - |
47 |
| - const newDeps = getDeps(api) |
48 |
| - if (pkg.devDependencies['@vue/eslint-config-airbnb']) { |
49 |
| - Object.assign(newDeps, getDeps(api, 'airbnb')) |
50 |
| - } |
51 |
| - if (pkg.devDependencies['@vue/eslint-config-standard']) { |
52 |
| - Object.assign(newDeps, getDeps(api, 'standard')) |
53 |
| - } |
54 |
| - if (pkg.devDependencies['@vue/eslint-config-prettier']) { |
55 |
| - Object.assign(newDeps, getDeps(api, 'prettier')) |
56 |
| - } |
| 36 | + const newDeps = getDeps(api) |
| 37 | + if (pkg.devDependencies['@vue/eslint-config-airbnb']) { |
| 38 | + Object.assign(newDeps, getDeps(api, 'airbnb')) |
| 39 | + } |
| 40 | + if (pkg.devDependencies['@vue/eslint-config-standard']) { |
| 41 | + Object.assign(newDeps, getDeps(api, 'standard')) |
| 42 | + } |
| 43 | + if (pkg.devDependencies['@vue/eslint-config-prettier']) { |
| 44 | + Object.assign(newDeps, getDeps(api, 'prettier')) |
| 45 | + } |
57 | 46 |
|
58 |
| - api.extendPackage({ devDependencies: newDeps }, { warnIncompatibleVersions: false }) |
| 47 | + api.extendPackage({ devDependencies: newDeps }, { warnIncompatibleVersions: false }) |
59 | 48 |
|
60 |
| - // in case anyone's upgrading from the legacy `typescript-eslint-parser` |
61 |
| - if (api.hasPlugin('typescript')) { |
62 |
| - api.extendPackage({ |
63 |
| - eslintConfig: { |
64 |
| - parserOptions: { |
65 |
| - parser: '@typescript-eslint/parser' |
66 |
| - } |
| 49 | + // in case anyone's upgrading from the legacy `typescript-eslint-parser` |
| 50 | + if (api.hasPlugin('typescript')) { |
| 51 | + api.extendPackage({ |
| 52 | + eslintConfig: { |
| 53 | + parserOptions: { |
| 54 | + parser: '@typescript-eslint/parser' |
67 | 55 | }
|
68 |
| - }) |
69 |
| - } |
70 |
| - |
71 |
| - // TODO: |
72 |
| - // transform `@vue/prettier` to `eslint:recommended` + `@vue/prettier` |
73 |
| - // transform `@vue/typescript` to `@vue/typescript/recommended` and also fix prettier compatibility for it |
| 56 | + } |
| 57 | + }) |
74 | 58 | }
|
| 59 | + |
| 60 | + api.exitLog(`ESLint upgraded from v${localESLintMajor}. to v6\n`) |
| 61 | + |
| 62 | + // TODO: |
| 63 | + // transform `@vue/prettier` to `eslint:recommended` + `@vue/prettier` |
| 64 | + // transform `@vue/typescript` to `@vue/typescript/recommended` and also fix prettier compatibility for it |
75 | 65 | }
|
0 commit comments