Skip to content

Conversation

siddharthkp
Copy link
Member

@siddharthkp siddharthkp commented Oct 8, 2025

  • AddThemeProvider and BaseStyles to use-styled-react-import rule
  • They should always be imported from styled-react even when they do not have sx prop on them

@siddharthkp siddharthkp requested a review from a team as a code owner October 8, 2025 20:28
@siddharthkp siddharthkp requested review from Copilot and pksjce and removed request for Copilot October 8, 2025 20:28
Copy link

changeset-bot bot commented Oct 8, 2025

🦋 Changeset detected

Latest commit: 4325bde

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

This PR includes changesets to release 1 package
Name Type
eslint-plugin-primer-react Minor

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

@siddharthkp siddharthkp marked this pull request as draft October 8, 2025 20:28
@siddharthkp siddharthkp self-assigned this Oct 8, 2025
Add ThemeProvider, BaseStyles, and useTheme to allow theme components to be imported from styled-react without sx.
@siddharthkp siddharthkp requested review from francinelucca and removed request for pksjce October 10, 2025 09:29
@siddharthkp siddharthkp marked this pull request as ready for review October 10, 2025 09:29
@Copilot Copilot AI review requested due to automatic review settings October 10, 2025 09:29
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 enhances the use-styled-react-import ESLint rule to handle theme-related components and utilities. The change allows ThemeProvider and BaseStyles components to always be imported from @primer/styled-react regardless of whether they use the sx prop, and adds useTheme utility to the list of items that should be imported from styled-react.

  • Added ThemeProvider, BaseStyles, and useTheme to respective component/utility lists
  • Created exemption logic for theme components that should always come from styled-react
  • Refactored the autofix logic to handle batch operations when moving multiple imports

Reviewed Changes

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

File Description
src/rules/use-styled-react-import.js Core rule implementation with new theme component handling and improved autofix logic
src/rules/tests/use-styled-react-import.test.js Comprehensive test cases covering new theme component behaviors
.changeset/short-pumas-kneel.md Changeset documentation for the minor version update

siddharthkp and others added 2 commits October 10, 2025 13:12
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@siddharthkp siddharthkp enabled auto-merge (squash) October 10, 2025 14:03
@siddharthkp siddharthkp disabled auto-merge October 10, 2025 14:03
@siddharthkp siddharthkp merged commit b83f467 into main Oct 13, 2025
9 checks passed
@siddharthkp siddharthkp deleted the use-styled-react-import-theme-components branch October 13, 2025 16:29
@primer-css primer-css mentioned this pull request Oct 13, 2025
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.

2 participants