{"record":{"id":"47bc8b95ce2cecfc","repo":"oxc-project/oxc","slug":"no-duplicate-props-allowed-the-prop-prop-name","errorCode":null,"errorMessage":"No duplicate props allowed. The prop \"{prop_name}\" is duplicated.","messagePattern":"No duplicate props allowed\\. The prop \"(.+?)\" is duplicated\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/react/jsx_no_duplicate_props.rs","lineNumber":18,"sourceCode":"use oxc_ast::{\n    AstKind,\n    ast::{JSXAttributeItem, JSXAttributeName},\n};\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::Span;\nuse oxc_str::Str;\nuse rustc_hash::FxHashMap;\n\nuse crate::{\n    AstNode,\n    context::{ContextHost, LintContext},\n    rule::Rule,\n};\n\nfn jsx_no_duplicate_props_diagnostic(prop_name: &str, span1: Span, span2: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\n        \"No duplicate props allowed. The prop \\\"{prop_name}\\\" is duplicated.\"\n    ))\n    .with_help(\"Remove one of the props, or rename them so each prop is distinct.\")\n    .with_labels([span1, span2])\n}\n\n#[derive(Debug, Default, Clone)]\npub struct JsxNoDuplicateProps;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// This rule prevents duplicate props in JSX elements.\n    ///\n    /// ### Why is this bad?\n    ///\n    /// Having duplicate props in a JSX element is most likely a mistake.\n    /// Creating JSX elements with duplicate props can cause unexpected behavior in your application.","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/react/jsx_no_duplicate_props.rs#L1-L36","documentation":"Diagnostic from react/jsx-no-duplicate-props (category: correctness). The same attribute name appears twice on one JSX opening element; the diagnostic carries labels on both the original and duplicate spans. React silently applies only the last duplicate prop, so a duplicate almost always hides a bug rather than being intentional. Note: this oxc port intentionally does NOT support the ignoreCase option — props are compared case-sensitively, so <App foo Foo /> is not flagged.","triggerScenarios":"<App a a />, <App foo={2} bar baz foo={3} />, <App a=\"a\" {...this.props} a=\"a\" /> — i.e. the same JSXAttribute identifier name occurring twice among the element's attributes (spread attributes are skipped, only plain attributes are tracked in a name->span map).","commonSituations":"Merging props from multiple sources during refactor (base props + override props copy-pasted); long attribute lists where a prop is added twice by different people; class components migrating defaultProps inline; merge conflicts duplicating an attribute block.","solutions":["Delete one of the duplicated attributes, keeping the intended value (remember React uses the LAST occurrence)","If the duplicate comes from a merge conflict, re-resolve the conflict instead of keeping both sides","If you were relying on eslint-plugin-react's ignoreCase, note it is unsupported here: make casing consistent instead","Add a pre-commit oxlint run so duplicates never land"],"exampleFix":"// before\n<App a=\"1\" b=\"2\" a=\"3\" />\n\n// after\n<App a=\"3\" b=\"2\" />","handlingStrategy":"validation","validationCode":"npx oxlint -D react/jsx-no-duplicate-props src/","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember only the last duplicate prop wins at runtime — treat duplicates as bugs, not warnings","After resolving merge conflicts in JSX files, run oxlint to catch duplicated attribute blocks","This port is case-sensitive and has no ignoreCase option; do not carry over that option when migrating configs"],"tags":["react","jsx","duplicate-props","props","oxlint","lint"],"backgroundTag":"jsx-duplicate-props","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"}