eslint / eslint/markdown

Bug: False positive `markdown/no-missing-label-refs` on GFM Alerts

Open
#294 22 comments 7 reactions 1 assignee Claimed by @lumirlumir View on GitHub
accepted bug repro:yes
Dominant language
JavaScript
Stars
581
Forks
92
Avg merge
1d 4h
Merged PRs (30d)
11

Description

### Environment

ESLint version: 9.12.0
@eslint/markdown version: 6.2.1
Node version: 22.9.0
npm version: 10.8.3
Operating System: macOS 14.7

### Which language are you using?

gfm

### What did you do?

Configuration

```js
import pluginMd from "@eslint/markdown"

export default [
// Silly type narrowing for spreading in full-fledged typechecked `eslint.config.js`
...[pluginMd.configs?.recommended].filter(Boolean).flat(),
{
files: ["**/*.md"],
language: "markdown/gfm",
},
]

```

```md
> [!NOTE]
> Useful information that users should know, even when skimming content.

> [!TIP]
> Helpful advice for doing things better or more easily.

> [!IMPORTANT]
> Key information users need to know to achieve their goal.

> [!WARNING]
> Urgent info that needs immediate user attention to avoid problems.

> [!CAUTION]
> Advises about risks or negative outcomes of certain actions.
```

Which is being rendered on GH as:

> [!NOTE]
> Useful information that users should know, even when skimming content.

> [!TIP]
> Helpful advice for doing things better or more easily.

> [!IMPORTANT]
> Key information users need to know to achieve their goal.

> [!WARNING]
> Urgent info that needs immediate user attention to avoid problems.

> [!CAUTION]
> Advises about risks or negative outcomes of certain actions.

### What did you expect to happen?

No violations.

### What actually happened?

```
1:4 error Label reference '!NOTE' not found markdown/no-missing-label-refs
4:4 error Label reference '!TIP' not found markdown/no-missing-label-refs
7:4 error Label reference '!IMPORTANT' not found markdown/no-missing-label-refs
10:4 error Label reference '!WARNING' not found markdown/no-missing-label-refs
13:4 error Label reference '!CAUTION' not found markdown/no-missing-label-refs
```

### Link to Minimal Reproducible Example

https://stackblitz.com/edit/118f65b5-5b7b-4190-9fbe-b023b0542a4e?file=package.json

### Participation

- [ ] I am willing to submit a pull request for this issue.

### Additional comments

More info on GFM Alerts:
- https://github.com/orgs/community/discussions/16925
- https://github.blog/changelog/2023-12-14-new-markdown-extension-alerts-provide-distinctive-styling-for-significant-content/
- https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.