{"record":{"id":"f4a10380b1c85e6c","repo":"oxc-project/oxc","slug":"function-name-func-name-should-not-match-varia","errorCode":null,"errorMessage":"Function name `{func_name}` should not match variable name `{name}`.","messagePattern":"Function name `(.+?)` should not match variable name `(.+?)`\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"warning","filePath":"crates/oxc_linter/src/rules/eslint/func_name_matching.rs","lineNumber":46,"sourceCode":"    mode: FuncNameMatchingMode,\n    span: Span,\n) -> OxcDiagnostic {\n    let msg = match (mode, is_property) {\n        (FuncNameMatchingMode::Always, true) => {\n            format!(\"Function name `{func_name}` should match property name `{name}`.\")\n        }\n        (FuncNameMatchingMode::Always, false) => {\n            format!(\"Function name `{func_name}` should match variable name `{name}`.\")\n        }\n        (FuncNameMatchingMode::Never, true) => {\n            format!(\"Function name `{func_name}` should not match property name `{name}`.\")\n        }\n        (FuncNameMatchingMode::Never, false) => {\n            format!(\"Function name `{func_name}` should not match variable name `{name}`.\")\n        }\n    };\n\n    OxcDiagnostic::warn(msg)\n        .with_help(\"Rename the function or the variable/property so the names satisfy this rule.\")\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]\n#[serde(rename_all = \"kebab-case\")]\nenum FuncNameMatchingMode {\n    #[default]\n    Always,\n    Never,\n}\n\n#[derive(Debug, Default, Clone, Serialize, Deserialize, JsonSchema)]\n#[serde(rename_all = \"camelCase\", deny_unknown_fields)]\nstruct FuncNameMatchingConfig {\n    #[serde(default)]\n    /// If `considerPropertyDescriptor` is set to `true`, the check will take into account the use of `Object.create`, `Object.defineProperty`, `Object.defineProperties`, and `Reflect.defineProperty`.\n    consider_property_descriptor: bool,","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/eslint/func_name_matching.rs#L28-L64","documentation":"The 'never + variable' arm of oxlint's func-name-matching port (crates/oxc_linter/src/rules/eslint/func_name_matching.rs:46). Under mode `never`, a named function expression whose name equals the variable it is assigned to is reported: `const foo = function foo() {}` duplicates the name that assignment already provides.","triggerScenarios":"`const fetchUser = function fetchUser() {}` with the rule configured as [\"warn\", \"never\"].","commonSituations":"Names duplicated for stack-trace clarity inside a `never`-mode codebase; ESLint parity configs where the mode was inverted during migration.","solutions":["Drop the function expression's name (make it anonymous or an arrow function).","Use a function declaration if a name is required.","If you want names everywhere, configure the mode as `always` instead."],"exampleFix":"// before\nconst fetchUser = function fetchUser(id) { /* ... */ };\n\n// after\nconst fetchUser = (id) => { /* ... */ };","handlingStrategy":"validation","validationCode":"// .oxlintrc.json\n{\n  \"rules\": {\n    \"func-name-matching\": [\"warn\", \"never\"]\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use anonymous or arrow function expressions under `never` mode.","Use declarations when a name is required for recursion or stack clarity.","Keep the mode in sync with the team's stack-trace policy."],"tags":["eslint","oxlint","naming","function-expression","redundant-name"],"backgroundTag":"function-name-mismatch","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"}