Skip to content

chore: Remove unused getBreakpointDeclarations function and any related code. #6100

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 1 commit into from
May 21, 2025

Conversation

jonrohan
Copy link
Member

While removing feature flags, I was making note of some utils that aren't needed anymore. These weren't exported out of the package so there's no external use, and since we've refactored to CSS modules there's no internal use either.

Changelog

New

Changed

Removed

Remove unused getBreakpointDeclarations function and any related code.

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

Merge checklist

@Copilot Copilot AI review requested due to automatic review settings May 21, 2025 16:54
@jonrohan jonrohan requested a review from a team as a code owner May 21, 2025 16:54
@jonrohan jonrohan requested a review from TylerJDev May 21, 2025 16:54
Copy link

changeset-bot bot commented May 21, 2025

🦋 Changeset detected

Latest commit: d1c2cbd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Patch

Not sure what this means? Click here to learn what changesets are.

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

@github-actions github-actions bot added the staff Author is a staff member label May 21, 2025
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 21, 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 removes an obsolete responsive styling utility and associated code/tests following the migration to CSS modules.

  • Deleted breakpointHigher, breakpointLower, and mediaQueries from layout.ts
  • Stripped out the getBreakpointDeclarations implementation and imports, leaving only unused helper functions
  • Cleaned up PageHeader tests by removing deprecated media-query-based style assertions

Reviewed Changes

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

File Description
packages/react/src/utils/layout.ts Removed unused breakpoint helper functions and the mediaQueries export
packages/react/src/utils/getBreakpointDeclarations.ts Removed the core implementation; left only two helper functions
packages/react/src/PageHeader/PageHeader.test.tsx Dropped renderStyles tests and media-query imports
.changeset/tangy-facts-guess.md Added changeset entry for the patch release
Comments suppressed due to low confidence (3)

packages/react/src/utils/getBreakpointDeclarations.ts:1

  • [nitpick] After removing getBreakpointDeclarations, this file no longer matches its name. Consider renaming or relocating it to reflect its remaining helper functions, or deleting it if truly unused.
import type {ResponsiveValue} from '../hooks/useResponsiveValue'

packages/react/src/utils/getBreakpointDeclarations.ts:3

  • The helper functions areAllValuesTheSame and haveRegularAndWideSameValue are no longer referenced. Remove these dead functions to clean up unused code.
export function areAllValuesTheSame(responsiveValue: ResponsiveValue<boolean | number | string>): boolean {

packages/react/src/PageHeader/PageHeader.test.tsx:3

  • The MatchMediaMock import and corresponding matchmedia variable are no longer used in the tests—remove them to avoid dead code and potential linter warnings.
import MatchMediaMock from 'jest-matchmedia-mock'

Copy link
Contributor

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 94.42 KB (-0.01% 🔽)
packages/react/dist/browser.umd.js 94.48 KB (+0.01% 🔺)

@jonrohan jonrohan added this pull request to the merge queue May 21, 2025
Merged via the queue into main with commit a7e99f8 May 21, 2025
39 checks passed
@jonrohan jonrohan deleted the cleanup_utils/getBreakpointDeclarations branch May 21, 2025 18:15
@primer primer bot mentioned this pull request May 21, 2025
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 staff Author is a staff member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants