eslint / eslint/markdown

Bug: `no-bare-urls` autofix crashes for www autolinks

Open
#710 10 comments 0 reactions 1 assignee Claimed by @tooth-is-silver 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: v10.8.1
@eslint/markdown version: v8.0.3
Node version: v24.14.0
npm version: 11.9.0
Operating System: macOS 26.5 (Darwin 25.5.0)

### Which language are you using?

gfm

### What did you do?

Configuration

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

export default [
{
files: ["**/*.md"],
plugins: { markdown },
language: "markdown/gfm",
rules: {
"markdown/no-bare-urls": "error",
},
},
];
```

I ran ESLint with `--fix`:

```shell
npx eslint --fix test.md
```

`test.md` contains:

```md
Visit www.example.com for details.
```

### What did you expect to happen?

ESLint should complete the autofix without throwing an error.
The fixed output should no longer be reported by `markdown/no-bare-urls`.

### What actually happened?

ESLint aborted during autofix:

```text
Error: Custom getRange() method must be implemented in the subclass.
Occurred while linting test.md:1
Rule: "markdown/no-bare-urls"
```

The rule's first fix replaces `www.example.com` with ``.
Linting `` directly reproduces the same error.

### Link to Minimal Reproducible Example

https://stackblitz.com/edit/node-jwpkwim7?file=test.md

### Participation

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

### AI acknowledgment

- [ ] I did not use AI to generate this issue report.
- [x] (If the above is not checked) I have reviewed the AI-generated content before submitting.

### Additional comments

GFM already recognizes `www.example.com` as an extended autolink:

https://github.github.com/gfm/#autolinks-extension-

Possible valid fixes include `` or `[www.example.com](http://www.example.com)`. I think the exact output can be decided separately.

Disclosure: I'm a participant of [open source contribution program OSSCA](https://github.com/eslint-ossca)

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.