Skip to content

Conversation

@DMartens
Copy link
Contributor

@DMartens DMartens commented Jun 6, 2025

Add support for explicit comparisons in the prefer-regexp-test rule:

pattern.exec(string) !== null
// is fixed to
pattern.test(string)

Adding the additional check for !== null was straightforward but adding the fix was not.
But I hope, the code is still understandable.
Fixes #838

@changeset-bot
Copy link

changeset-bot bot commented Jun 6, 2025

🦋 Changeset detected

Latest commit: c57acec

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.

Thank you!

@ota-meshi ota-meshi merged commit 8bf592c into ota-meshi:master Jun 8, 2025
11 checks passed
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.

prefer-regexp-test: Support explicit test conditions

2 participants