-
-
Notifications
You must be signed in to change notification settings - Fork 695
Open
Labels
@lukasz-fi
Description
Checklist
- I have tried restarting my IDE and the issue persists.
- I have read the FAQ and my problem is not listed.
Tell us about your environment
- ESLint version: 8.57.0
- eslint-plugin-vue version: 9.27.0
- Vue version: 3.4.30
- Node version: 20.15.0
- Operating System: MacOS 14.5
Please show your full configuration:
.eslintrc.cjs
/* eslint-env node */ require('@rushstack/eslint-patch/modern-module-resolution'); module.exports = { extends: [ 'plugin:vue/vue3-recommended', '@vue/eslint-config-typescript/recommended', '@vue/eslint-config-prettier/skip-formatting', ], overrides: [ { files: ['*.ts'], parser: '@typescript-eslint/parser', plugins: ['@typescript-eslint'], }, { files: '*.vue', rules: { 'vue/no-unused-properties': 2, }, }, ], parserOptions: { ecmaVersion: 'latest', }, root: true, };
What did you do?
This throws 'example' of property found, but never used vue/no-unused-properties:
<script lang="ts" setup> import { useExample } from '@/utils/example'; const props = defineProps<{ /** * Example prop. */ example: boolean; }>(); const { text } = useExample(props); </script> <template> {{ text }} </template>
When the useExample is in the same file then there is no error:
<script lang="ts"> export const useExample = (props: { example?: boolean }): { text: string } => { return { text: props.example ? 'Example' : 'Test' }; }; </script> <script lang="ts" setup> const props = defineProps<{ /** * Example prop. */ example: boolean; }>(); const { text } = useExample(props); </script> <template> {{ text }} </template>
What did you expect to happen?
In both cases the prop example should be recognized as used.
What actually happened?
> eslint . --max-warnings=0 [path]/TestExample.vue 8:3 error 'example' of property found, but never used vue/no-unused-properties ✖ 1 problem (1 error, 0 warnings)
Repository to reproduce this issue
Minimal reproduction code is above.