Skip to content

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

Closed
@tragid

Description

@tragid

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions