AphrodyBun GitHub

Runtime docs · Linter · Rules

markdown/no-empty-definitions

Disallow empty definitions

A definition whose URL is <> or # is a placeholder that nobody came back to. Every link that uses it leads nowhere. In markdown/gfm, a footnote definition with nothing in it, or with nothing but HTML comments, is reported too.

Configure

Off by default. It needs an ESLint config that says which files are in the language:

eslint.config.js
import markdown from "@eslint/markdown";

export default [
  {
    files: ["**/*.md"],
    plugins: { markdown },
    language: "markdown/commonmark",
    rules: { "markdown/no-empty-definitions": "error" },
  },
];

It also works with markdown/gfm.

Examples

Reported:

Read the [guide] and the [reference].

[guide]: <>
[reference]: #
It is fast.[^1]

[^1]:

Not reported:

Read the [guide].

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

Options

OptionDefaultWhat it does
allowDefinitions["//"]Labels whose definition may be empty.
allowFootnoteDefinitions[]Footnote labels whose definition may be empty.
checkFootnoteDefinitionstrueCheck footnote definitions too.

[//]: # (text) is a common way to write a comment, which is why // is allowed:

[//]: # (This is a comment)
[todo]: #