Closed Bug 1881702 Opened 1 year ago Closed 26 days ago

Switch to ESLint v9.6.0

Categories

(Developer Infrastructure :: Lint and Formatting, task, P3)

Tracking

(firefox141 fixed)

RESOLVED FIXED
141 Branch
Tracking Status
firefox141 --- fixed

People

(Reporter: standard8, Assigned: standard8)

References

(Blocks 3 open bugs)

Details

Attachments

(6 files, 1 obsolete file)

Once we've migrated to flat config (bug 1881701), we should upgrade to ESLint v9 itself.

Blocks: 1944290

I'm starting off with a small bump to ESLint 9.6.0 to avoid having to get us onto the 9.x series. There's more issues to resolve if we go all the way to 9.27.0 in one jump, though I've not looked into how much work they'll take to resolve. So what I'd like to do is get to 9.6.0, clean up eslint-plugin-mozilla (to remove all the pre-v9 support code), and then investigate updating to the latest. This will also help with more investigation of new features along the way.

For the 9.6.0 jump, the release notes can be found here:

I think the main highlights are:

  • valid-jsdoc and require-jsdoc rules have been removed (not to be confused with the valid-jsdoc and require-jsdoc configurations that we have in eslint-plugin-mozilla)
  • The complexity rule now also takes into account optional chaining and default values in destructuring patterns and parameters (which generally means higher complexity scores).
  • The no-unused-vars rule has a new default value for the caughtErrors option (changed from "none" to "all")
    • For now, I'm turning this off again, but we might want to consider enabling it in the future.
  • reportUnusedDisableDirectives is on by default, but I'm turning it off in our configuration, will comment in bug 1904558 about the reasons.
  • Intl is now recognized as a built-in global
  • The no-constant-condition rule no longer reports while (true) loops as problems by default (xref)
Assignee: nobody → standard8
Status: NEW → ASSIGNED

This disables caughtErrors from everywhere. This is enabled by default in v9. We should work to enable this later.
This also changes the exported comments - ESLint is more strict about what it can handle, and doesn't like a star
in the middle of the comment.
Also tidies up some rules where they are no longer needed.

Attachment #9490827 - Attachment is obsolete: true
Summary: Switch to ESLint v9 → Switch to ESLint v9.6.0
Blocks: 1968806
Attachment #9490830 - Attachment description: Bug 1881702 - Use import.meta.dirname for the current dirname for the top-level eslint,config.mjs, now that node has been upgraded. r?#frontend-codestyle-reviewers! → Bug 1881702 - Use import.meta.dirname for the current dirname for the top-level eslint.config.mjs, now that node has been upgraded. r?#frontend-codestyle-reviewers!
Pushed by mbanner@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1b43d3819198 Remove references to ESLint rule valid-jsdoc which was removed in v9. r=frontend-codestyle-reviewers,extension-reviewers,search-reviewers,omc-reviewers,android-reviewers,webcompat-reviewers,willdurand,mossop,daleharvey,twisniewski,nalexander,emcminn https://hg.mozilla.org/integration/autoland/rev/5c4751bb8409 Update eslint-plugin-mozilla tests to work with ESLint v9. r=frontend-codestyle-reviewers,mossop https://hg.mozilla.org/integration/autoland/rev/7112920935a5 Upgrade ESLint versions to v9.6.0. r=frontend-codestyle-reviewers,home-newtab-reviewers,mossop,maxx https://hg.mozilla.org/integration/autoland/rev/418f8176bc99 Fix no-unused-vars issues raised by the upgrade to ESLint v9. r=frontend-codestyle-reviewers,perftest-reviewers,geckoview-reviewers,extension-reviewers,devtools-reviewers,migration-reviewers,android-reviewers,webcompat-reviewers,nchevobbe,mossop,sparky,twisniewski,ohall https://hg.mozilla.org/integration/autoland/rev/3cc848387b54 Fix ESLint complexity issues raised after upgrading to v9. r=frontend-codestyle-reviewers,extension-reviewers,devtools-reviewers,anti-tracking-reviewers,tabbrowser-reviewers,omc-reviewers,nchevobbe,timhuang,mossop,nsharpley,emcminn https://hg.mozilla.org/integration/autoland/rev/964aadc52be9 Use import.meta.dirname for the current dirname for the top-level eslint.config.mjs, now that node has been upgraded. r=frontend-codestyle-reviewers,mossop
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: