{"record":{"id":"52b6f371aa030b55","repo":"oxc-project/oxc","slug":"defineemits-has-been-called-multiple-times","errorCode":null,"errorMessage":"`defineEmits` has been called multiple times.","messagePattern":"`defineEmits` has been called multiple times\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/vue/valid_define_emits.rs","lineNumber":20,"sourceCode":"use oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::Span;\n\nuse crate::{\n    context::LintContext,\n    frameworks::FrameworkOptions,\n    rule::Rule,\n    utils::{DefineMacroProblem, check_define_macro_call_expression, has_default_exports_property},\n};\n\nfn has_type_and_arguments_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"`defineEmits` has both a type-only emit and an argument.\")\n        .with_help(\"remove the argument for better type inference.\")\n        .with_label(span)\n}\n\nfn called_multiple_times(span: Span, second_span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"`defineEmits` has been called multiple times.\")\n        .with_help(\"combine all events into a single `defineEmits` call.\")\n        .with_labels([\n            span.label(\"`defineEmits` is called here\"),\n            second_span.label(\"`defineEmits` is called here too\"),\n        ])\n}\n\nfn events_not_defined(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Custom events are not defined.\")\n        .with_help(\"Define at least one event in `defineEmits`.\")\n        .with_label(span)\n}\n\nfn referencing_locally(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"`defineEmits` is referencing locally declared variables.\")\n        .with_help(\"inline the variable or import it from another module.\")\n        .with_label(span)\n}","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/vue/valid_define_emits.rs#L2-L38","documentation":"Emitted by run_once of the vue valid-define-emits rule when the defineEmits macro is invoked more than once in the same <script setup> block. The compiler only supports one declaration; both call sites are labeled in the diagnostic.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/vue/valid_define_emits.rs:20 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Merge all events into a single defineEmits call, e.g. defineEmits(['change', 'input']) or one combined type literal"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}