Skip to content

Conversation

lumirlumir
Copy link
Member

@lumirlumir lumirlumir commented Aug 4, 2025

Prerequisites checklist

What is the purpose of this pull request?

Which language are you using?

CommonMark and GFM.

What did you do?

@eslint/markdown is unable to detect CR line endings in certain rules.

What did you expect to happen?

I expect CR line endings to be recognized as valid line endings throughout the Markdown rules.

According to the Markdown(CommonMark) specification, LF, CR, and CRLF can all be used for line endings.

https://spec.commonmark.org/0.31.2/#line-ending

Image

What changes did you make? (Give an overview)

This PR is follow-up to #554 and #555.

In this PR, I've updated the no-reversed-media-syntax rule to recognize CR line endings as a valid line break pattern.

I've also refactored the no-html and no-reference-like-urls rules, and added some additional comments to each file.

Related Issues

Refs: #554, #555, #491 (comment)

Is there anything you'd like reviewers to focus on?

N/A

@eslint-github-bot eslint-github-bot bot added the bug label Aug 4, 2025
@lumirlumir lumirlumir changed the title fix: add CR to the line ending pattern fix: add CR to the line ending pattern to follow CommonMark spec Aug 4, 2025
@lumirlumir
Copy link
Member Author

For a complete fix, #376 is a prerequisite, as some internal rules are closely tied to self-implemented line break logic.

@lumirlumir lumirlumir changed the title fix: add CR to the line ending pattern to follow CommonMark spec fix: handle CR in rules to follow CommonMark spec Oct 11, 2025
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the newly released Bun 1.3 now enforces strict dependencies in package.json. If we use transitive dependencies like @types/unist, @types/mdast, or semver, it throws errors:

image image

So, I've added @types/unist, @types/mdast, and semver to the dev dependencies.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This rule already supports CR line endings, so I only refactored the code.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Motivated by #525, I've simplified the regex a bit.

Since imageBang and title can be retrieved directly from the node's information, I've updated the code to access them directly from the nodes.

(This rule already supports CR line endings, so I only refactored the code.)

@lumirlumir lumirlumir marked this pull request as ready for review October 11, 2025 11:24
@lumirlumir lumirlumir requested a review from nzakas October 11, 2025 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant