Closed henribru closed 3 weeks ago
Checklist
Tell us about your environment
Please show your full configuration:
import pluginVue from 'eslint-plugin-vue' import vueTsEslintConfig from '@vue/eslint-config-typescript' import pluginVitest from '@vitest/eslint-plugin' import skipFormatting from '@vue/eslint-config-prettier/skip-formatting' export default [ { name: 'app/files-to-lint', files: ['**/*.{ts,mts,tsx,vue}'], }, { name: 'app/files-to-ignore', ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**'], }, ...pluginVue.configs['flat/essential'], ...vueTsEslintConfig(), { ...pluginVitest.configs.recommended, files: ['src/**/__tests__/*'], }, skipFormatting, { rules: { "vue/custom-event-name-casing": "error" } } ]
What did you do?
<script setup lang="ts"> const emit = defineEmits({ 'foo-bar': () => true }) emit('foo-bar') </script> <template> <button @click="emit('foo-bar')">Foo</button> <button @click="$emit('foo-bar')">Foo</button> </template>
What did you expect to happen? ESLint should flag all three emits because they all use kebab case instead of camelcase.
What actually happened?
It flags the one in script setup and the one using $emit in the template, but not the one using emit.
$emit
emit
➜ vue-project npm run lint > vue-project@0.0.0 lint > eslint . --fix /home/.../dev/vue-project/src/components/HelloWorld.vue 4:6 error Custom event name 'foo-bar' must be camelCase vue/custom-event-name-casing 9:25 error Custom event name 'foo-bar' must be camelCase vue/custom-event-name-casing ✖ 2 problems (2 errors, 0 warnings)
Repository to reproduce this issue
https://github.com/henribru/eslint-plugin-vue-custom-event-name-casing-bug
Checklist
Tell us about your environment
Please show your full configuration:
What did you do?
What did you expect to happen? ESLint should flag all three emits because they all use kebab case instead of camelcase.
What actually happened?
It flags the one in script setup and the one using
$emit
in the template, but not the one usingemit
.Repository to reproduce this issue
https://github.com/henribru/eslint-plugin-vue-custom-event-name-casing-bug