{"record":{"id":"5c2d0ec4881491f3","repo":"oxc-project/oxc","slug":"expected-to-return-a-true-value-in-name-emits","errorCode":null,"errorMessage":"Expected to return a true value in \"{name}\" emits validator.","messagePattern":"Expected to return a true value in \"(.+?)\" emits validator\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/vue/return_in_emits_validator.rs","lineNumber":24,"sourceCode":"use oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_semantic::ScopeFlags;\nuse oxc_span::Span;\n\nuse crate::{\n    AstNode, context::LintContext, frameworks::FrameworkOptions, rule::Rule,\n    utils::is_vue_component_options_object,\n};\n\nfn expected_boolean_diagnostic(span: Span, name: &str) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\n        \"Expected to return a boolean value in \\\"{name}\\\" emits validator.\"\n    ))\n    .with_label(span)\n}\n\nfn expected_true_diagnostic(span: Span, name: &str) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\"Expected to return a true value in \\\"{name}\\\" emits validator.\"))\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct ReturnInEmitsValidator;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// Enforce that a `return` statement is present in `emits` validators\n    /// (in Vue.js 3.0.0+).\n    ///\n    /// ### Why is this bad?\n    ///\n    /// An `emits` validator must return a boolean indicating whether the\n    /// emitted payload is valid. Forgetting to return a value (or returning\n    /// only falsy values) makes the validator effectively reject every emit,\n    /// breaking the component contract silently.","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/vue/return_in_emits_validator.rs#L6-L42","documentation":"Emitted by run of the vue return-in-emits-validator rule (expected_true_diagnostic) when an emits validator always returns the same value such as literal true regardless of the payload, meaning it performs no actual validation. It is a semantic guard against no-op validators.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/vue/return_in_emits_validator.rs:24 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Implement a real predicate that inspects the event payload","Remove the validator entirely if all values are acceptable"],"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"}