vuejs / vue-cli

🛠️ webpack-based tooling for Vue.js Development
https://cli.vuejs.org/
MIT License
29.75k stars 6.33k forks source link

Warnings when re-exporting imported interfaces and "emitDecoratorMetadata" is true #6776

Open lgarczyn opened 2 years ago

lgarczyn commented 2 years ago

Version

5.0.0-beta.6

Reproduction link

github.com

Environment info


Environment Info:

  System:
    OS: Linux 5.11 Ubuntu 20.04.3 LTS (Focal Fossa)
    CPU: (8) x64 Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
  Binaries:
    Node: 16.11.1 - /usr/bin/node
    Yarn: 1.22.17 - ~/.local/share/npm/bin/yarn
    npm: 8.0.0 - /usr/bin/npm
  Browsers:
    Chrome: 95.0.4638.54
    Firefox: 93.0
  npmPackages:
    @vue/babel-helper-vue-jsx-merge-props:  1.2.1 
    @vue/babel-helper-vue-transform-on:  1.0.2 
    @vue/babel-plugin-jsx:  1.1.1 
    @vue/babel-plugin-transform-vue-jsx:  1.2.1 
    @vue/babel-preset-app:  5.0.0-beta.6 
    @vue/babel-preset-jsx:  1.2.4 
    @vue/babel-sugar-composition-api-inject-h:  1.2.1 
    @vue/babel-sugar-composition-api-render-instance:  1.2.4 
    @vue/babel-sugar-functional-vue:  1.2.2 
    @vue/babel-sugar-inject-h:  1.2.2 
    @vue/babel-sugar-v-model:  1.2.3 
    @vue/babel-sugar-v-on:  1.2.3 
    @vue/cli-overlay:  5.0.0-beta.6 
    @vue/cli-plugin-babel: ^5.0.0-beta.6 => 5.0.0-beta.6 
    @vue/cli-plugin-router:  5.0.0-beta.6 
    @vue/cli-plugin-typescript: ^5.0.0-beta.6 => 5.0.0-beta.6 
    @vue/cli-plugin-vuex:  5.0.0-beta.6 
    @vue/cli-service: ^5.0.0-beta.6 => 5.0.0-beta.6 
    @vue/cli-shared-utils:  5.0.0-beta.6 
    @vue/component-compiler-utils:  3.2.2 
    @vue/web-component-wrapper:  1.3.0 
    typescript: ^4.2.3 => 4.4.4 
    vue: ^2.6.12 => 2.6.14 
    vue-class-component: ^7.2.6 => 7.2.6 
    vue-hot-reload-api:  2.3.4 
    vue-loader:  16.8.1 (15.9.8)
    vue-property-decorator: ^9.1.2 => 9.1.2 
    vue-style-loader:  4.1.3 
    vue-template-compiler: ^2.6.12 => 2.6.14 
    vue-template-es2015-compiler:  1.9.1 
  npmGlobalPackages:
    @vue/cli: 5.0.0-alpha.8

Steps to reproduce

yarn && yarn serve

What is expected?

no warnings

What is actually happening?

WARNING  Compiled with 1 warning                                                                                                                                                                                                    7:06:33 PM

 warning  in ./src/App.vue?vue&type=script&lang=ts&

export 'Label' (imported as 'Label') was not found in './data' (module has no exports)

Similar to https://github.com/vuejs/vue-cli/issues/1990

However, esModuleInterop and allowSyntheticDefaultImports are both true. It is also a warning, not an error

It only happens if the type in question is a prop, and with emitDecoratorMetadata set to true

zch233 commented 2 years ago

the same

lgarczyn commented 2 years ago

A partial solution is to use import type instead of import

It is possible to ask eslint to fix this, using @typescript-eslint/consistent-type-import with { prefer: 'import-types'}