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

Add regexp/prefer-set-operation rule #616

Merged
merged 2 commits into from
Oct 1, 2023
Merged

Add regexp/prefer-set-operation rule #616

merged 2 commits into from
Oct 1, 2023

Conversation

RunDevelopment
Copy link
Collaborator

Resolves #581.

The implementation of the rule is fairly simple right now. It just goes through all elements of an alternative and tries to find the pattern (?=a)b or a(?<=b). So it won't attempt to do clever things like assertions reordering (e.g. (?!a)(?=bcd)e == (?=bcd)(?!a)e == (?=bcd)[e--a]) and partial application (e.g. (?!a|bcd)e == (?!bcd)(?!a)e == (?!bcd)[e--a]). I think it should be okay. Adjacent assertions are rare in practice, and partial application has the issue that it might make the intent of the author less clear.

@changeset-bot
Copy link

changeset-bot bot commented Sep 24, 2023

🦋 Changeset detected

Latest commit: 47bcc63

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 Major

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.

LGTM! Thank you

@ota-meshi ota-meshi merged commit 47dc791 into master Oct 1, 2023
5 checks passed
@ota-meshi ota-meshi deleted the issue581 branch October 1, 2023 07:46
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.

Use expression character class instead of lookaround
2 participants