Closed
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.3.0
- eslint-plugin-vue version: 8.1.1
- Node version: v16.11.0
- Operating System: Windows 10
Please show your full configuration:
// http://eslint.org/docs/user-guide/configuring
module.exports = {
root: true,
env: {
browser: true,
},
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
extends: ['plugin:vue/vue3-recommended', 'plugin:prettier/recommended'],
// required to lint *.vue files
plugins: ['html'],
parserOptions: {
ecmaVersion: 2020,
ecmaFeatures: {
jsx: true,
},
},
// add your custom rules here
rules: {
'prettier/prettier': [
'error',
{
endOfLine: 'auto',
semi: true,
singleQuote: true,
trailingComma: 'es5',
},
],
// allow paren-less arrow functions
'arrow-parens': 0,
// allow async-await
'generator-star-spacing': 0,
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
'vue/multi-word-component-names': 0,
'vue/no-v-html': 0,
},
};
What did you do?
<script setup>
import { linkProps } from '../../props/link.props';
defineProps({
...linkProps,
active: { type: Boolean, default: false },
});
</script>
What did you expect to happen?
No error should be reported. as the document https://v3.vuejs.org/api/sfc-script-setup.html#defineprops-and-defineemits said:
However, it can reference imported bindings since they are in the module scope as well.
It does not require the import statement to inside a normal script instead of setup script.
What actually happened?
ESLint: `defineProps` are referencing locally declared variables.(vue/valid-define-props)
Repository to reproduce this issue
https://github.com/uiv-lib/uiv/blob/dev/src/components/button/Btn.vue
just change the import statement from normal script to setup script to see what happen.