Skip to content

New Rule: no-empty-definitions #359

@lumirlumir

Description

@lumirlumir
Member

Rule details

Rule to disallow empty definitions

What type of rule is this?

Warns about a potential problem

Example code

<!-- OK -->

[earth]: https://example.com/earth/ // Valid

<!-- ERROR -->

[earth]: <> // Error
[earth]: // Error

Participation

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

Additional comments

Hello,

I'd like to propose a new rule called no-empty-definitions.

This suggestion arose while I was working on a PR for the no-empty-images rule.
(Reference: #357 (comment))

Currently, the remark-lint-no-empty-url rule handles a mix of different concerns — specifically no-empty-links, no-empty-images, and no-empty-definitions.

  • no-empty-links is already implemented in @eslint/markdown
  • no-empty-images is currently under development
  • no-empty-definitions is what I’m proposing here

Initially, I considered unifying these into a single rule, such as no-empty-urls. However, doing so would likely require merging no-empty-links into it as well, since their logic would overlap. This, in turn, could introduce a breaking change.

To avoid that, I’d like to suggest creating a separate rule specifically for empty definitions: no-empty-definitions. This approach keeps the responsibilities clearly separated and avoids introducing any breaking changes to existing rules.


If this suggestion is accepted, I’d be happy if you could assign it to me! I’ll make sure to complete it by May 14.

Activity

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

nzakas commented on May 5, 2025

@nzakas
Member

I think this makes sense. 👍

Pixel998

Pixel998 commented on May 5, 2025

@Pixel998
Contributor

@nzakas Since @lumirlumir is already covering the other two rules, would you mind if I take on this one?

nzakas

nzakas commented on May 5, 2025

@nzakas
Member

That's up to @lumirlumir.

lumirlumir

lumirlumir commented on May 6, 2025

@lumirlumir
MemberAuthor

@Pixel998

If you'd prefer to take it, feel free — I'm happy to step aside.

But please note that [earth]: would be recognized as a normal text node, not a definition node. So, we need to handle this situation. AST

Pixel998

Pixel998 commented on May 6, 2025

@Pixel998
Contributor

Thanks @lumirlumir! I will keep this in mind.

moved this from Ready to Implement to Implementing in Triageon May 9, 2025
moved this from Implementing to Complete in Triageon May 14, 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@lumirlumir@Pixel998

    Issue actions

      New Rule: `no-empty-definitions` · Issue #359 · eslint/markdown