-
-
Notifications
You must be signed in to change notification settings - Fork 669
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
vue/require-explicit-emits
not picking up listed emits
in different cases
#1347
Comments
I am not sure it's a bug. I guess it will be harder to change Vue3 runtime than the plugin? |
Hmm... I started looking into this, but if I don't match the cases, the Type check will probably result in an error. emits: ["fooBar"],
methods: {
handleClick() {
this.$emit("foo-bar") // <- Argument of type '"foo-bar"' is not assignable to parameter of type '"fooBar"'.
}
} |
The documentation says that events emitted by camelCase cannot be listened to by kebab-case v-on, but it may actually work. https://v3.vuejs.org/guide/component-custom-events.html#event-names If this behavior is what Vue intended, the following source code may be correct. <template>
<h1>Vue3 Fragment</h1>
<div @click="$emit('fooBar')">
FooBar
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
export default defineComponent({
name: 'FooBar',
emits: ['fooBar'],
});
</script> <template>
<FooBar @foo-bar="onFooBar" />
</template> If so, we need to turn off the |
thx. i will turn off Vue3 recommendation should be the other way around? XD |
You need to add https://eslint.vuejs.org/user-guide/#trouble-with-visual-studio-code |
thx. i thought it would conflict with |
Checklist
Tell us about your environment
Please show your full configuration:
What did you do?
What did you expect to happen?
No lint warning or error in this case.
If I changed it to
emits: ['foo-bar']
, I would get a warning message in browsers console:What actually happened?
Repository to reproduce this issue
https://github.com/jameschenjav/eslint-plugin-vue-147
The text was updated successfully, but these errors were encountered: