-
Notifications
You must be signed in to change notification settings - Fork 76
refactor: simplify no-bare-urls
with ESQuery selector
#511
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
refactor: simplify no-bare-urls
with ESQuery selector
#511
Conversation
…or-simplify-no-bare-urls-with-esquery-selector
src/util.js
Outdated
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.
I’ve just added some markers to clarify which category each util belongs to.
tests/rules/no-bare-urls.test.js
Outdated
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.
I've added additional test cases to more thoroughly verify the changes before and after.
I've confirmed that these tests pass in the previous codebase.
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.
I think this look good overall. If you can add some comments around how you're making this work, that would be helpful.
I've added a new commit c5e2bfa |
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!
Prerequisites checklist
What is the purpose of this pull request?
Hi,
In this PR, I've simplified
no-bare-urls
rule with ESQuery selector. This is follow-up to #495 and #498.The code has been updated a bit to maintain the same behavior without re-traversing the AST with a
for
loop.The main point of the previous logic was that URLs between HTML tags were not reported.
I've tried to keep the logic as close as possible, except that it now uses ESQuery selectors.
I also aimed to make the code cleaner and minimize the use of variables.
There may still be room for improvement, so I’d be happy to hear any suggestions!
What changes did you make? (Give an overview)
In this PR, I've simplified
no-bare-urls
rule with ESQuery selector. This is follow-up to #495 and #498.Related Issues
Refs: #495, #498
Is there anything you'd like reviewers to focus on?