Use of promisify breaks compatibility with vscode eslint @vue/airbnb
See original GitHub issueVersion
3.0.0-beta.15
Reproduction link
Steps to reproduce
Create a sample Vue project. Ensure eslint config includes: { “extends”: [ “plugin:vue/recommended”, “@vue/airbnb” ] } Open project in VS Code with eslint plugin. Open “Home.vue” file, wait for errors to come.
What is expected?
No error in “Problems” tab.
What is actually happening?
Resolve error: require(…).promisify is not a function (import/no-unresolved) Resolve error: require(…).promisify is not a function (import/no-extraneous-dependencies) Resolve error: require(…).promisify is not a function (import/no-duplicates) Resolve error: require(…).promisify is not a function (import/extensions) Resolve error: require(…).promisify is not a function (import/no-named-as-default) Resolve error: require(…).promisify is not a function (import/no-named-as-default-member) Unable to resolve path to module ‘@/components/HelloWorld.vue’. (import/no-unresolved)
Why This Happens
- VSCode uses electron 1.7.12: (ref: https://github.com/Microsoft/vscode/blob/aaa191d9a2d893a7d42b6e2233430c5fe5064d9e/.yarnrc)
- Which uses node 7.9 (ref: https://electronjs.org/releases#1.8.1)
- util.promisify is not available in Node 7.9 (ref: https://nodejs.org/docs/latest-v7.x/api/util.html)
- But it is used in this line: (https://github.com/vuejs/vue-cli/blob/cd88b47edcc102903e787d55b238a7f5e9e1c900/packages/%40vue/cli-shared-utils/index.js#L17)
- The above line is imported by the following route:
- eslintrc imports:
@vue/airbnb
- https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/eslint-config-airbnb/index.js#L8
- https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli-service/webpack.config.js#L7
- https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli-service/lib/Service.js#L11
- https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli-shared-utils/index.js
Issue Analytics
- State:
- Created 5 years ago
- Comments:14 (5 by maintainers)
Top GitHub Comments
@yyx990803 You’re right, my bad… All my apologies, I’ll pay more attention at my repro scenarios next times.
I understand that you don’t have to lose too much time recreating the context of the issues, but you know your projects very well and it can be very hard for us (users) to figure out what we did wrong. Plus, the “closed” aspect of your message made me think the issue wasn’t taken seriously while the problem was actually my scenario. Maybe it would have been different with an open end to your message like “please add details to your scenario in a new issue”.
I’m not blaming you here, just trying to explain what happened and maybe enhance your issues.
Thanks for having taken your time to explain what was wrong in my issue. 🙏
As I said:
I can’t reproduce this with the latest VSCode (1.23.1) + VSCode ESLint plugin (1.4.12) + the exact project setup (
@vue/airbnb
) you described. Everything works as expected for me. Please make sure to update everything to the latest.Your ESLint plugin is linting files that are not even part of your project source code. The files containing
util.promisify
is inside your dependency, and your ESLint plugin is attempting to lint a dependency which is obviously wrong. This has nothing to do with what version of Node VSCode is using and there’s nothing Vue CLI can do about it - this is a problem with your editor/plugin setup. If anything, please report a bug to the VSCode ESLint plugin.