oxc-project/oxc · error · OxcDiagnostic

Duplicate @property found.

Error message

Duplicate @property found.

What it means

Fires from jsdoc/check-property-names when two or more @property tags in the same JSDoc block declare the same name path. run_once groups collected spans by type_name and reports groups with more than one span, labeling every duplicate occurrence.

Source

Thrown at crates/oxc_linter/src/rules/jsdoc/check_property_names.rs:109

                    // `foo[].bar` -> `foo[]` -> `foo`
                    let parent_name = type_name[..dot_idx].trim_end_matches("[]");

                    if !seen.contains_key(&parent_name) {
                        ctx.diagnostic(no_root(name_part.span, type_name));
                    }
                }

                // Check duplicated(report later)
                seen.entry(type_name).or_default().insert(name_part.span);
            }

            for (type_name, spans) in seen.iter().filter(|(_, spans)| 1 < spans.len()) {
                let labels = spans
                    .iter()
                    .map(|span| LabeledSpan::at(span.start..span.end, "Duplicated property"))
                    .collect::<Vec<_>>();
                ctx.diagnostic(
                    OxcDiagnostic::warn("Duplicate @property found.")
                        .with_help(format!(
                            "@property `{type_name}` is duplicated on the same block."
                        ))
                        .with_labels(labels),
                );
            }
        }
    }
}

#[test]
fn test() {
    use crate::tester::Tester;

    let pass = vec![
        (
            "
			          /**

View on GitHub (pinned to e1e7af627c)

Solutions

  1. Remove the duplicate @property tag
  2. If duplicates differ by type path, correct the name so each path is unique
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/oxc_linter/src/rules/jsdoc/check_property_names.rs:109 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of oxc-project/oxc@e1e7af627c (2026-08-20). Data as JSON: /api/errors/3433d87e8a7745c5. Report an issue: GitHub.