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

feat(cli-plugin-eslint): use ESLint class instead of CLIEngine #6714

Merged
merged 5 commits into from Sep 29, 2021

Conversation

ota-meshi
Copy link
Member

This PR replaces CLIEngine with the ESLint class.
CLIEngine will be removed in eslint v8 and must be replaced with the ESLint class to support eslint v8.

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Docs
  • Underlying tools
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

Options may be affected by this change, but should not affect the options listed in the README.
https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint#readme

Other information:

Comment on lines 180 to 185
const keyPaths = [...renamedArrayArgs[key]]
const lastKey = keyPaths.pop()
for (const k of keyPaths) {
config[k] = {}
}
config[lastKey] = args[key].split(',')
Copy link
Member

@sodatea sodatea Sep 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With

env: ['overrideConfig', 'env'],
global: ['overrideConfig', 'globals'],

--env browser --global window gets normalized to

{
  overrideConfig: {},
  env: ['browser'],
  globals: ['window']
}

Is this the intended result?
Because in my understanding, env and globals should be put under overrideConfig.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a bug. sorry I will fix it 😓

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your review!
I changed this PR. Could you check it again?

Copy link
Collaborator

@fangbinwei fangbinwei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a little disappointing that cli-plugin-eslint need to do some repetitive work (translateOptions) what ESLint has done. 😢

https://github.com/eslint/eslint/blob/16034f09ae6c7a78b8268b4c859928f18de7b9d6/lib/cli.js#L62
https://github.com/eslint/eslint/blob/16034f09ae6c7a78b8268b4c859928f18de7b9d6/lib/cli.js#L232

@ota-meshi
Copy link
Member Author

It's failing in CI, but looking at the logs it looks like it's succeeding. Could you re-run and check if the test succeeds again?

image

@sodatea
Copy link
Member

sodatea commented Sep 29, 2021

😅It's actually a bug in my previous tests. I've fixed it in the dev branch.

The PR looks good to me now, so don't mind the tests, I'll merge it.

@ramicohen303
Copy link

When is this supposed to be merged and released? ESLint 8.0 is out, so upgrading my Vue projects to the latest ESLint version breaks my builds.

@sodatea
Copy link
Member

sodatea commented Oct 11, 2021

It's already released in 5.0.0-beta.5

@ramicohen303
Copy link

It's already released in 5.0.0-beta.5

Thank you for the quick reply. When do you expect v5 to be GA?

@sodatea
Copy link
Member

sodatea commented Oct 12, 2021

I can't give a guaranteed date because I've missed my own deadline multiple times.
But this time I'm targeting November.

@Flygenring
Copy link

Will this be released to the 4.x line as well? I was happy to see a new release today thinking I could upgrade ESLint too, but to no avail.

If not, would there be any other way of enabling ESLint 8.0 while using Vue CLI 4.x?

@Stanzilla
Copy link

@ota-meshi any news about the v4 backport?

@Javier1995
Copy link


"devDependencies": {
    "@sentry/webpack-plugin": "1.20.0",
    "@vue/cli-plugin-babel": "4.5.19",
    "@vue/cli-plugin-eslint": "4.5.19",
    "@vue/cli-plugin-router": "4.5.19",
    "@vue/cli-plugin-vuex": "4.5.19",
    "@vue/cli-service": "4.5.19",
    "@vue/compiler-sfc": "3.2.45",
    "@babel/eslint-parser": "7.19.1",
    "eslint": "8.32.0",
    "eslint-plugin-vue": "9.9.0",
    "prettier": "2.8.1",
ss-loader": "8.0.2"
  }

 ERROR  Failed to compile with 1 error                                                                                                                                                                                          11:55:28 AM

Syntax Error: TypeError: eslint.CLIEngine is not a constructor


You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.

Having same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants