Skip to content

chore: upgrade ESLint from 8.x to 9.x+ #432

@hb2708

Description

@hb2708

Summary

Upgrade eslint and its ecosystem from 8.x to 9.x+. This is the biggest tooling migration as ESLint 9+ requires the new flat config format (eslint.config.js), replacing the legacy .eslintrc format.

Current → Target

Package Current Latest
eslint 8.57.1 10.0.2
eslint-config-prettier 8.5.0 10.1.8
eslint-plugin-prettier 4.2.1 5.5.5
eslint-plugin-jest 27.1.3 29.15.0
eslint-plugin-react-hooks 4.6.0 7.0.1
eslint-import-resolver-typescript 3.5.2 4.4.4
@typescript-eslint/eslint-plugin ^8.49.0 latest
@typescript-eslint/parser ^8.49.0 latest

Why Upgrade

  • ESLint 8.x is end-of-life
  • Flat config is the future — all new plugins target it
  • Better performance and simpler configuration
  • eslint-plugin-react-hooks 7.x has significant improvements

Migration Steps

  1. Create eslint.config.js (flat config) to replace existing ESLint config:
    # Use the migration helper
    npx @eslint/migrate-config .eslintrc.json
  2. Install updated packages:
    yarn add --dev eslint@latest \
      eslint-config-prettier@latest \
      eslint-plugin-prettier@latest \
      eslint-plugin-jest@latest \
      eslint-plugin-react@latest \
      eslint-plugin-react-hooks@latest \
      eslint-import-resolver-typescript@latest \
      eslint-plugin-import@latest \
      @typescript-eslint/eslint-plugin@latest \
      @typescript-eslint/parser@latest
  3. Convert config — flat config uses JS objects instead of JSON:
    • extends...configs (spread)
    • plugins → import and reference directly
    • envlanguageOptions.globals
    • parserOptionslanguageOptions.parserOptions
  4. Update lint scripts in package.json — flat config auto-discovers eslint.config.js
  5. Remove old config files — delete .eslintrc, .eslintrc.json, or .eslintrc.js
  6. Fix any new lint errors introduced by updated rule defaults
  7. Run yarn ci to verify

⚠️ Recommendation

This should be done after the Prettier 3.x upgrade (issue for that exists separately #431 ), since eslint-plugin-prettier and eslint-config-prettier need to be compatible with both ESLint and Prettier versions.

Files Affected

  • .eslintrc*eslint.config.js (new file, old file deleted)
  • package.json — dependency versions, possibly lint script changes
  • Potentially some source files if new/stricter rules flag issues

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions