Skip to content

build: upgrade typescript-eslint to v8 - #3417

Open
aresnik11 wants to merge 5 commits into
mainfrom
ajr-bump-typescript-eslint
Open

build: upgrade typescript-eslint to v8#3417
aresnik11 wants to merge 5 commits into
mainfrom
ajr-bump-typescript-eslint

Conversation

@aresnik11

@aresnik11 aresnik11 commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Overview

Upgrades typescript-eslint from v5 to v8 so the current TypeScript version (5.9.3) is officially supported and yarn lint no longer prints the "TypeScript version not officially supported by @typescript-eslint" warning.

Root cause: @typescript-eslint@5.62 supports TS <5.2, but the repo is on TS 5.9.3. Moving to v8 (via @codecademy/eslint-config 8.0.0 → 8.2.0, which already uses @typescript-eslint@^8.31) resolves it. Pinned to 8.43.0 exact to match mono. No ESLint or Node upgrade needed — v8 peers eslint ^8.57 (repo is on 8.57.1) and Node >=18.18 (repo is on 22).

Commits

Commit What
Bump typescript-eslint to v8 @typescript-eslint/* 5.62 → 8.43.0 (plugin, parser, utils, + new rule-tester), @codecademy/eslint-config → 8.2.0. Added eslint-plugin-import / -jest / -unused-imports at the root so the shared config's plugins resolve (they no longer hoist under the newer config).
Migrate eslint-plugin-gamut to typescript-eslint v8 RuleTester moved to @typescript-eslint/rule-tester with flat-config languageOptions; nodenext resolution in tsconfig.spec.json; removed docs.recommended from rule meta; AST_NODE_TYPES comparisons; removed a duplicate test case.
Adjust eslint rules for typescript-eslint v8 Rule-config changes in .eslintrc.js (see below).
Fix v8 lint violations across the repo Real fixes: jsx-key, unused imports, union dedupe, optional chaining, and the MDX parser crashes.

Rule-config decisions

Bumping the config pulled newer plugin versions, surfacing 139 new lint errors. Handled as:

  • Disabled (matching mono + the config's existing ban-types / no-empty-interface intent):
    • @typescript-eslint/no-empty-object-type (98 hits — mono disables this too)
    • @typescript-eslint/no-wrapper-object-types (5)
    • @typescript-eslint/no-base-to-string (5 — flags long-standing ReactNode → string aria/id coercions; hardening those is a separate a11y effort, noted in a code comment)
  • eqeqeq: the 2 hits were idiomatic == null / != null nullish checks → allowed via eqeqeq: ['error', 'always', { null: 'ignore' }] (still enforces === everywhere else).
  • *.mdx: turned off import/namespace and @typescript-eslint/no-unused-expressions, which misfire on MDX imports and inline prose expressions like {'>'}.
  • Fixed as real bugs: 7 react/jsx-key, 3 no-unsafe-enum-comparison, 2 no-unused-vars, plus autofixed dedupe / import-sort / optional-chaining.

eslint-mdx note

The config bump also moves eslint-mdx 1.x → 3.x. The v3 parser crashed on two docs files (assert.ok(code[lastAttrOffset] === attrQuote)) — caused by multi-line JSX string attributes (<Callout text="line one\n line two" />). Fixed by collapsing those to single-line attributes. No functional change to the docs.

PR Checklist

  • Related to designs:
  • Related to JIRA ticket: GMT-1605
  • Version plan added/updated (or not needed)
  • I have run this code to verify it works
  • This PR includes unit tests for the code change
  • This PR includes testing instructions tests for the code change
  • The alpha package of this PR is passing end-to-end tests in all relevant Codecademy repositories

Testing Instructions

# From the gamut repo root
yarn install

# 1. The core check: lint runs clean with NO TypeScript-version warning
yarn lint
# Expect: exits 0, and no "WARNING: You are currently running a version of
# TypeScript which is not officially supported" banner.

# 2. eslint-plugin-gamut's own rule tests pass under the v8 RuleTester API
yarn nx test eslint-plugin-gamut
yarn nx build eslint-plugin-gamut

# 3. Confirm the resolved versions are pinned to 8.43.0 (matching mono)
node -e "console.log(require('@typescript-eslint/parser/package.json').version)"   # 8.43.0
node -e "console.log(require('@typescript-eslint/utils/package.json').version)"    # 8.43.0

Expected: yarn lint exits 0 with no version warning; eslint-plugin-gamut tests (45) and build pass; typescript-eslint resolves to 8.43.0.

PR Links and Envs

Repository PR Link
Monolith Monolith PR
Mono Mono PR

aresnik11 and others added 3 commits August 19, 2026 11:04
typescript-eslint 5.62 -> 8.43.0 (plugin/parser/utils, + rule-tester) and
@codecademy/eslint-config 8.0.0 -> 8.2.0, so TS 5.9 is officially supported
and the version warning on `yarn lint` goes away. Pinned to 8.43.0 to match
mono. Also add import/jest/unused-imports at the root so the shared config's
plugins resolve (they no longer hoist under the newer config).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- RuleTester moved to @typescript-eslint/rule-tester with flat-config
  languageOptions (v8 dropped ESLintUtils.RuleTester and the string parser)
- Use nodenext resolution in tsconfig.spec.json so the rule-tester exports
  subpaths resolve (still emits CommonJS for ts-jest)
- Drop docs.recommended from rule meta (removed from RuleMetaDataDocs in v8)
- Compare node types against AST_NODE_TYPES to satisfy no-unsafe-enum-comparison
- Remove a duplicate valid test case (v8 RuleTester now rejects duplicates)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Disable no-empty-object-type / no-wrapper-object-types (v8 successors of
  ban-types / no-empty-interface, which the shared config already disables;
  mono disables no-empty-object-type too)
- Disable no-base-to-string: flags long-standing ReactNode->string aria/id
  coercions; hardening those is a separate a11y effort
- Allow `== null` / `!= null` via eqeqeq { null: 'ignore' }
- For *.mdx, turn off import/namespace and no-unused-expressions, which
  misfire on MDX imports and inline prose expressions

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@nx-cloud

nx-cloud Bot commented Aug 19, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit bd9abf7


☁️ Nx Cloud last updated this comment at 2026-08-19 15:35:44 UTC

@codecov

codecov Bot commented Aug 19, 2026

Copy link
Copy Markdown

⚠️ JUnit XML file not found

The CLI was unable to find any JUnit XML files to upload.
For more help, visit our troubleshooting guide.

- Add missing React keys in styleguide list/story maps (jsx-key)
- Preserve the full ButtonTypes union and disable
  no-duplicate-type-constituents there: the five button components are
  structurally identical, but the union intentionally enumerates them all
- Drop a genuinely redundant `| undefined` on an optional param and a
  duplicate literal union member (autofix); prefer optional chaining
- Disable import/namespace on a dynamic namespace key access it can't
  statically validate
- Collapse multi-line JSX string attributes in two MDX files that crashed
  the eslint-mdx v3 parser
- Import-sort fixes

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@aresnik11
aresnik11 force-pushed the ajr-bump-typescript-eslint branch from bd9abf7 to cb87024 Compare August 19, 2026 15:25
| 'search'
| 'month'
| 'tel'
| 'time'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

duplicate, also listed above on line 336

`import defaultImport from 'fileName.json'`,
`import defaultImport from 'fileName.md'`,
`import defaultImport from 'fileName.mdx'`,
`import defaultImport from 'fileName.svg'`,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

duplicate. same thing on line 19

@codecademydev

Copy link
Copy Markdown
Collaborator

📬 Published Alpha Packages:

Package Version npm Diff
@codecademy/gamut 72.5.4-alpha.3f7af6.0 npm diff
@codecademy/gamut-icons 9.57.12-alpha.3f7af6.0 npm diff
@codecademy/gamut-illustrations 0.58.17-alpha.3f7af6.0 npm diff
@codecademy/gamut-kit 3.0.17-alpha.3f7af6.0 npm diff
@codecademy/gamut-patterns 0.10.36-alpha.3f7af6.0 npm diff
@codecademy/gamut-styles 20.1.1-alpha.3f7af6.0 npm diff
@codecademy/gamut-tests 6.0.7-alpha.3f7af6.0 npm diff
@codecademy/variance 0.26.2-alpha.3f7af6.0 npm diff
eslint-plugin-gamut 2.4.4-alpha.3f7af6.0 npm diff

@github-actions

Copy link
Copy Markdown
Contributor

@aresnik11 aresnik11 changed the title Ajr bump typescript eslint build: upgrade typescript-eslint to v8 Aug 19, 2026
@aresnik11
aresnik11 marked this pull request as ready for review August 19, 2026 18:39
@aresnik11
aresnik11 requested a review from a team as a code owner August 19, 2026 18:39

@dreamwasp dreamwasp 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.

lgt, would just like to test eslint-plugin-gamut in mono to make sure it still works there

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.

3 participants