Skip to content

Latest commit

 

History

History
57 lines (32 loc) · 1.28 KB

File metadata and controls

57 lines (32 loc) · 1.28 KB

no-missing-label-refs

Disallow missing label references.

Background

Markdown allows you to specify a label as a placeholder for a URL in both links and images using square brackets, such as:

[ESLint][eslint]

[eslint]: https://eslint.org

If the label is never defined, then Markdown doesn't render a link and instead renders plain text.

Rule Details

This rule warns when it finds text that looks like it's a label but the label reference doesn't exist.

Examples of incorrect code for this rule:

<!-- eslint markdown/no-missing-label-refs: "error" -->

[ESLint][eslint]

[eslint][]

[eslint]

Options

The following options are available on this rule:

  • allowLabels: Array<string> - labels to allow when checking for missing label references. (default: [])

Examples of correct code when configured as "no-missing-label-refs": ["error", { allowLabels: ["eslint"] }]:

<!-- eslint markdown/no-missing-label-refs: ["error", { allowLabels: ["eslint"] }] -->

[ESLint][eslint]

[eslint][]

[eslint]

When Not to Use It

If you aren't concerned with missing label references, you can safely disable this rule.

Prior Art