Skip to content

chore(deps): migrate to ESLint 9 with flat config#17108

Open
sfanahata wants to merge 7 commits intomasterfrom
chore/eslint-9-migration
Open

chore(deps): migrate to ESLint 9 with flat config#17108
sfanahata wants to merge 7 commits intomasterfrom
chore/eslint-9-migration

Conversation

@sfanahata
Copy link
Contributor

@sfanahata sfanahata commented Mar 24, 2026

Summary

Migrates sentry-docs to ESLint 9 with flat config and removes the abandoned eslint-config-sentry-docs dependency, replacing it with a self-contained configuration.

Changes

ESLint 9 Migration

  • Update ESLint from v8 to v9.26.0
  • Convert .eslintrc.js to eslint.config.js (flat config format)
  • Update @typescript-eslint/* packages to v8.32.1
  • Delete .eslintrc.js and .eslintignore (replaced by flat config)

Remove eslint-config-sentry-docs

The eslint-config-sentry-docs package from getsentry/eslint-config-sentry has been abandoned and is incompatible with ESLint 9. This PR removes the dependency and inlines all rules directly:

  • Add direct dependencies: eslint-plugin-react, eslint-plugin-react-hooks, eslint-plugin-import, eslint-plugin-simple-import-sort, globals
  • Remove @eslint/eslintrc (no longer needed without FlatCompat)
  • Incorporate all rules from:
    • eslint-config-sentry/rules/base.js
    • eslint-config-sentry-react/rules/react.js
    • eslint-config-sentry-react/rules/imports.js
    • eslint-config-sentry-docs/index.js

Breaking Changes Handled

  • @typescript-eslint/ban-types removed in v8 → replaced with no-empty-object-type, no-unsafe-function-type, no-wrapper-object-types
  • eslint-plugin-no-lookahead-lookbehind-regexp incompatible with ESLint 9 → removed (was used to prevent Safari crashes, but Safari now supports lookbehind)

Security Fixes

  • Adds minimatch: "^9.0.0" to pnpm overrides, eliminating vulnerable minimatch v3 from the dependency tree
  • Resolves Dependabot alerts for minimatch ReDoS vulnerability

Code Fixes

  • Auto-fix import sorting across all source files via simple-import-sort
  • Remove unused eslint-disable comments
  • Fix catch (e)catch for unused error variables
  • Fix {} type usage with proper alternatives

Testing

  • pnpm lint:eslint - 0 errors, 23 warnings (all Next.js suggestions)
  • pnpm lint:ts - passes
  • pnpm test:ci - 149 tests passing

@vercel
Copy link

vercel bot commented Mar 24, 2026

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

Project Deployment Actions Updated (UTC)
develop-docs Ready Ready Preview, Comment Mar 25, 2026 9:10pm
sentry-docs Ready Ready Preview, Comment Mar 25, 2026 9:10pm

Request Review

- Update ESLint from v8 to v9.26.0
- Convert .eslintrc.js to eslint.config.js (flat config)
- Update @typescript-eslint/* to v8.32.1
- Update eslint-config-next to v16.0.0
- Add @eslint/js and @eslint/eslintrc for FlatCompat
- Add globals package for environment globals

Breaking changes from eslint-config-sentry-docs handled via overrides:
- Disable deprecated @typescript-eslint/ban-types (replaced with new rules)
- Disable incompatible no-lookahead-lookbehind-regexp rule
- Enable replacement rules: no-empty-object-type, no-unsafe-function-type, no-wrapper-object-types

Code fixes:
- Replace 'catch (e)' with 'catch' for unused error variables
- Remove deprecated eslint-env comments
- Fix {} type usage with proper Record<string, unknown> or unknown
- Remove unused eslint-disable comments

Resolves security alerts for minimatch, flatted, and ajv by using
ESLint 9's native globbing instead of minimatch.
Shannon Anahata and others added 3 commits March 25, 2026 12:40
…d flat config

- Remove eslint-config-sentry-docs (abandoned package from getsentry/eslint-config-sentry)
- Remove @eslint/eslintrc (no longer needed without FlatCompat)
- Add direct ESLint plugin dependencies: eslint-plugin-react, eslint-plugin-react-hooks,
  eslint-plugin-import, eslint-plugin-simple-import-sort, globals
- Rewrite eslint.config.js as fully self-contained flat config
- Remove eslint-plugin-react-hooks pnpm override (now a direct dependency)
- Auto-fix import sorting across all source files

This completes the ESLint 9 migration by eliminating the dependency on the abandoned
eslint-config-sentry-docs package. All rules from the original config have been
incorporated directly into the flat config.

Tests pass (149 tests), ESLint passes (0 errors, 57 warnings for pre-existing any types),
and TypeScript type checking passes.
…try-docs

- Add @typescript-eslint/no-shadow and no-redeclare (from sentry-docs config)
- Add full React rules from eslint-config-sentry-react/rules/react.js
- Add full import rules from eslint-config-sentry-react/rules/imports.js
- Update react-hooks/exhaustive-deps to 'error' (matching original)
- Add react/function-component-definition rule
- Add import/no-anonymous-default-export rule

This brings the config closer to the original eslint-config-sentry-docs behavior.
Warnings reduced from 57 to 23 (remaining are Next.js suggestions, not sentry rules).
Move no-shadow rule to JS-only config block to prevent the main config
block from re-enabling it for TypeScript files (which would override
the TypeScript block's 'no-shadow': 'off' setting and cause false
positives on type declarations, enums, and generics).
The eslint.config.js imports @typescript-eslint/eslint-plugin and
@typescript-eslint/parser directly, which are already listed as
separate devDependencies. The typescript-eslint meta-package was
not being used.
Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

'next lint' is deprecated in Next.js 15.5 and will be removed in v16.
It also requires eslint-config-next to be installed even when using a
custom eslint.config.js.

Changed 'pnpm lint' to run all linters (eslint + prettier + ts) as
documented in AGENTS.md, instead of duplicating lint:eslint.
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.

1 participant