Skip to content

chore: Upgrade to eslint 9#900

Open
rogaldh wants to merge 9 commits intosolana-foundation:masterfrom
hoodieshq:development-upgrade-to-eslint-9
Open

chore: Upgrade to eslint 9#900
rogaldh wants to merge 9 commits intosolana-foundation:masterfrom
hoodieshq:development-upgrade-to-eslint-9

Conversation

@rogaldh
Copy link
Contributor

@rogaldh rogaldh commented Mar 21, 2026

Description

PR introduces migration to eslint@9

⚠️ Depends on #899

Type of change

  • Other (please describe): chore update

Screenshots

n/a

Testing

All CI tasks should pass

Related Issues

HOO-379

Checklist

  • My code follows the project's style guidelines
  • I have added tests that prove my fix/feature works
  • All tests pass locally and in CI
  • I have run build:info script to update build information
  • CI/CD checks pass

@vercel
Copy link

vercel bot commented Mar 21, 2026

@rogaldh is attempting to deploy a commit to the Solana Foundation Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link

vercel bot commented Mar 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
explorer Ready Ready Preview, Comment Mar 21, 2026 1:08pm

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 21, 2026

Greptile Summary

This PR migrates the project from ESLint 8 (legacy .eslintrc.json) to ESLint 9 (new flat eslint.config.mjs), upgrades typescript-eslint from v6 to v8 (unified monorepo package), bumps eslint-config-next from v14 to v15, removes the @solana/eslint-config-solana shared config (now replaced by explicit rule declarations), and upgrades TypeScript from 5.3 to 5.5.

Key changes:

  • New flat config uses FlatCompat to bridge the legacy next/core-web-vitals config, then layers js.configs.recommended and tseslint.configs.recommended on top with well-structured per-glob overrides.
  • sort-keys-fix/sort-keys-fix is now an explicit error rule (previously inherited from @solana/eslint-config-solana); config/tooling files are correctly exempted via the *.config.* / *.mjs / *.cjs glob.
  • Unnecessary eslint-disable comments are cleaned up across ~30 files, enabled by reportUnusedDisableDirectives: 'warn' in the new config. The removals are all justified: @typescript-eslint/no-redeclare (the type Foo = Infer<typeof Foo> pattern is now natively handled), @typescript-eslint/no-non-null-assertion (explicitly turned off globally), and react-hooks/exhaustive-deps disables in cluster.tsx and RawInputCard.tsx (the deps arrays were already complete).
  • lint script changes from next lint (which only lints specific directories by default) to eslint . with explicit ignores; this broadens coverage to all project files.
  • Minor: the @typescript-eslint/no-require-imports: 'off' override unnecessarily lists *.mjs alongside *.cjs/*.js.mjs files can't use require() by design, so this is a no-op but slightly misleading.

Confidence Score: 5/5

  • This PR is safe to merge — it's a tooling-only change with no runtime impact on the application.
  • All changes are confined to linting configuration, dependency versions, and cleanup of now-redundant eslint-disable comments. The new flat config is well-structured with appropriate per-glob overrides. Every removed disable comment has a clear and correct rationale (rule turned off, first-of-duplicates, stable useReducer dispatch, complete deps arrays). The single P2 comment on *.mjs in the no-require-imports override has zero runtime impact.
  • No files require special attention; the only note is the minor *.mjs inclusion in the no-require-imports override in eslint.config.mjs.

Important Files Changed

Filename Overview
eslint.config.mjs New ESLint 9 flat config replacing .eslintrc.json; introduces sort-keys-fix, tseslint v8 rules, and proper overrides for test/config/script files. One minor broadness concern with the *.mjs glob in the no-require-imports override.
package.json Upgrades eslint 8→9, eslint-config-next 14→15, typescript-eslint monorepo package 6→8, removes @solana/eslint-config-solana, adds @eslint/eslintrc, @eslint/js, globals, sort-keys-fix plugin, bumps TypeScript 5.3→5.5. lint script changed from next lint to eslint .
.eslintrc.json Deleted – legacy ESLint 8 config replaced by eslint.config.mjs.
app/utils/programs.ts Removes the now-redundant eslint-disable from the PYTH_DEVNET enum member (first occurrence; only subsequent duplicates TESTNET/MAINNET need suppression).
app/providers/cluster.tsx Removes react-hooks/exhaustive-deps suppress comment; dispatch from useReducer is stable so the deps array [cluster, customUrl] is correct.
app/components/inspector/RawInputCard.tsx Removes react-hooks/exhaustive-deps suppress; rawInput.current is a ref (intentionally omitted), [value, onInput] are the actual reactive deps – correct.
app/components/instruction/lighthouse/tests/LighthouseDetailsCard.test.tsx Removes @typescript-eslint/no-non-null-assertion from inline disables across ~20 sites, since the rule is now globally off in the new config. Non-null assertions with ! remain and are still valid TypeScript.
sentry/config.mjs Removes the sort-keys-fix disable on the webpack key in createSentryBuildConfig(); keys are already in alphabetical order (org, project, silent, telemetry, webpack, widenClientFileUpload) so the comment was unnecessary.
tailwind.config.ts Removes eslint-disable/enable block around screens object; the file now matches .config. glob in the new flat config's sort-keys override, so the inline disables are no longer needed.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[ESLint 8 – .eslintrc.json] -->|deleted| B[ESLint 9 – eslint.config.mjs]

    subgraph OLD["Old config (ESLint 8)"]
        A
        A1["extends: next/core-web-vitals\n@solana/eslint-config-solana"]
        A2["plugins: testing-library\nsimple-import-sort\neslint-comments"]
        A3["overrides: test files\nmock files\nscripts\nsentry imports"]
    end

    subgraph NEW["New flat config (ESLint 9)"]
        B
        B1["FlatCompat → next/core-web-vitals"]
        B2["tseslint.configs.recommended\njs.configs.recommended"]
        B3["plugins: simple-import-sort\nsort-keys-fix\neslint-comments\ntesting-library"]
        B4["Overrides: *.cjs/js/mjs (require)\ntest files (testing-library)\nmocks (unlimited-disable)\nlogger/scripts (console)\n*.config.* (sort-keys-off)\napp/** (sentry imports)"]
    end

    B --> B1
    B --> B2
    B --> B3
    B --> B4

    C["lint script: next lint → eslint ."] --> B
    D["typescript-eslint v6 → v8\n(monorepo package)"] --> B
    E["@solana/eslint-config-solana removed\nsort-keys-fix added explicitly"] --> B
Loading

Last reviewed commit: "install with no-froz..."

"eslint": "8.39.0",
"eslint-config-next": "14.2.5",
"eslint": "9.39.4",
"eslint-config-next": "15.3.5",
Copy link
Contributor

Choose a reason for hiding this comment

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

thought: I thought it should match the next version, but it seems to work just fine. I'm a bit concerned about potential false positives

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants