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

Compiler macros generate eslint no-undef warnings #7211

Open
Guillaume-N opened this issue Jun 23, 2022 · 0 comments
Open

Compiler macros generate eslint no-undef warnings #7211

Guillaume-N opened this issue Jun 23, 2022 · 0 comments

Comments

@Guillaume-N
Copy link

Version

5.0.6

Environment info

Environment Info:

  System:
    OS: macOS 11.5.2
    CPU: (8) x64 Apple M1
  Binaries:
    Node: 12.22.12 - ~/.volta/tools/image/node/12.22.12/bin/node
    Yarn: 1.22.15 - ~/.volta/tools/image/yarn/1.22.15/bin/yarn
    npm: 6.14.16 - ~/.volta/tools/image/node/12.22.12/bin/npm
  Browsers:
    Chrome: 103.0.5060.53
    Edge: Not Found
    Firefox: Not Found
    Safari: 14.1.2
  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.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.6 
    @vue/cli-plugin-babel: ~5.0.0 => 5.0.6 
    @vue/cli-plugin-eslint: ~5.0.0 => 5.0.6 
    @vue/cli-plugin-router:  5.0.6 
    @vue/cli-plugin-typescript: ~5.0.0 => 5.0.6 
    @vue/cli-plugin-unit-jest: ~5.0.0 => 5.0.6 
    @vue/cli-plugin-vuex:  5.0.6 
    @vue/cli-service: ~5.0.0 => 5.0.6 
    @vue/cli-shared-utils:  5.0.6 
    @vue/compiler-core:  3.2.37 
    @vue/compiler-dom:  3.2.37 
    @vue/compiler-sfc:  3.2.37 
    @vue/compiler-ssr:  3.2.37 
    @vue/component-compiler-utils:  3.3.0 
    @vue/eslint-config-typescript: ^9.1.0 => 9.1.0 
    @vue/reactivity:  3.2.37 
    @vue/reactivity-transform:  3.2.37 
    @vue/runtime-core:  3.2.37 
    @vue/runtime-dom:  3.2.37 
    @vue/server-renderer:  3.2.37 
    @vue/shared:  3.2.37 
    @vue/test-utils: ^2.0.0-0 => 2.0.0 
    @vue/vue3-jest: ^27.0.0-alpha.1 => 27.0.0 
    @vue/web-component-wrapper:  1.3.0 
    eslint-plugin-vue: ^8.0.3 => 8.7.1 
    jest-serializer-vue:  2.0.2 
    typescript: ~4.5.5 => 4.5.5 
    vue: ^3.2.13 => 3.2.37 
    vue-eslint-parser:  8.3.0 
    vue-hot-reload-api:  2.3.4 
    vue-loader:  17.0.0 (15.9.8)
    vue-style-loader:  4.1.3 
    vue-template-es2015-compiler:  1.9.1 
  npmGlobalPackages:
    @vue/cli: Not Found

Steps to reproduce

Create a new Vue project with vue-cli with custom options: Vue 3, TypeScript, Eslint + Prettier, testing with jest

As stated in the eslint.vuejs.org guide here: https://eslint.vuejs.org/user-guide/#compiler-macros-such-as-defineprops-and-defineemits-generate-no-undef-warnings
"Compiler macros such as defineProps and defineEmits generate no-undef warnings" and thus "You need to enable the compiler macros environment in your ESLint configuration file."

What is expected?

No eslint "no-undef" warning when using defineProps, defineEmits, withDefaults.

What is actually happening?

Eslint throws warnings: 'withDefaults' is not defined.


I suggest adding "vue/setup-compiler-macros": true to the default generated eslint config so those warnings don't appear anymore.

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

No branches or pull requests

1 participant