{"record":{"id":"d8ec682f0c969001","repo":"oxc-project/oxc","slug":"unexpected-unnamed-inferred-name-or-description","errorCode":null,"errorMessage":"Unexpected unnamed {inferred_name_or_description}.","messagePattern":"Unexpected unnamed (.+?)\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/eslint/func_names.rs","lineNumber":35,"sourceCode":"use schemars::JsonSchema;\nuse serde::Deserialize;\n\nuse crate::{\n    AstNode,\n    ast_util::get_function_name_with_kind,\n    context::LintContext,\n    fixer::{RuleFix, RuleFixer},\n    rule::{Rule, TupleRuleConfig},\n};\n\nfn named_diagnostic(function_name: &str, span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\"Unexpected named {function_name}.\"))\n        .with_label(span)\n        .with_help(\"Remove the name on this function expression.\")\n}\n\nfn unnamed_diagnostic(inferred_name_or_description: &str, span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\"Unexpected unnamed {inferred_name_or_description}.\"))\n        .with_label(span)\n        .with_help(\"Consider giving this function expression a name.\")\n}\n\n#[derive(Debug, Default, Clone, Copy, PartialEq, JsonSchema, Deserialize)]\n#[serde(rename_all = \"kebab-case\")]\nenum FuncNamesConfigType {\n    /// Requires all function expressions to have a name.\n    #[default]\n    Always,\n    /// Requires a name only if one is not automatically inferred.\n    AsNeeded,\n    /// Disallows names for function expressions.\n    Never,\n}\n\n#[derive(Debug, Default, Clone, JsonSchema, Deserialize)]\n#[serde(default)]","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/eslint/func_names.rs#L17-L53","documentation":"Lint diagnostic from eslint/func-names: an anonymous function expression was found in a position where no name can be inferred (e.g. an IIFE or an unassigned expression), so the function will show as '(anonymous)' in stack traces and profilers.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/eslint/func_names.rs:35 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Give the function expression a name","Assign the expression to a variable or property so a name can be inferred","Configure the rule (allowExpressions/allowAnonymousFunctions equivalents) if anonymous functions are intentional in this position"],"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"}