{"record":{"id":"23e5923239fc168a","repo":"oxc-project/oxc","slug":"function-component-is-not-article","errorCode":null,"errorMessage":"Function component is not {article} {}","messagePattern":"Function component is not (.+?) (.+?)","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/react/function_component_definition.rs","lineNumber":22,"sourceCode":"use oxc_ast::{\n    AstKind,\n    ast::{AssignmentTarget, FunctionType, VariableDeclarator},\n};\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::{GetSpan, Span};\n\nuse crate::{\n    AstNode,\n    ast_util::iter_outer_expressions,\n    context::LintContext,\n    rule::{DefaultRuleConfig, Rule},\n    utils::{arrow_function_returns, function_returns, is_hoc_call, is_react_component_name},\n};\n\nfn function_component_definition_diagnostic(span: Span, expected: FunctionStyle) -> OxcDiagnostic {\n    let article = if expected == FunctionStyle::Arrow { \"an\" } else { \"a\" };\n    OxcDiagnostic::warn(format!(\"Function component is not {article} {}\", expected.description()))\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone, Serialize, Deserialize, JsonSchema)]\n#[serde(rename_all = \"camelCase\", default, deny_unknown_fields)]\nstruct FunctionComponentDefinitionConfig {\n    named_components: NamedComponents,\n    unnamed_components: UnnamedComponents,\n}\n\n#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]\n#[serde(untagged)]\nenum NamedComponents {\n    Single(NamedComponentStyle),\n    Multiple(Vec<NamedComponentStyle>),\n}\n\nimpl Default for NamedComponents {","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/react/function_component_definition.rs#L4-L40","documentation":"Raised by react/function-component-definition when a function component's declaration style does not match the configured allowed styles (e.g. the rule is set to arrow functions but the component is a function declaration). The article is 'an' for arrow, 'a' otherwise.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/react/function_component_definition.rs:22 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Rewrite the component in the style required by the rule configuration (arrow function, named function, or function expression).","Adjust the allowedStyles/namedComponents setting to permit the current 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-14T05:17:10.506Z"}