Skip to content

Upgrade to eslint v9#1187

Merged
rezrah merged 9 commits intomainfrom
rezrah/migrate-eslint-v9
Oct 30, 2025
Merged

Upgrade to eslint v9#1187
rezrah merged 9 commits intomainfrom
rezrah/migrate-eslint-v9

Conversation

@rezrah
Copy link
Copy Markdown
Collaborator

@rezrah rezrah commented Oct 27, 2025

Summary

Towards https://github.com/github/primer/issues/5926

Upgrades our ESLint toolchain to v9, which includes a number of breaking changes.

This PR looks to minimize the blast zone of changes to only what's necessary. Follow up PR's will be required to upgrade some adjacent ESLint plugins.

For benchmarking purposes... ESLint (v8) vs ESLint (v9):

Tool Lint Time Format Time Total Time Source
Before: ESLint (v8) 53s 13s 66s CI Run
After: ESLint (v9) 54s 13s 67s CI Run
After: BiomeJS 1s 1s 2s CI Run

Includes BiomeJS as an experiment only. More on that another time.

List of notable changes:

  • Manually upgraded ESLint from v8 to v9
  • Updated only the ESLint plugins that were needed for v9, not those that continue to work
    • This is to limit size of this PR and not add 'new rules' to the mix
    • Some rule changes in affected packages, neccessitated adjustments to the code. No functional changes expected, but a changeset has been included for transparency.
    • The biggest change is that _ prefixing of component names is now deemed an error by rules-of-hooks. All instances replaced.
  • Enabled linting in Next.js .mdx files, which previously wasn't on
  • Vendored i18n plugin, as it's now turned off in github/recommended but we still need it in Brand

What should reviewers focus on?

  • Ensure CI is passing

Steps to test:

  1. Go to files changed and review chages, they should track with the updates mentioned above.
  2. Comment on anything that looks incorrect or strange

Contributor checklist:

  • All new and existing CI checks pass
  • Tests prove that the feature works and covers both happy and unhappy paths
  • Any drop in coverage, breaking changes or regressions have been documented above
  • UI Changes contain new visual snapshots (generated by adding update snapshots label to the PR)
  • All developer debugging and non-functional logging has been removed
  • Related issues have been referenced in the PR description

Reviewer checklist:

  • Check that pull request and proposed changes adhere to our contribution guidelines and code of conduct
  • Check that tests prove the feature works and covers both happy and unhappy paths
  • Check that there aren't other open Pull Requests for the same update/change

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Oct 27, 2025

🦋 Changeset detected

Latest commit: 3bd3aeb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@primer/react-brand Patch
@primer/brand-docs Patch
@primer/brand-css Patch
@primer/brand-primitives Patch
@primer/brand-e2e Patch
@primer/brand-fonts Patch
@primer/brand-config Patch
@primer/brand-storybook Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 27, 2025

🟢 No design token changes found

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 27, 2025

🟢 Unit test coverage changes found

Unit test coverage has been updated through this PR.

Changes: 0 new tests, 0 removed tests, 0 improved, 2 decreased

Component/Hook Statements Functions Branches Change
Bento 83.1% 82.4% 94.4% 75.2% 74.8% -0.8%
AnchorNav 93.0% 91.7% 78.6% 78.1% -0.4%

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 27, 2025

🟢 No visual differences found

Our visual comparison tests did not find any differences in the UI.

@rezrah rezrah marked this pull request as ready for review October 29, 2025 10:10
@rezrah rezrah requested a review from a team as a code owner October 29, 2025 10:10
Copilot AI review requested due to automatic review settings October 29, 2025 10:10
@rezrah rezrah changed the title WIP Upgrade to eslint v9 Upgrade to eslint v9 Oct 29, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR migrates the project from ESLint v8 to ESLint v9 with flat config support. The main changes include:

  • Replacing .eslintrc.js files with eslint.config.mjs flat config files
  • Upgrading ESLint and related plugins to v9-compatible versions
  • Converting CommonJS imports to ESM imports (e.g., import clsx from 'clsx'import {clsx} from 'clsx')
  • Vendoring the i18n-text/no-en rule due to ESLint v9 incompatibility
  • Refactoring internal component function names for consistency
  • Migrating the Playwright test generator script to ESM

Reviewed Changes

Copilot reviewed 186 out of 188 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
eslint.config.mjs New flat config replacing root .eslintrc.js with vendored i18n rule integration
packages/repo-configs/custom-lint-rules/no-english-text.js Vendored i18n rule for ESLint v9 compatibility
packages/react/src/**/*.tsx Updated clsx imports and component naming conventions
packages/e2e/scripts/playwright/*.ts Migrated test generator from CommonJS to ESM
package.json Upgraded ESLint and plugins to v9-compatible versions
.eslintrc.js (deleted) Removed legacy config files across all packages

Comment thread packages/repo-configs/custom-lint-rules/no-english-text.js
Comment thread packages/repo-configs/custom-lint-rules/no-english-text.js
Comment thread packages/react/src/SubNav/SubNav.tsx
Comment thread packages/design-tokens/scripts/ci-check-diff.ts Outdated
Comment thread packages/design-tokens/scripts/ci-check-diff.ts Outdated
Copy link
Copy Markdown
Collaborator

@danielguillan danielguillan left a comment

Choose a reason for hiding this comment

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

This looks great! No issues detected when running locally.

@rezrah rezrah merged commit 168a187 into main Oct 30, 2025
19 checks passed
@rezrah rezrah deleted the rezrah/migrate-eslint-v9 branch October 30, 2025 10:33
@primer-css primer-css mentioned this pull request Oct 30, 2025
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