Skip to content

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

canerakdas
Copy link
Member

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

@Copilot Copilot AI review requested due to automatic review settings June 8, 2025 17:52
@canerakdas canerakdas requested review from a team as code owners June 8, 2025 17:52
Copy link

vercel bot commented Jun 8, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview Jun 8, 2025 6:23pm

@canerakdas canerakdas changed the title chore: Apply eslint rule (object-shorthand) chore: Apply ESLint rule (object-shorthand) Jun 8, 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 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 in flatConfigs 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,

Copy link

codecov bot commented Jun 8, 2025

Codecov Report

Attention: Patch coverage is 97.43590% with 1 line in your changes missing coverage. Please review.

Project coverage is 75.49%. Comparing base (c375408) to head (7176571).
Report is 2 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
apps/site/hooks/react-generic/useSiteNavigation.ts 0.00% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

@@ -44,6 +44,7 @@ export default [
},
},
],
'object-shorthand': ['error', 'consistent-as-needed'],
Copy link
Member

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.

Copy link
Member Author

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

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