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

chore!: update eslint-loader, minimum supported ESLint version is 6 #5870

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

Merged
merged 3 commits into from
Sep 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions 4 docs/migrations/migrate-from-v4.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ If you want to migrate manually and gradually, you can run `vue upgrade <the-plu

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

### `@vue/cli-plugin-eslint`

* `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.

### `@vue/cli-plugin-typescript`

#### Dropped TSLint support
Expand Down
18 changes: 1 addition & 17 deletions 18 packages/@vue/cli-plugin-eslint/__tests__/eslintMigrator.spec.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
jest.setTimeout(300000)
jest.mock('inquirer')

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

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

expectPrompts([
{
message: `Your current ESLint version is v4`,
confirm: false
}
])

await project.upgrade('eslint')

const updatedPkg = JSON.parse(await project.read('package.json'))
expect(updatedPkg.devDependencies.eslint).toMatch('^4')
expect(updatedPkg.devDependencies.eslint).toMatch('^6')
})

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

expectPrompts([
{
message: `Your current ESLint version is v5`,
confirm: true
}
])

try {
await project.upgrade('eslint')
} catch (e) {
Expand Down
62 changes: 26 additions & 36 deletions 62 packages/@vue/cli-plugin-eslint/migrator/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const inquirer = require('inquirer')
const { semver } = require('@vue/cli-shared-utils')

module.exports = async (api) => {
Expand Down Expand Up @@ -32,44 +31,35 @@ module.exports = async (api) => {
return
}

const { confirmUpgrade } = await inquirer.prompt([{
name: 'confirmUpgrade',
type: 'confirm',
message:
`Your current ESLint version is v${localESLintMajor}.\n` +
`The latest major version which supported by vue-cli is v6.\n` +
`Do you want to upgrade? (May contain breaking changes)\n`
}])
const { getDeps } = require('../eslintDeps')

if (confirmUpgrade) {
const { getDeps } = require('../eslintDeps')

const newDeps = getDeps(api)
if (pkg.devDependencies['@vue/eslint-config-airbnb']) {
Object.assign(newDeps, getDeps(api, 'airbnb'))
}
if (pkg.devDependencies['@vue/eslint-config-standard']) {
Object.assign(newDeps, getDeps(api, 'standard'))
}
if (pkg.devDependencies['@vue/eslint-config-prettier']) {
Object.assign(newDeps, getDeps(api, 'prettier'))
}
const newDeps = getDeps(api)
if (pkg.devDependencies['@vue/eslint-config-airbnb']) {
Object.assign(newDeps, getDeps(api, 'airbnb'))
}
if (pkg.devDependencies['@vue/eslint-config-standard']) {
Object.assign(newDeps, getDeps(api, 'standard'))
}
if (pkg.devDependencies['@vue/eslint-config-prettier']) {
Object.assign(newDeps, getDeps(api, 'prettier'))
}

api.extendPackage({ devDependencies: newDeps }, { warnIncompatibleVersions: false })
api.extendPackage({ devDependencies: newDeps }, { warnIncompatibleVersions: false })

// in case anyone's upgrading from the legacy `typescript-eslint-parser`
if (api.hasPlugin('typescript')) {
api.extendPackage({
eslintConfig: {
parserOptions: {
parser: '@typescript-eslint/parser'
}
// in case anyone's upgrading from the legacy `typescript-eslint-parser`
if (api.hasPlugin('typescript')) {
api.extendPackage({
eslintConfig: {
parserOptions: {
parser: '@typescript-eslint/parser'
}
})
}

// TODO:
// transform `@vue/prettier` to `eslint:recommended` + `@vue/prettier`
// transform `@vue/typescript` to `@vue/typescript/recommended` and also fix prettier compatibility for it
}
})
}

api.exitLog(`ESLint upgraded from v${localESLintMajor}. to v6\n`)

// TODO:
// transform `@vue/prettier` to `eslint:recommended` + `@vue/prettier`
// transform `@vue/typescript` to `@vue/typescript/recommended` and also fix prettier compatibility for it
}
4 changes: 2 additions & 2 deletions 4 packages/@vue/cli-plugin-eslint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
},
"dependencies": {
"@vue/cli-shared-utils": "^4.5.5",
"eslint-loader": "^2.2.1",
"eslint-loader": "^4.0.2",
"globby": "^9.2.0",
"inquirer": "^7.1.0",
"webpack": "^4.0.0",
"yorkie": "^2.0.0"
},
"peerDependencies": {
"@vue/cli-service": "^3.0.0 || ^4.0.0-0",
"eslint": ">= 1.6.0"
"eslint": ">= 6.0.0"
}
}
4 changes: 2 additions & 2 deletions 4 packages/@vue/cli-service-global/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"babel-eslint": "^10.1.0",
"chalk": "^4.1.0",
"core-js": "^3.6.5",
"eslint": "^5.16.0",
"eslint-plugin-vue": "^5.2.2",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2",
"regenerator-runtime": "^0.13.5",
"resolve": "^1.17.0",
"vue": "^2.6.12",
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.