{"record":{"id":"f8bf67d115a42a62","repo":"oxc-project/oxc","slug":"defineemits-has-both-a-type-only-emit-and-an-arg","errorCode":null,"errorMessage":"`defineEmits` has both a type-only emit and an argument.","messagePattern":"`defineEmits` has both a type-only emit and an argument\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/vue/valid_define_emits.rs","lineNumber":14,"sourceCode":"use oxc_ast::AstKind;\nuse 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}","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/vue/valid_define_emits.rs#L1-L32","documentation":"Emitted by run_once of the vue valid-define-emits rule (via check_define_macro_call_expression) when a defineEmits macro call supplies both a type-only declaration (type parameter) and a runtime argument. The two declaration forms conflict; only one should be used, and the runtime argument defeats the type inference of the type parameter.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/vue/valid_define_emits.rs:14 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the runtime argument and keep only the type-based declaration","Or remove the type parameter and keep the runtime declaration if consistent with project style"],"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-14T00:17:10.932Z"}