-
Notifications
You must be signed in to change notification settings - Fork 72
feat: add checkSiblingsOnly option to no-duplicate-headings rule #393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new siblingsOnly option to the no-duplicate-headings rule so that duplicate heading checks may be applied only among headings that share the same parent.
- Added a siblingsOnly boolean option in the rule’s schema and updated the implementation to track headings by level.
- Updated tests and documentation to verify the behavior for ATX and setext-style headings.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
tests/rules/no-duplicate-headings.test.js | New test cases validating the siblingsOnly behavior for both valid and invalid heading structures. |
src/rules/no-duplicate-headings.js | Modified duplicate heading tracking logic to support the siblingsOnly option using level-based tracking instead of a global set. |
docs/rules/no-duplicate-headings.md | Updated documentation with options and examples for the new siblingsOnly setting. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking this issue. I've left some comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Would like @lumirlumir to re-review before merging.
@xbinaryx please double-check your spam folder, I sent you an email. 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, Thanks!
Prerequisites checklist
What is the purpose of this pull request?
This PR adds a new siblingsOnly option to the no-duplicate-headings rule to make it more flexible. Currently, the rule flags any duplicate headings in the entire document, which can be too restrictive in some cases. With this new option, users can configure the rule to only check for duplicate headings among siblings (headings at the same level under the same parent heading).
What changes did you make? (Give an overview)
Added a new siblingsOnly boolean option to the rule's schema and refactored the implementation to track headings by level, resetting tracking when moving between levels when siblingsOnly is enabled. Updated documentation and added test cases for both ATX and setext-style headings to verify the new behavior.
Related Issues
Fixes #390
Is there anything you'd like reviewers to focus on?