Skip to content

Conversation

@lumirlumir
Copy link
Member

@lumirlumir lumirlumir commented Jun 17, 2025

Prerequisites checklist

What is the purpose of this pull request?

In this PR, I've created no-unused-definitions rule.

I've left a few comments on some key parts.

This PR resolves #424.

What changes did you make? (Give an overview)

I've created no-unused-definitions rule.

Related Issues

Fixes: #424

Is there anything you'd like reviewers to focus on?

@lumirlumir lumirlumir changed the title feat: create no-unused-definition rule feat: create no-unused-definitions rule Jun 17, 2025

defaultOptions: [
{
allowDefinitions: ["//"],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

footnoteDefinitions.add(node);
},

"root:exit"() {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"root:exit"() {
"root:exit"() {

In this PR, unlike the no-duplicate-definitions rule, errors should be reported only after all definition and footnoteDefinition nodes have been collected, as Reference and Definition nodes may appear in any order within the document.

@lumirlumir lumirlumir moved this to Needs Triage in Triage Jun 22, 2025
@lumirlumir lumirlumir marked this pull request as ready for review June 22, 2025 14:03
@nzakas nzakas requested a review from Copilot June 23, 2025 15:53
@nzakas nzakas moved this from Needs Triage to Implementing in Triage Jun 23, 2025
Copy link

Copilot AI left a 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 introduces a new ESLint rule no-unused-definitions to detect and report unused Markdown reference and footnote definitions.

  • Adds the rule implementation under src/rules.
  • Provides a comprehensive test suite covering valid/invalid cases.
  • Updates documentation and the main README to include the new rule.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
tests/rules/no-unused-definitions.test.js Adds valid/invalid test cases for the new rule
src/rules/no-unused-definitions.js Implements the no-unused-definitions rule logic
docs/rules/no-unused-definitions.md Documents the rule’s behavior, options, and examples
README.md Registers the rule in the plugin’s rule table
Comments suppressed due to low confidence (1)

docs/rules/no-unused-definitions.md:19

  • [nitpick] Consider replacing the inline HTML comment with a proper Markdown lint directive or moving the note outside the blockquote to improve readability and maintain consistency.
> [!IMPORTANT] <!-- eslint-disable-line -- This should be fixed in https://github.com/eslint/markdown/issues/294 -->

nzakas
nzakas previously approved these changes Jun 24, 2025
Copy link
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one note on the docs and otherwise LGTM. Would like another review before merging.

@nzakas nzakas moved this from Implementing to Second Review Needed in Triage Jun 24, 2025
snitin315
snitin315 previously approved these changes Jun 26, 2025
Copy link
Contributor

@snitin315 snitin315 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@snitin315 snitin315 merged commit 6b43333 into main Jun 27, 2025
23 checks passed
@snitin315 snitin315 deleted the feat-create-no-unused-definition-rule branch June 27, 2025 12:44
@github-project-automation github-project-automation bot moved this from Second Review Needed to Complete in Triage Jun 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

New Rule: no-unused-definition

4 participants