{"record":{"id":"75152cbdc065927b","repo":"oxc-project/oxc","slug":"function-name-func-name-should-not-match-prope","errorCode":null,"errorMessage":"Function name `{func_name}` should not match property name `{name}`.","messagePattern":"Function name `(.+?)` should not match property 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 + property' arm of oxlint's func-name-matching port (crates/oxc_linter/src/rules/eslint/func_name_matching.rs:46). When the rule is configured with mode `never` (FuncNameMatchingMode::Never), a named function expression used as an object property whose name EQUALS the property name is reported as redundant — the property already conveys the name.","triggerScenarios":"`{ save: function save(data) {} }` with the rule configured as [\"warn\", \"never\"].","commonSituations":"Teams adopting the `never` style after writing matching names; ESLint configs migrated with the mode flipped; generated object literals.","solutions":["Remove the redundant name: use shorthand method syntax `save(data) {}` or an anonymous function.","If matching names are your convention, switch the mode back to `always` (the default)."],"exampleFix":"// before\nconst store = {\n  save: function save(data) { /* ... */ }\n};\n\n// after\nconst store = {\n  save(data) { /* ... */ }\n};","handlingStrategy":"validation","validationCode":"// .oxlintrc.json\n{\n  \"rules\": {\n    \"func-name-matching\": [\"warn\", \"never\"]\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use shorthand method syntax so no redundant name exists at all.","Do not flip the mode per-file; settle one convention in the shared config.","When migrating from ESLint, double-check which mode the old config used."],"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-14T00:17:10.932Z"}