{"record":{"id":"8f20754201eab487","repo":"oxc-project/oxc","slug":"your-render-method-should-have-a-return-statem","errorCode":null,"errorMessage":"Your `render` method should have a `return` statement.","messagePattern":"Your `render` method should have a `return` statement\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/react/require_render_return.rs","lineNumber":18,"sourceCode":"use oxc_ast::{AstKind, ast::Expression};\nuse oxc_cfg::{\n    EdgeType, Instruction, InstructionKind, ReturnInstructionKind,\n    graph::visit::neighbors_filtered_by_edge_weight,\n};\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::{GetSpan, Span};\n\nuse crate::{\n    AstNode,\n    context::{ContextHost, LintContext},\n    rule::Rule,\n    utils::{is_es5_component, is_es6_component},\n};\n\nfn require_render_return_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Your `render` method should have a `return` statement.\")\n        .with_help(\"When writing the `render` method in a component it is easy to forget to return the JSX content. This rule will warn if the `return` statement is missing.\")\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct RequireRenderReturn;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// Require render methods in ES5 and ES2015 React components to return a value.\n    ///\n    /// This rule is not relevant for function components, and so can potentially be\n    /// disabled for modern React codebases.\n    ///\n    /// ### Why is this bad?\n    ///\n    /// When writing the `render` method in a component it is easy to forget to return the","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/react/require_render_return.rs#L1-L36","documentation":"Raised by react/require_render_return when a class component's `render` method lacks a return statement (or has one only on some control-flow paths). At the throw site render must return a React element or null; returning undefined makes React throw 'Nothing was returned from render'. The rule walks the render method's control-flow graph (via oxc_cfg) checking every terminal path, and require_render_return_diagnostic fires from run() when a path terminates without a return instruction carrying a value.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/react/require_render_return.rs:18 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add a return statement covering all branches of the render method.","Return null when nothing should be rendered."],"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"}