Vize

script/custom-event-name-casing

Enforce camelCase for emitted custom event names

Bad · Good

Default severity: error
Presets: none
Automatic fix: None; review the suggested change
Applies to: JS/TS scripts in Vue SFCs; examples show the relevant Options API or script setup form
Options: See typed options and defaults.

Configuration (Vite+)

import { defineConfig } from "@vizejs/vite-plugin/vite-plus";

export default defineConfig({
  lint: {
    vize: {
      "preset": "incremental",
      "rules": {
        "script/custom-event-name-casing": "error"
      }
    },
  },
});
vp run lint

Bad

The emitted string my-event contains a hyphen and violates the default camelCase event naming policy.

<script setup lang="ts">
const emit = defineEmits(['my-event'])
emit('my-event')         // kebab-case → report
</script>

Good

Both the declaration and call use myEvent, preserving agreement between the event name and its emission while satisfying the default casing policy. A configured kebab-case policy has a different expectation.

<script setup lang="ts">
const emit = defineEmits(['myEvent'])
emit('myEvent')
</script>

Good avoids this rule's finding under the configuration above; other rules may still report diagnostics.

Implementation · All rules