Skip to content
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

Improve detection for regexp/no-useless-assertion #663

Merged
merged 2 commits into from Oct 20, 2023
Merged

Conversation

RunDevelopment
Copy link
Collaborator

Fixes #661.

The new condition for always accepting is relatively simple. It's just the previous check, but it accounts for edges properly and allows more assertions.

The complex part of this PR is the isSingleCharacterAssertion function. Implementing this function was surprisingly complex. Since we can't modify the AST, we have to handle some pretty complex cases. But even with those complex cases handled, isSingleCharacterAssertion is still not perfect and will return false negatives at times. Fortunately, false negatives aren't a problem for us.

@changeset-bot
Copy link

changeset-bot bot commented Oct 20, 2023

🦋 Changeset detected

Latest commit: 229aefd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
eslint-plugin-regexp Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Owner

@ota-meshi ota-meshi left a comment

Choose a reason for hiding this comment

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

Wonderful! Thank you.

@ota-meshi ota-meshi merged commit 882beb3 into master Oct 20, 2023
5 checks passed
@ota-meshi ota-meshi deleted the issue661 branch October 20, 2023 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make no-useless-assertion detect (?!$)$
2 participants