{"record":{"id":"889a39e57c596e2a","repo":"oxc-project/oxc","slug":"function-name-func-name-should-match-property","errorCode":null,"errorMessage":"Function name `{func_name}` should match property name `{name}`.","messagePattern":"Function name `(.+?)` should 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 'always + property' arm of oxlint's func-name-matching port (crates/oxc_linter/src/rules/eslint/func_name_matching.rs:46). In the default mode `always`, a named function expression used as an object property must have the same name as the property; this message is selected when the property-variant mismatch occurs. The shared help suggests renaming the function or the variable/property so the names satisfy the rule.","triggerScenarios":"`const obj = { load: function loadFromDisk() {} }` — the property name differs from the function expression's name under mode `always` (the FuncNameMatchingMode default).","commonSituations":"Deliberately different implementation names for recursion or aliasing; renaming properties without updating function names; code generation that suffixes implementation names.","solutions":["Drop the redundant name so the property name applies: use shorthand method syntax or an anonymous function.","Rename the function expression to match the property.","If different names are intended, switch the rule mode to `never` or disable it."],"exampleFix":"// before\nconst api = {\n  load: function loadFromDisk() { /* ... */ }\n};\n\n// after\nconst api = {\n  load() { /* ... */ }\n};","handlingStrategy":"validation","validationCode":"// .oxlintrc.json — pick a mode that matches your naming convention\n{\n  \"rules\": {\n    \"func-name-matching\": [\"warn\", \"always\"]\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer shorthand method syntax `{ load() {} }` — it cannot mismatch.","When renaming a property or variable, rename the assigned function in the same change.","Use `never` mode only team-wide; mixing modes across configs causes churn."],"tags":["eslint","oxlint","naming","function-expression"],"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"}