-
Notifications
You must be signed in to change notification settings - Fork 10
Support @primer/styled-react imports in no-unnecessary-components rule
#474
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
Support @primer/styled-react imports in no-unnecessary-components rule
#474
Conversation
🦋 Changeset detectedLatest commit: c5bc58d 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 |
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 extends the no-unnecessary-components ESLint rule to support components imported from @primer/styled-react in addition to @primer/react. This enhancement addresses issue #468 by updating the utility function isPrimerComponent to recognize imports from both packages.
- Updated the regex pattern in
isPrimerComponentto match both@primer/reactand@primer/styled-reactimports - Added test cases to validate the rule works correctly with
@primer/styled-reactimports - Added a changeset documenting this patch-level fix
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/utils/is-primer-component.js | Updated regex to match @primer/styled-react imports and updated JSDoc comment |
| src/rules/tests/no-unnecessary-components.test.js | Added valid and invalid test cases for @primer/styled-react imports |
| .changeset/dark-jobs-type.md | Added changeset entry for the patch fix |
…-react-in-no-unnecessary-components-rule
francinelucca
left a comment
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.
LGTM, @liuliu-dev let's make sure the canary version passes integration checks before merging 🙏🏽
|
@francinelucca Thanks for the heads up! |
…y-components-rule
Extends the
no-unnecessary-componentsrule to work with components imported from@primer/styled-react, not just@primer/react. Fixes #468