Closed Bug 1951365 Opened 4 months ago Closed 4 months ago

Fix some flat config and eslint v9 related issues in eslint-plugin-mozilla

Categories

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

Tracking

(firefox138 fixed)

RESOLVED FIXED
138 Branch
Tracking Status
firefox138 --- fixed

People

(Reporter: standard8, Assigned: standard8)

References

Details

Attachments

(3 files)

I've started looking at the flat configuration for ESLint, and noticed that we could make some improvements to eslint-plugin-mozilla to make it easier for switching to the flat configuration and ESLint v9. These are all independent and won't affect the legacy configuration.

  • Add names to all the configurations.
    • The flat configuration has a config inspector which shows which parts of the configuration are applied to which files. Having naming there greatly helps investigations.
    • This also improves ESLint error messages if you get the configuration wrong.
  • Switch more rules away from obsolete functions.
    • We don't need to do this until we upgrade to v9. However, we've already switched some rules away, and I think these are the remaining ones to fix.
  • Bump minimum supported version of ESLint to v8.57.1 - the last supported of the ESLint v8 series.
    • Once we're on v9 I want to drop support for v8 so that we can switch eslint-plugin-mozilla to ES modules. Given that cleaning some of the obsolete functions up might break things, I want limit the version. I doubt anyone is using it on older versions, but if they are, they should update.
  • Include eslint-plugin-jsdoc as an optional peer dependency.
    • It is currently, however we don't list it, and we'll need to import it for the jsdoc configs. Hence adding it now so it is ready.

These make debugging configuration issues easier to handle.
The top-level .eslintrc.js change is so that we use the configuration handling system in index.js to be able to filter out the name for the legacy configuration set-ups.

jsdoc and sdl are both optional as they're not used for the recommended config. Currently the sdl peer dependency also causes issues with installing node_modules in eslint-plugin-mozilla, because it can't cope that 1.0.0 only supports ESLint v9, yet 0.2.2 will support ESLint v8.

Pushed by mbanner@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/6f519279e6f3 Add names to the unnamed configurations sections in eslint-plugin-mozilla. r=frontend-codestyle-reviewers,mossop https://hg.mozilla.org/integration/autoland/rev/32fdff16eb46 Convert eslint-plugin-mozilla code to use non-deprecated functions from ESLint. r=frontend-codestyle-reviewers,mossop https://hg.mozilla.org/integration/autoland/rev/ed51740a3a4e For eslint-plugin-mozilla jsdoc config, add jsdoc as a plugin. Also add jsdoc and sdl as an optional peer dependencies. r=frontend-codestyle-reviewers,mossop
Status: NEW → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 138 Branch
See Also: → 1951722
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: