-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
chore: Apply ESLint rule (object-shorthand) #7851
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
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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 enforces the ESLint object-shorthand
rule across the site codebase and updates the import of importX
to use its flatConfigs
API.
- Converted all object literals to use explicit
key: value
form (to satisfy the new rule configuration). - Updated
eslint-plugin-import-x
import to pull inflatConfigs
correctly. - Cleaned up related warnings in various reducers, components, and generators.
Reviewed Changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
apps/site/reducers/releaseReducer.ts | Expanded dispatch payload shorthand to explicit props |
apps/site/next.rewrites.mjs | Converted shorthand destination to destination: destination |
apps/site/next.mdx.use.mjs | Updated component mapping to explicit shorthand form |
apps/site/next.dynamic.mjs | Converted route mapping shorthand to full props |
apps/site/next.calendar.mjs | Converted URLSearchParams shorthand to explicit props |
apps/site/next-data/generators/websiteFeeds.mjs | Expanded date shorthand to date: date |
apps/site/next-data/generators/releaseData.mjs | Removed redundant fetch: key, expanded other shorthands |
apps/site/next-data/generators/blogData.mjs | Converted blog metadata shorthand to full object fields |
apps/site/next-data/generators/tests/websiteFeeds.test.mjs | Updated test object shorthand for date property |
apps/site/layouts/Blog.tsx | Converted return shorthand to explicit field: field |
apps/site/i18n.tsx | Expanded locale shorthand to locale: locale |
apps/site/hooks/react-generic/useSiteNavigation.ts | Converted navigation mapping shorthand to full props |
apps/site/eslint.config.js | Updated import of importX to flatConfigs |
apps/site/components/withNavBar.tsx | Converted prop shorthand to link: link , target: target |
apps/site/components/withFooter.tsx | Expanded navigation object shorthand |
apps/site/components/withBreadcrumbs.tsx | Converted breadcrumbs mapping to full props |
apps/site/components/withAvatarGroup.tsx | Converted avatar group props shorthand |
apps/site/app/[locale]/page.tsx | Expanded sharedContext shorthands |
apps/site/app/[locale]/next-data/page-data/route.ts | Renamed deflatedSource to content and expanded shorthand |
apps/site/app/[locale]/next-data/api-data/route.ts | Expanded shorthand filename |
Comments suppressed due to low confidence (1)
apps/site/next.mdx.use.mjs:15
- [nitpick] Good use of shorthand here; ensure consistency across similar mappings.
DownloadReleasesTable,
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## main #7851 +/- ##
==========================================
+ Coverage 75.44% 75.49% +0.04%
==========================================
Files 101 101
Lines 8305 8316 +11
Branches 218 218
==========================================
+ Hits 6266 6278 +12
+ Misses 2037 2036 -1
Partials 2 2 ☔ View full report in Codecov by Sentry. |
@@ -44,6 +44,7 @@ export default [ | |||
}, | |||
}, | |||
], | |||
'object-shorthand': ['error', 'consistent-as-needed'], |
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.
I don't know if consistent-as-needed
is needed, I don't see a problem mixing shorthand and non-shorthand properties.
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.
I think it's better to define the code style clearly from the beginning for future contributors. If mixing shorthand properties isn't an issue for everyone, it's fine by me too
Description
We intend to add this as a rule based on the feedback received during code reviews, so it applies consistently across the website for all contributors and helps maintain the code style.
See; (https://eslint.org/docs/latest/rules/object-shorthand)
Additionally, cleaned up the
importX
imports that were given warnings in the project