-
Notifications
You must be signed in to change notification settings - Fork 79
fix: handle CR in rules to follow CommonMark spec #493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix: handle CR in rules to follow CommonMark spec #493
Conversation
For a complete fix, #376 is a prerequisite, as some internal rules are closely tied to self-implemented line break logic. |
…d-cr-to-line-ending-to-follow-spec-strictly
…d-cr-to-line-ending-to-follow-spec-strictly
…d-cr-to-line-ending-to-follow-spec-strictly
There was a problem hiding this comment.
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:
-
Bun v1.3: https://github.com/oven-sh/bun/releases/tag/bun-v1.3.0
-
https://github.com/eslint/markdown/actions/runs/18428303631/job/52512384911


So, I've added @types/unist
, @types/mdast
, and semver
to the dev dependencies.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.)
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
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
andno-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