Skip to content

Vue 3.3 throws vue/no-undef-properties for types exported from external files #2183

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

Closed
tragid opened this issue May 18, 2023 · 1 comment · Fixed by #2186
Closed

Vue 3.3 throws vue/no-undef-properties for types exported from external files #2183

tragid opened this issue May 18, 2023 · 1 comment · Fixed by #2186
Labels

Comments

@tragid
Copy link

tragid commented May 18, 2023

Tell us about your environment

  • ESLint version: 8.40.0
  • eslint-plugin-vue version: 9.13.0
  • Node version: 18.16.0
  • Operating System: MacOs 13.3.1

Please show your full configuration:

module.exports = {
  root: true,
  env: {
    node: true,
  },
  extends: [
    'plugin:vue/vue3-essential',
    '@vue/airbnb',
    '@vue/typescript/recommended',
  ],
  parserOptions: {
    ecmaVersion: 2020,
  },
  rules: {
    'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
    'no-undef': 'off',
    'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
    'import/prefer-default-export': 'off',
    'import/extensions': 'off',
    'import/no-unresolved': 'off',
    'no-shadow': 'off',
    semi: 'off',
    'vue/no-undef-properties': 'warn',
  },
};

What did you do?

<script setup lang="ts">
import {
  ref,
  watch,
} from 'vue';
import type { TestComponentProps } from './types';

const props = defineProps<TestComponentProps>();

const counter = ref(0);

watch(() => props.msg, () => {
  counter.value += 1;
}, {
  immediate: true,
});
</script>

<template>
  <div>{{ msg }}</div>
  <div>Changes: {{ counter }}</div>
</template>

What did you expect to happen?
No vue/no-undef-properties error thrown!

What actually happened?
ESLint: 'msg' is not defined.(vue/no-undef-properties)

Repository to reproduce this issue
https://github.com/tragid/vue-default-export-error

@ota-meshi
Copy link
Member

Thank you for posting this issue and sharing the repository.

It seems like a bug. I will fix it in the next release.

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

Successfully merging a pull request may close this issue.

2 participants