-
Notifications
You must be signed in to change notification settings - Fork 616
chore: add @eslint-react/eslint-plugin #6145
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
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 integrates the new @eslint-react/eslint-plugin
at version 9 and applies autofixes and refactors to satisfy the newly enabled lint rules.
- Adds the ESLint plugin to
package.json
and updateseslint.config.mjs
- Introduces shared default constants (e.g.
defaultRenderAnchor
,defaultSxProp
, etc.) to replace inline object defaults - Applies automatic React lint fixes and refactors across multiple components
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
packages/react/src/deprecated/ActionMenu.tsx | Extract inline renderAnchor default into defaultRenderAnchor |
packages/react/src/tests/hooks/useMnemonics.test.tsx | Removed fallback onSelect default in test fixture |
packages/react/src/SelectPanel/SelectPanel.tsx | Moved inline renderAnchor to defaultRendorAnchor constant |
packages/react/src/PageLayout/PageLayout.tsx | Replaced sx = {} defaults with imported defaultSxProp |
packages/react/src/PageHeader/PageHeader.tsx | Replaced sx = {} default with defaultSxProp |
packages/react/src/Overlay/Overlay.tsx | Removed default empty object for styleFromProps |
packages/react/src/DialogV1/Dialog.tsx | Removed unused Box import and propTypes on DialogHeader |
packages/react/src/Dialog/Dialog.tsx | Added defaultFooterButtons constant for footerButtons default |
packages/react/src/DataTable/Pagination.tsx | Introduced defaultShowPages constant for showPages default |
packages/react/src/AnchoredOverlay/AnchoredOverlay.tsx | Introduced defaultVariant constant for variant default |
package.json | Added @eslint-react/eslint-plugin dependency |
eslint.config.mjs | Enabled eslint-react configs and rule overrides |
Comments suppressed due to low confidence (5)
packages/react/src/SelectPanel/SelectPanel.tsx:137
- The constant name
defaultRendorAnchor
appears to have a typo (Rendor
vs.Render
). Consider renaming it todefaultRenderAnchor
for clarity.
const defaultRendorAnchor: SelectPanelProps['renderAnchor'] = props => {
packages/react/src/tests/hooks/useMnemonics.test.tsx:6
- Removing the default
onSelect = () => null
meansonSelect
may be undefined in tests that don’t pass it explicitly, leading to runtime errors. Restore a safe default or mark it as required.
onSelect,
packages/react/src/Overlay/Overlay.tsx:105
- By removing the default (
= {}
),styleFromProps
can be undefined and may cause errors when spread into another object. Consider reintroducing a default empty object.
style: styleFromProps,
packages/react/src/Dialog/Dialog.tsx:231
- [nitpick] Using a shared array constant as a default prop can lead to unexpected mutations if the array is modified at runtime. Consider using a factory function or inline default to ensure a new array per instance.
const defaultFooterButtons: Array<DialogButtonProps> = []
packages/react/src/DataTable/Pagination.tsx:175
- [nitpick] Similar to
defaultFooterButtons
, this shared object may be mutated unintentionally. Consider returning a fresh object per invocation or documenting that it should be treated as immutable.
const defaultShowPages = {
size-limit report 📦
|
Now that we're on eslint v9, we can use https://eslint-react.xyz/ 🥳 This PR adds the package to the project along with some quick refactors for some rules.
Changelog
New
Changed
Removed