Skip to content

chore(deps): update eslint and related deps to v9 #6126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
May 29, 2025

Conversation

joshblack
Copy link
Member

@joshblack joshblack commented May 28, 2025

Closes https://github.com/github/primer/issues/4155

This is take 2 for updating the project to use ESLint v9. The previous attempt ended up having a larger than expected diff so I updated some plugins and then opened this up again so that it was easier to merge.

Changelog

New

Changed

  • Update eslint to v9
  • Migrate our eslint config to the new flat config
  • Address new eslint errors, mostly from removed/replaced rules

Removed

@Copilot Copilot AI review requested due to automatic review settings May 28, 2025 16:24
@joshblack joshblack requested a review from a team as a code owner May 28, 2025 16:24
@joshblack joshblack requested a review from hectahertz May 28, 2025 16:24
Copy link

changeset-bot bot commented May 28, 2025

⚠️ No Changeset found

Latest commit: 2d5c981

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@github-actions github-actions bot added the staff Author is a staff member label May 28, 2025
@joshblack joshblack added skip changeset This change does not need a changelog and removed staff Author is a staff member labels May 28, 2025
@joshblack joshblack requested a review from francinelucca May 28, 2025 16:25
Copy link
Contributor

👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks!

@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label May 28, 2025
Copy link
Contributor

@Copilot 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 upgrades the repository to ESLint v9 by migrating to the new flat config format, updating related dependencies, and adjusting code to satisfy new lint rules and plugin changes.

  • Migrated from legacy .eslintrc.js to eslint.config.mjs with flat config and updated plugin rules
  • Bumped ESLint/core plugins to v9+ in package.json
  • Replaced deprecated event handlers (onClick → onSelect) and added temporary disables for unused maps

Reviewed Changes

Copilot reviewed 37 out of 37 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/react/src/Overlay/Overlay.tsx Disabled unused widthMap for new lint setup
packages/react/src/NavList/NavList.tsx Swapped onClickonSelect on navigation items
packages/react/src/Dialog/Dialog.tsx Disabled unused heightMap/widthMap for lint
packages/react/src/BranchName/tests/BranchName.types.test.tsx Removed redundant ESLint disables in type tests
packages/react/src/BranchName/BranchName.tsx Updated ESLint disable from ban-types to new rule
packages/react/src/ActionMenu/ActionMenu.examples.stories.tsx Replaced onClickonSelect in example stories
packages/react/src/ActionList/Item.tsx Updated ESLint disable to no-unsafe-function-type
packages/react/src/ActionList/ActionListContainerContext.tsx Updated ESLint disable to no-unsafe-function-type
packages/react/src/ActionList/ActionList.features.stories.tsx Swapped onClickonSelect in feature stories
packages/react/src/ActionList/ActionList.dev.stories.tsx Swapped onClickonSelect in dev stories
packages/react/src/ActionBar/ActionBar.tsx Swapped onClickonSelect in ActionBar items
packages/react/src/ActionBar/ActionBar.examples.stories.tsx Swapped onClickonSelect in examples
packages/react/.storybook/theme.js Added ESLint disable for import/named in Storybook
packages/react/.storybook/src/accessibility-tool.tsx Added disables and deps for SSR-friendly lint rules
packages/postcss-preset-primer/src/index.js Switched @ts-ignore to @ts-expect-error
package.json Bumped ESLint and related packages to v9+
eslint.config.mjs Introduced new flat ESLint configuration
e2e/components/ActionList.test.ts Commented-out legacy tests removed for clarity
.eslintrc.js Removed legacy ESLint config
.eslintignore Removed redundant ignore file
Comments suppressed due to low confidence (3)

e2e/components/ActionList.test.ts:206

  • Instead of commenting out tests, use test.skip or update the feature-flag logic so the test remains active and coverage is preserved.
// removing this temporarily as there is a slight diff betqeen default and enabled CSS feature flag that feels like a non-issue

packages/react/src/Overlay/Overlay.tsx:40

  • Consider removing the unused widthMap constant entirely, or exporting it if it will be used soon, to avoid disabling the unused-vars rule.
// eslint-disable-next-line @typescript-eslint/no-unused-vars

packages/react/src/Dialog/Dialog.tsx:171

  • The heightMap and widthMap objects are not referenced. Remove them or integrate their usage to clean up the code.
// eslint-disable-next-line @typescript-eslint/no-unused-vars

Copy link
Contributor

github-actions bot commented May 28, 2025

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 94.4 KB (+0.05% 🔺)
packages/react/dist/browser.umd.js 94.45 KB (-0.12% 🔽)

@github-actions github-actions bot requested a deployment to storybook-preview-6126 May 28, 2025 16:32 Abandoned
@francinelucca
Copy link
Member

@copilot can you fix the broken CI here?

@joshblack joshblack added this pull request to the merge queue May 29, 2025
Merged via the queue into main with commit f390ce5 May 29, 2025
36 checks passed
@joshblack joshblack deleted the refactor/update-to-eslint-v9-take-2 branch May 29, 2025 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm skip changeset This change does not need a changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants