Removing all unused components from @primer/styled-react#7806
Open
Removing all unused components from @primer/styled-react#7806
Conversation
- Deleted deprecated components including Dialog, Flash, FormControl, Header, Heading, IconButton, Label, Link, LinkButton, SegmentedControl, Spinner, Text, TextInput, ToggleSwitch, UnderlineNav, and ActionList. - Removed their respective type definitions and exports from the index and deprecated files. - Updated the codebase to eliminate reliance on the `sx` prop for these components, encouraging the use of components from `@primer/react` with CSS Modules instead.
🦋 Changeset detectedLatest commit: ed89d86 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes previously-deprecated component wrappers from @primer/styled-react (and its ./deprecated + ./experimental entrypoints) now that their usage has dropped to zero, leaving only the remaining theming/BaseStyles-related exports.
Changes:
- Removed many component wrapper implementations (and related stories/tests) from
packages/styled-react/src/components/**. - Removed the
@primer/styled-react/deprecatedand@primer/styled-react/experimentalsource entrypoints and updated build/test tooling to only targetsrc/index.tsx. - Updated export snapshots and the components.json generator inputs accordingly.
Show a summary per file
| File | Description |
|---|---|
| packages/styled-react/src/index.tsx | Removes re-exports for the removed component wrappers, leaving core theming/BaseStyles utilities. |
| packages/styled-react/src/experimental.tsx | Removed experimental entrypoint source. |
| packages/styled-react/src/deprecated.tsx | Removed deprecated entrypoint source. |
| packages/styled-react/src/components/ActionList.tsx | Removed ActionList wrapper implementation. |
| packages/styled-react/src/components/Box.tsx | Removed Box wrapper implementation. |
| packages/styled-react/src/components/Button.tsx | Removed Button wrapper implementation (and related sx helper logic). |
| packages/styled-react/src/components/Button.stories.tsx | Removed Button Storybook story. |
| packages/styled-react/src/components/Dialog.tsx | Removed Dialog wrapper implementation. |
| packages/styled-react/src/components/Flash.tsx | Removed Flash wrapper implementation. |
| packages/styled-react/src/components/FormControl.tsx | Removed FormControl wrapper implementation. |
| packages/styled-react/src/components/Header.tsx | Removed Header wrapper implementation. |
| packages/styled-react/src/components/Heading.tsx | Removed Heading wrapper implementation. |
| packages/styled-react/src/components/IconButton.tsx | Removed IconButton wrapper implementation. |
| packages/styled-react/src/components/Label.tsx | Removed Label wrapper implementation. |
| packages/styled-react/src/components/Link.tsx | Removed Link wrapper implementation. |
| packages/styled-react/src/components/LinkButton.tsx | Removed LinkButton wrapper implementation. |
| packages/styled-react/src/components/SegmentedControl.tsx | Removed SegmentedControl wrapper implementation. |
| packages/styled-react/src/components/Spinner.tsx | Removed Spinner wrapper implementation. |
| packages/styled-react/src/components/Text.tsx | Removed Text wrapper implementation. |
| packages/styled-react/src/components/TextInput.tsx | Removed TextInput wrapper implementation. |
| packages/styled-react/src/components/ToggleSwitch.tsx | Removed ToggleSwitch wrapper implementation. |
| packages/styled-react/src/components/UnderlineNav.tsx | Removed UnderlineNav wrapper implementation. |
| packages/styled-react/src/components/deprecated/TabNav.tsx | Removed deprecated TabNav wrapper implementation. |
| packages/styled-react/src/components/deprecated/Octicon.tsx | Removed deprecated Octicon wrapper implementation. |
| packages/styled-react/src/components/deprecated/DialogV1.tsx | Removed deprecated DialogV1 wrapper implementation. |
| packages/styled-react/src/components/deprecated/ActionList.tsx | Removed deprecated ActionList wrapper implementation. |
| packages/styled-react/src/tests/primer-react.browser.test.tsx | Removed browser tests covering removed wrappers. |
| packages/styled-react/src/tests/primer-react-experimental.browser.test.tsx | Removed experimental entrypoint browser tests. |
| packages/styled-react/src/tests/primer-react-deprecated.browser.test.tsx | Removed deprecated entrypoint browser tests. |
| packages/styled-react/src/tests/Box.browser.test.tsx | Removed Box-specific browser tests. |
| packages/styled-react/src/tests/exports.test.ts | Updates export snapshot coverage to only the root entrypoint. |
| packages/styled-react/src/tests/deprecated-exports.test.ts | Updates deprecated-export validation to only scan the root entrypoint. |
| packages/styled-react/src/tests/snapshots/exports.test.ts.snap | Updates snapshots to reflect the reduced export surface. |
| packages/styled-react/script/generate-components-json | Updates components.json generation to only scan src/index.tsx. |
| packages/styled-react/rollup.config.js | Updates Rollup inputs to only build src/index.tsx. |
| packages/styled-react/package.json | No functional change shown in diff (formatting only). |
Copilot's findings
Comments suppressed due to low confidence (1)
packages/styled-react/src/index.tsx:7
- This PR removes a large set of public exports from
@primer/styled-react(components and the./deprecated+./experimentalentrypoints). The PR description marks this as a patch release, but the repo’s versioning guidance treats removing a component/public API as a breaking change (major). Please align the rollout strategy and add an appropriate Changeset for the package so the release type matches the API break.
- Files reviewed: 30/31 changed files
- Comments generated: 1
Comment on lines
18
to
21
| export default defineConfig({ | ||
| input: ['src/index.tsx', 'src/experimental.tsx', 'src/deprecated.tsx'], | ||
| input: ['src/index.tsx'], | ||
| external: dependencies.map(createPackageRegex), | ||
| plugins: [ |
Contributor
|
🤖 Lint issues have been automatically fixed and committed to this PR. |
Contributor
|
🤖 Lint issues have been automatically fixed and committed to this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR removes all unused components from
@primer/styled-react. These components werestyled-componentswrappers around@primer/reactcomponents that are no longer needed as consumers have migrated to@primer/reactwith CSS Modules.The following components have been confirmed to have 0 usages in production:
Removed from
@primer/styled-react(main entrypoint)Removed from
@primer/styled-react/deprecatedentrypointRemoved from
@primer/styled-react/experimentalentrypointAdditional internal-only component files removed (never exported publicly)
FormControl.tsxHeader.tsxLinkButton.tsxSegmentedControl.tsxThe
./deprecatedand./experimentalentrypoints have been removed frompackage.jsonexports since they are now empty.What remains in
@primer/styled-reactThe package still exports theming utilities (
ThemeProvider,useTheme,useColorSchemeVar,theme,themeGet), thesxprop utilities (sx,merge), andBaseStyles— all marked as deprecated.Changelog
New
None
Changed
None
Removed
@primer/styled-react(ActionList, Box, Button, Dialog, Flash, Heading, IconButton, Label, Link, Spinner, Text, TextInput, ToggleSwitch, UnderlineNav)./deprecatedand./experimentalentrypoints from package exportsRollout strategy
Testing & Reviewing
All removed components have been verified to have 0 usages via primer-query (links above). Click any component link above to confirm zero usage.
Merge checklist