Skip to content

refctor: replace indexOf with strict equality - #864

Merged
ota-meshi merged 4 commits into
ota-meshi:masterfrom
btea:refactor/replace-startsWith
Aug 8, 2025
Merged

ota-meshi merged 4 commits into
ota-meshi:masterfrom
btea:refactor/replace-startsWith

Conversation

@btea

@btea btea commented Aug 8, 2025

Copy link
Copy Markdown
Contributor

When determining the value of the first letter of a string, using strict equality is more efficient than startsWith. refer to link

@changeset-bot

changeset-bot Bot commented Aug 8, 2025 •

Copy link
Copy Markdown

πŸ¦‹ Changeset detected

Latest commit: 2bd1290

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

@btea btea changed the title refctor: replace startsWith with strict equality refctor: replace indexOf with strict equality Aug 8, 2025
@ota-meshi
ota-meshi merged commit 15ff713 into ota-meshi:master Aug 8, 2025

@ota-meshi ota-meshi left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

LGTM! Thank you!

@btea
btea deleted the refactor/replace-startsWith branch August 8, 2025 03:24
@btea

btea commented Aug 8, 2025

Copy link
Copy Markdown
Contributor Author

https://typescript-eslint.io/rules/prefer-string-starts-ends-with#options Can we enable rule options configuration in the project?

@ota-meshi

Copy link
Copy Markdown
Owner

Is there a rule that reports str.startsWith('c') instead?
If there isn't a rule, I'm hesitant to change the option because it would require a human to manually review them πŸ€”

@btea

btea commented Aug 8, 2025

Copy link
Copy Markdown
Contributor Author

typescript-eslint doesn't seem to have a relevant rule at the moment. 😦

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.

2 participants