oxc-project/oxc · error · OxcDiagnostic

Custom events are not defined.

Error message

Custom events are not defined.

What it means

Emitted by run_once of the vue valid-define-emits rule when a defineEmits call declares an empty list/type — no custom events at all. It is a validation guard: an empty declaration is usually a mistake and typically should not exist.

Source

Thrown at crates/oxc_linter/src/rules/vue/valid_define_emits.rs:29

};

fn has_type_and_arguments_diagnostic(span: Span) -> OxcDiagnostic {
    OxcDiagnostic::warn("`defineEmits` has both a type-only emit and an argument.")
        .with_help("remove the argument for better type inference.")
        .with_label(span)
}

fn called_multiple_times(span: Span, second_span: Span) -> OxcDiagnostic {
    OxcDiagnostic::warn("`defineEmits` has been called multiple times.")
        .with_help("combine all events into a single `defineEmits` call.")
        .with_labels([
            span.label("`defineEmits` is called here"),
            second_span.label("`defineEmits` is called here too"),
        ])
}

fn events_not_defined(span: Span) -> OxcDiagnostic {
    OxcDiagnostic::warn("Custom events are not defined.")
        .with_help("Define at least one event in `defineEmits`.")
        .with_label(span)
}

fn referencing_locally(span: Span) -> OxcDiagnostic {
    OxcDiagnostic::warn("`defineEmits` is referencing locally declared variables.")
        .with_help("inline the variable or import it from another module.")
        .with_label(span)
}

fn define_in_both(span: Span) -> OxcDiagnostic {
    OxcDiagnostic::warn("Custom events are defined in both `defineEmits` and `export default {}`.")
        .with_help("Remove `export default`.")
        .with_label(span)
}

#[derive(Debug, Default, Clone)]
pub struct ValidDefineEmits;

View on GitHub (pinned to e1e7af627c)

Solutions

  1. Define at least one event in the defineEmits declaration
  2. Remove the empty defineEmits call if the component emits no events
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/oxc_linter/src/rules/vue/valid_define_emits.rs:29 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of oxc-project/oxc@e1e7af627c (2026-08-20). Data as JSON: /api/errors/e50429af1b0d1f6b. Report an issue: GitHub.