Skip to content

feat: Enable HTTP inspection even for absolute links#172

Merged
azu merged 4 commits intotextlint-rule:masterfrom
ajfAfg:feat/enable-http-inspection-even-for-absolute-links
Jan 18, 2026
Merged

feat: Enable HTTP inspection even for absolute links#172
azu merged 4 commits intotextlint-rule:masterfrom
ajfAfg:feat/enable-http-inspection-even-for-absolute-links

Conversation

@ajfAfg
Copy link
Contributor

@ajfAfg ajfAfg commented Jan 13, 2026

Background

Links starting with /, such as /path/to, were always verified against files on the file system. Consequently, even if the baseURI option was set to an HTTP/HTTPS URI, links could not be verified over HTTP/HTTPS.

Approach

I've added an option to always validate links via HTTP/HTTPS. For backward compatibility, it is disabled by default.
Additionally, I have added testing and documentation for the new option.

@ajfAfg ajfAfg force-pushed the feat/enable-http-inspection-even-for-absolute-links branch from 478851f to 6946661 Compare January 13, 2026 16:44
@azu azu self-requested a review January 13, 2026 22:52
Comment on lines +202 to +203
// Since fetch is successful, parsing always succeeds
const base = URL.parse(uri)!.origin;
Copy link
Member

Choose a reason for hiding this comment

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

can you avoid to use !.
It is not type safe.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for your feedback!
I fixed it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

},
errors: [
{
message: `/200 is dead. (ENOENT: no such file or directory, access '${process.platform === "win32" ? "D:\\" : "/"}200')`,
Copy link
Member

Choose a reason for hiding this comment

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

Maybe, you can use path.resolve('/200')?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for your feedback!
I fixed it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ajfAfg ajfAfg requested a review from azu January 18, 2026 05:42
@azu azu added the Type: Feature New Feature label Jan 18, 2026
Copy link
Member

@azu azu left a comment

Choose a reason for hiding this comment

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

lgtm

@azu azu merged commit 799a624 into textlint-rule:master Jan 18, 2026
6 checks passed
@github-actions github-actions bot mentioned this pull request Jan 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Feature New Feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants