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

Replace some unnecessary String.prototype.search usage #15458

Merged
merged 1 commit into from
Sep 19, 2022

Conversation

Snuffleupagus
Copy link
Collaborator

Most of the String.prototype.search call-sites found throughout the code-base is actually not necessary, since we usually only want a boolean, and those can be replaced with RegExp.prototype.test instead.

Most of the `String.prototype.search` call-sites found throughout the code-base is actually not necessary, since we usually only want a *boolean*, and those can be replaced with `RegExp.prototype.test` instead.
@Snuffleupagus
Copy link
Collaborator Author

/botio test

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/e8f0cb57b86d46a/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.193.163.58:8877/a137ae2e7e86b94/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/e8f0cb57b86d46a/output.txt

Total script time: 26.03 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 6
  different first/second rendering: 1

Image differences available at: http://54.241.84.105:8877/e8f0cb57b86d46a/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/a137ae2e7e86b94/output.txt

Total script time: 29.45 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: FAILED
  different ref/snapshot: 1

Image differences available at: http://54.193.163.58:8877/a137ae2e7e86b94/reftest-analyzer.html#web=eq.log

Copy link
Contributor

@calixteman calixteman left a comment

Choose a reason for hiding this comment

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

Does it exist a linter rule for such a case ?

@Snuffleupagus
Copy link
Collaborator Author

Does it exist a linter rule for such a case ?

Unfortunately I can't find an existing plugin for this, since https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-regexp-test.md only covers other regular expression functions.

@Snuffleupagus Snuffleupagus merged commit 2642573 into mozilla:master Sep 19, 2022
@Snuffleupagus Snuffleupagus deleted the rm-some-search branch September 19, 2022 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants