Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 36e500d

Browse filesBrowse files
authored
chore!: update eslint-loader, minimum supported ESLint version is 6 (#5870)
1 parent bb095d9 commit 36e500d
Copy full SHA for 36e500d

File tree

Expand file treeCollapse file tree

6 files changed

+66
-154
lines changed
Filter options
Expand file treeCollapse file tree

6 files changed

+66
-154
lines changed

‎docs/migrations/migrate-from-v4.md

Copy file name to clipboardExpand all lines: docs/migrations/migrate-from-v4.md
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ If you want to migrate manually and gradually, you can run `vue upgrade <the-plu
3838

3939
### The Global `@vue/cli` and The `vue` Command
4040

41+
### `@vue/cli-plugin-eslint`
42+
43+
* `eslint-loader` is upgraded [from v2 to v4](https://github.com/webpack-contrib/eslint-loader/blob/master/CHANGELOG.md). The only major change is that it dropped support for ESLint < v6.
44+
4145
### `@vue/cli-plugin-typescript`
4246

4347
#### Dropped TSLint support

‎packages/@vue/cli-plugin-eslint/__tests__/eslintMigrator.spec.js

Copy file name to clipboardExpand all lines: packages/@vue/cli-plugin-eslint/__tests__/eslintMigrator.spec.js
+1-17Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
jest.setTimeout(300000)
2-
jest.mock('inquirer')
32

43
const create = require('@vue/cli-test-utils/createUpgradableProject')
5-
const { expectPrompts } = require('inquirer')
64

75
test('upgrade: should add eslint to devDependencies', async () => {
86
const project = await create('plugin-eslint-v3.0', {
@@ -16,17 +14,10 @@ test('upgrade: should add eslint to devDependencies', async () => {
1614
const pkg = JSON.parse(await project.read('package.json'))
1715
expect(pkg.devDependencies).not.toHaveProperty('eslint')
1816

19-
expectPrompts([
20-
{
21-
message: `Your current ESLint version is v4`,
22-
confirm: false
23-
}
24-
])
25-
2617
await project.upgrade('eslint')
2718

2819
const updatedPkg = JSON.parse(await project.read('package.json'))
29-
expect(updatedPkg.devDependencies.eslint).toMatch('^4')
20+
expect(updatedPkg.devDependencies.eslint).toMatch('^6')
3021
})
3122

3223
test('upgrade: should upgrade eslint from v5 to v6', async () => {
@@ -42,13 +33,6 @@ test('upgrade: should upgrade eslint from v5 to v6', async () => {
4233
const pkg = JSON.parse(await project.read('package.json'))
4334
expect(pkg.devDependencies.eslint).toMatch('^5')
4435

45-
expectPrompts([
46-
{
47-
message: `Your current ESLint version is v5`,
48-
confirm: true
49-
}
50-
])
51-
5236
try {
5337
await project.upgrade('eslint')
5438
} catch (e) {
+26-36Lines changed: 26 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
const inquirer = require('inquirer')
21
const { semver } = require('@vue/cli-shared-utils')
32

43
module.exports = async (api) => {
@@ -32,44 +31,35 @@ module.exports = async (api) => {
3231
return
3332
}
3433

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')
4335

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+
}
5746

58-
api.extendPackage({ devDependencies: newDeps }, { warnIncompatibleVersions: false })
47+
api.extendPackage({ devDependencies: newDeps }, { warnIncompatibleVersions: false })
5948

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'
6755
}
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+
})
7458
}
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
7565
}

‎packages/@vue/cli-plugin-eslint/package.json

Copy file name to clipboardExpand all lines: packages/@vue/cli-plugin-eslint/package.json
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@
2424
},
2525
"dependencies": {
2626
"@vue/cli-shared-utils": "^4.5.5",
27-
"eslint-loader": "^2.2.1",
27+
"eslint-loader": "^4.0.2",
2828
"globby": "^9.2.0",
2929
"inquirer": "^7.1.0",
3030
"webpack": "^4.0.0",
3131
"yorkie": "^2.0.0"
3232
},
3333
"peerDependencies": {
3434
"@vue/cli-service": "^3.0.0 || ^4.0.0-0",
35-
"eslint": ">= 1.6.0"
35+
"eslint": ">= 6.0.0"
3636
}
3737
}

‎packages/@vue/cli-service-global/package.json

Copy file name to clipboardExpand all lines: packages/@vue/cli-service-global/package.json
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
"babel-eslint": "^10.1.0",
2929
"chalk": "^4.1.0",
3030
"core-js": "^3.6.5",
31-
"eslint": "^5.16.0",
32-
"eslint-plugin-vue": "^5.2.2",
31+
"eslint": "^6.7.2",
32+
"eslint-plugin-vue": "^6.2.2",
3333
"regenerator-runtime": "^0.13.5",
3434
"resolve": "^1.17.0",
3535
"vue": "^2.6.12",

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.