Skip to content

Enable the unicorn/{prefer-includes,throw-new-error} linting rules#18571

Merged
timvandermeij merged 2 commits into
mozilla:masterfrom
timvandermeij:linting
Aug 8, 2024
Merged

Enable the unicorn/{prefer-includes,throw-new-error} linting rules#18571
timvandermeij merged 2 commits into
mozilla:masterfrom
timvandermeij:linting

Conversation

@timvandermeij

Copy link
Copy Markdown
Collaborator

The commit messages contain more information about the individual changes.

@timvandermeij

Copy link
Copy Markdown
Collaborator Author

/botio-linux browsertest

@moz-tools-bot

Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_browsertest from @timvandermeij received. Current queue size: 0

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

@moz-tools-bot

Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Failed

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

Total script time: 20.63 mins

  • Regression tests: FAILED
  different ref/snapshot: 25
  different first/second rendering: 1

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

Comment thread .eslintrc
For more information refer to
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-includes.md.

Fortunately this only required one change because we already use
`.includes()` everywhere else. Note that that is mostly due to the
`mozilla/use-includes-instead-of-indexOf` rule which we replace with
this new rule now because it's more complete.
For more information refer to
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/throw-new-error.md.

This didn't require any changes because we already do this correctly,
but it ensures that new code remains consistent and explicit.

@Snuffleupagus Snuffleupagus left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Something for another patch might be to remove mozilla/avoid-removeChild, and thus the mozilla-plugin itself, since that one seems to be covered by unicorn/prefer-dom-node-remove now?


r=me, thank you!

@timvandermeij timvandermeij merged commit cd3d188 into mozilla:master Aug 8, 2024
@timvandermeij timvandermeij deleted the linting branch August 8, 2024 17:18
@timvandermeij

Copy link
Copy Markdown
Collaborator Author

Good idea; that should also help to get closer to ESLint 9. Unfortunately we use one more Mozilla rule at https://github.com/mozilla/pdf.js/blob/master/extensions/chromium/.eslintrc#L19, but if I remove that it only results in five failures nowadays (given that we moved away from most globals a while ago) so I wonder if we can maybe just go ahead and just explicitly document the globals we have left there?

In any case, I'll document this idea on the ESLint 9 ticket (since eslint-plugin-mozilla is currently blocking at least one ESLint 9-compatible plugin from being upgraded, so it might be worthwhile to investigate this.

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