Skip to content

Rule Change: add siblingsOnly option to no-duplicate-headings rule #390

@xbinaryx

Description

@xbinaryx
Contributor

What rule do you want to change?

no-duplicate-headings

What change do you want to make?

Generate fewer warnings

How do you think the change should be implemented?

A new option

Example code

# Change log

## 1.0.0

### Features
### Bug Fixes

## 2.0.0

### Features
### Bug Fixes

What does the rule currently do for this code?

Currently, the no-duplicate-headings rule would flag all duplicate headings at the same level, regardless of their parent heading context. For the example above, it would report:

Duplicate heading "Features" found
Duplicate heading "Bug Fixes" found

What will the rule do after it's changed?

With the new siblingsOnly: true option enabled, the rule will only check for duplicates among headings that share the same immediate parent heading.

For the example changelog:

  • No violations will be reported
  • Each "Features" heading is allowed because they have different parent headings ("1.0.0" vs "2.0.0")
  • Similarly, the "Bug Fixes" headings are allowed

Participation

  • I am willing to submit a pull request to implement this change.

Additional comments

Prior Art: MD024

Activity

moved this from Needs Triage to Ready to Implement in Triageon May 28, 2025
nzakas

nzakas commented on May 28, 2025

@nzakas
Member

Sounds good to me. 👍

moved this from Ready to Implement to Implementing in Triageon May 31, 2025
moved this from Implementing to Complete in Triageon Jun 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Complete

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @nzakas@xbinaryx

    Issue actions

      Rule Change: add siblingsOnly option to no-duplicate-headings rule · Issue #390 · eslint/markdown