-
Notifications
You must be signed in to change notification settings - Fork 10
Fix for deprecated and experimental import paths #410
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
Conversation
🦋 Changeset detectedLatest commit: 0159ee3 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 |
Fixes deprecated and experimental import paths in eslint-plugin-primer-react.
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 fixes the use-styled-react-import ESLint rule to properly handle deprecated and experimental import paths from Primer React. The rule was missing transformations for components like Octicon and Dialog because they were imported from subpaths like @primer/react/deprecated and @primer/react/experimental.
- Updates import detection logic to handle subpaths using
startsWith()checks - Modifies path transformation to preserve subpath structure when converting between
@primer/reactand@primer/styled-react - Adds comprehensive test coverage for the new subpath functionality
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/rules/use-styled-react-import.js | Enhanced import detection and path transformation logic to support subpaths |
| src/rules/tests/use-styled-react-import.test.js | Added test cases for experimental and deprecated import paths |
| .changeset/cyan-carrots-boil.md | Added changeset documenting the fix |
Comments suppressed due to low confidence (1)
src/rules/tests/use-styled-react-import.test.js:55
- [nitpick] The existing test case structure was modified unnecessarily. The original compact error format was more readable than expanding it to multiple lines.
{
messageId: 'useStyledReactImport',
data: {componentName: 'Box'},
},
Copilot
AI
Sep 12, 2025
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.
[nitpick] Consider adding a comment explaining why importSource is now stored in the import info object, as this change enables proper subpath handling in the fix functions.
Uh oh!
There was an error while loading. Please reload this page.
This is a fix to the
use-styled-react-importplugin. It was missing transformingOcticonandDialogand I found the reason was that these components came from deprecated and experimental import paths