-
Notifications
You must be signed in to change notification settings - Fork 80
fix: add null check and use getLocFromIndex in require-alt-text
#543
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
Merged
mdjermanovic
merged 4 commits into
main
from
refactor-use-getlocfromindex-in-require-alt-text
Sep 29, 2025
Merged
fix: add null check and use getLocFromIndex in require-alt-text
#543
mdjermanovic
merged 4 commits into
main
from
refactor-use-getlocfromindex-in-require-alt-text
Sep 29, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
null check and use getlocfromindex in require-alt-textnull check and use getLocFromIndex in require-alt-text
lumirlumir
commented
Sep 29, 2025
| ); | ||
| if ( | ||
| ariaHiddenMatch && | ||
| ariaHiddenMatch[1] && |
Member
Author
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.
Member
Author
|
To apply the feedback from #541, I'll mark this PR as a draft shortly. All clear. |
mdjermanovic
approved these changes
Sep 29, 2025
Member
mdjermanovic
left a comment
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.
LGTM, thanks!
Merged
1 task
This was referenced Oct 24, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prerequisites checklist
What is the purpose of this pull request?
The original intention of this PR was to refactor the code to use
getLocFromIndex, but I found a small bug while working on it, so I fixed it as well.Which language are you using?
CommonMark and GFM.
What did you do?
When I run the code above, the rule crashes for the following reason: a missing
nullcheck.(FYI, the code above is recognized as valid syntax even without
trueorfalsefollowing it.)What did you expect to happen?
No crash would happen.
Link to minimal reproducible Example
Adding the above code to the
validsection ofrequire-alt-text.test.jswould help identify the problem.What changes did you make? (Give an overview)
The original intention of this PR was to refactor the code to use
getLocFromIndex, but I found a small bug while working on it, so I fixed it as well.This PR originated from #536. While working on that, I found the scope had become too large, so I split this refactoring into a separate PR.
In this PR, I've used the native
getLocFromIndexmethod added in #376 instead of the customfindOffsetsutil.Notable changes:
findOffsetsutil with the nativegetLocFromIndex.Related Issues
Ref: #376, #536
Is there anything you'd like reviewers to focus on?
N/A