Skip to content

feat: add no-reference-like-urls rule#433

Merged
nzakas merged 13 commits into
eslint:mainfrom
TKDev7:no-reference-like-url
Sep 9, 2025
Merged

feat: add no-reference-like-urls rule#433
nzakas merged 13 commits into
eslint:mainfrom
TKDev7:no-reference-like-url

Conversation

@TKDev7

@TKDev7 TKDev7 commented Jun 23, 2025

Copy link
Copy Markdown
Contributor

Prerequisites checklist

What is the purpose of this pull request?

Add a new rule, no-reference-like-url, to disallow inline links or images when the URL matches a defined reference identifier.

What changes did you make? (Give an overview)

Implemented the no-reference-like-url rule with autofix, added documentation, and included tests.

Related Issues

Fixes #419

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

Comment thread docs/rules/no-reference-like-url.md Outdated
Comment thread docs/rules/no-reference-like-url.md
Comment thread src/rules/no-reference-like-url.js Outdated
Comment thread src/rules/no-reference-like-url.js Outdated
Comment thread tests/rules/no-reference-like-url.test.js Outdated
snitin315
snitin315 previously approved these changes Jun 26, 2025

@snitin315 snitin315 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, thanks. Leaving it open for 2nd review.

@snitin315 snitin315 added this to Triage Jun 26, 2025
@github-project-automation github-project-automation Bot moved this to Needs Triage in Triage Jun 26, 2025
@snitin315 snitin315 moved this from Needs Triage to Second Review Needed in Triage Jun 26, 2025
Comment thread src/rules/no-reference-like-url.js Outdated
Comment thread src/rules/no-reference-like-url.js Outdated

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looking good! No requests from me that aren't already noted. Thanks! 🚀

Comment thread src/rules/no-reference-like-url.js Outdated
Comment thread src/rules/no-reference-like-url.js Outdated
@TKDev7 TKDev7 dismissed stale reviews from JoshuaKGoldberg and snitin315 via a5272a5 June 27, 2025 07:17
Comment thread src/rules/no-reference-like-url.js Outdated
Comment thread src/rules/no-reference-like-url.js Outdated
Comment thread tests/rules/no-reference-like-url.test.js Outdated
Comment thread tests/rules/no-reference-like-url.test.js Outdated
Comment thread tests/rules/no-reference-like-url.test.js Outdated
Comment thread docs/rules/no-reference-like-url.md
Comment thread tests/rules/no-reference-like-url.test.js Outdated
Comment thread tests/rules/no-reference-like-url.test.js Outdated
@nzakas

nzakas commented Jul 11, 2025

Copy link
Copy Markdown
Member

@lumirlumir please take a look at the responses to your comments.

@lumirlumir lumirlumir left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry for the delay on my end. I've responded to your previous comment.

Comment thread tests/rules/no-reference-like-url.test.js Outdated
Comment thread tests/rules/no-reference-like-url.test.js Outdated
Comment thread src/rules/no-reference-like-url.js Outdated
Comment thread src/rules/no-reference-like-url.js Outdated
Comment thread src/rules/no-reference-like-url.js Outdated
Comment thread src/rules/no-reference-like-url.js Outdated

@lumirlumir lumirlumir left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice improvements! I’ve left a few comments about some other cases that are missing.

Comment thread src/rules/no-reference-like-url.js
Comment thread src/rules/no-reference-like-url.js Outdated
Comment thread src/rules/no-reference-like-url.js Outdated
Comment thread tests/rules/no-reference-like-url.test.js
Comment thread tests/rules/no-reference-like-url.test.js
@lumirlumir lumirlumir changed the title feat: add no-reference-like-url rule feat: add no-reference-like-urls rule Aug 4, 2025
Comment thread tests/rules/no-reference-like-urls.test.js
Comment thread tests/rules/no-reference-like-urls.test.js
Comment thread tests/rules/no-reference-like-urls.test.js Outdated
lumirlumir
lumirlumir previously approved these changes Aug 5, 2025

@lumirlumir lumirlumir left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, Would like @snitin315 to verify the changes before merging.

@snitin315 snitin315 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The following case doesn't report any errors, is this expected behavior?

<!-- eslint markdown/no-reference-like-urls: "error" -->

[Mercury](  mercury) is the first planet from the sun.

[mercury]: https://example.com/mercury/

Comment thread src/rules/no-reference-like-urls.js Outdated
@TKDev7

TKDev7 commented Aug 11, 2025

Copy link
Copy Markdown
Contributor Author

@snitin315 This should be fixed now.

@lumirlumir

Copy link
Copy Markdown
Member

ping @snitin315

@nzakas nzakas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since it's been over a month and I've verified the changes, I'm going to merge this.

@nzakas nzakas merged commit 65251ec into eslint:main Sep 9, 2025
23 checks passed
@github-project-automation github-project-automation Bot moved this from Second Review Needed to Complete in Triage Sep 9, 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-reference-like-url

5 participants