Skip to content

chore: migrate the ESLint config to defineConfig#3818

Merged
cixzhang merged 1 commit into
facebook:mainfrom
Han5991:fix/eslint-config-define-config
Jul 11, 2026
Merged

chore: migrate the ESLint config to defineConfig#3818
cixzhang merged 1 commit into
facebook:mainfrom
Han5991:fix/eslint-config-define-config

Conversation

@Han5991

@Han5991 Han5991 commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Problem

eslint.config.js shows type errors in the IDE:

Argument type CompatibleConfig is not assignable to parameter type InfiniteDepthConfigWithExtends

Root cause: typescript-eslint 8.62 deprecated the tseslint.config() helper in favor of ESLint core's defineConfig(), and at the same time retyped tseslint.configs.* as loose cross-version "compatibility" shapes (CompatibleConfig = {name?, rules?: object}). Those loose shapes no longer satisfy the deprecated helper's own InfiniteDepthConfigWithExtends parameter, so feeding typescript-eslint's presets into its own config() helper now fails to type-check.

Fix

  • Migrate export default tseslint.config(...)defineConfig(...) from eslint/config, the replacement the deprecation notice points to.
  • defineConfig type-checks plugins against ESLint core's stricter Plugin type, which the internal @astryx plugin (intentionally untyped JS, excluded from the lint surface) doesn't satisfy structurally. One documented assertion creates a typed alias that all three plugins entries reuse.
  • tseslint.configs.recommended is normalized from CompatibleConfig[] back to Linter.Config[] with a documented assertion, keeping the preset spread type-clean.

Verification

  • tsc (strict, checkJs) on eslint.config.js: clean before and after the plugin typing fix was needed; clean now.
  • Resolved config is byte-identical before/after: eslint --print-config compared for a core .tsx file and a CLI .mjs file, in both human mode and CI=true strict mode — no diff.
  • eslint runs clean on representative files with the new config.

typescript-eslint 8.62 deprecated its `tseslint.config()` helper and
retyped `tseslint.configs.*` as loose cross-version "compatibility"
shapes (`CompatibleConfig`), which the deprecated helper's
`InfiniteDepthConfigWithExtends` parameter no longer accepts — the
config file lights up with type errors in the IDE.

Switch to ESLint core's `defineConfig()` (the replacement the
deprecation notice points to) and give the two remaining untyped
values one documented assertion each:

- the internal @AstryX plugin (intentionally untyped JS) is asserted
  to `ESLint.Plugin` once and reused by every `plugins` entry
- `tseslint.configs.recommended` is normalized back from
  `CompatibleConfig[]` to `Linter.Config[]`

The resolved config is unchanged: `eslint --print-config` output for
core (.tsx) and CLI (.mjs) files is byte-identical before/after, in
both human and CI strict modes.
@vercel

vercel Bot commented Jul 11, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview, Comment Jul 11, 2026 1:04pm

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 11, 2026

@cixzhang cixzhang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you!

@cixzhang
cixzhang merged commit 36ade03 into facebook:main Jul 11, 2026
15 checks passed
@Han5991
Han5991 deleted the fix/eslint-config-define-config branch July 11, 2026 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants