-
Notifications
You must be signed in to change notification settings - Fork 605
refactor(project): update to eslint v9 #5972
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
base: main
Are you sure you want to change the base?
Conversation
|
👋 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! |
There was a problem hiding this 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 updates the project to ESLint v9 by migrating to the new flat config while ensuring code consistency with updated linting rules. Key changes include:
- Replacing legacy ESLint configuration (.eslintrc.js) with a comprehensive flat config (eslint.config.mjs).
- Updating event handlers in various ActionList and ActionMenu components from onClick to onSelect per new guidelines.
- Transforming React import statements and ESLint ignore comments (e.g. switching from @ts-ignore to @ts-expect-error) to adhere to updated best practices.
Reviewed Changes
Copilot reviewed 122 out of 124 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
packages/react/src/AnchoredOverlay/AnchoredOverlay.tsx | Updated React import to "import type React" for improved type usage. |
packages/react/src/ActionMenu/ActionMenu.examples.stories.tsx | Replaced onClick with onSelect for action items. |
packages/react/src/ActionList/Item.tsx | Revised the function type suppression comment to reflect the updated rule and event handling changes. |
packages/react/src/ActionBar/ActionBar.tsx | Changed onClick to onSelect for overflow menu actions in the ActionBar. |
packages/react/.storybook/src/accessibility-tool.tsx | Removed optional chaining for window.localStorage for consistency with browser environments. |
packages/postcss-preset-primer/src/index.js | Modified ESLint suppression comments to use @ts-expect-error with explanatory messages. |
eslint.config.mjs | Introduced the new flat ESLint configuration aligning with ESLint v9 requirements. |
.eslintrc.js | Removed the legacy ESLint configuration in favor of the new setup. |
examples/theming/src/app/registry.tsx & examples/nextjs/src/app/registry.tsx | Updated React imports to separate type and value imports. |
Files not reviewed (2)
- .eslintignore: Language not supported
- package.json: Language not supported
Comments suppressed due to low confidence (4)
packages/postcss-preset-primer/src/index.js:9
- The switch from '@ts-ignore' to '@ts-expect-error' is good for clarity; verify that similar updates are applied consistently across other parts of the code.
import customPropertiesFallback from 'postcss-custom-properties-fallback'
.eslintrc.js:1
- The removal of the legacy .eslintrc.js is expected with the migration to ESLint v9; ensure that any custom overrides are fully ported into the new flat config.
module.exports = { ... }
packages/react/.storybook/src/accessibility-tool.tsx:14
- Since window.localStorage is guaranteed in browser environments, this explicit removal of optional chaining is appropriate; ensure the environment consistently supports localStorage.
const currentValue = showSurroundingElements ?? window.localStorage.getItem('showSurroundingElements') === 'true'
eslint.config.mjs:29
- Review that the new flat config accurately reflects all necessary overrides and custom rules from the previous configuration to prevent unexpected linting behavior.
const config = defineConfig([
size-limit report 📦
|
Closes https://github.com/github/primer/issues/4155
Update the project from eslint v7 to eslint v9, including a transformation to the new flat config.
Changelog
New
Changed
Removed
Rollout strategy
This is a change to our internal eslint config