-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
ConfigFile: Fix export { X }
parsing
#29344
Conversation
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
4 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
export { X }
parsing
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.
Thanks @vctqs1 !!! Looks great 💯
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 993d250. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
@vctqs1 the failures are unrelated to this PR, and I'd guess are also happening on the base branch. I'll work with the core team to figure out what's going on and get this merged. Thanks so much for your contribution!! |
@shilman Thank you |
Closes #28751 (comment)
What I did
Just add an extra step to check
decl
exists before assign to another variable or accessing inside itHere is the failure message in case having
export { X }
withX
is `import X from 'another file'. Please notice the line 258, and the message error in the terminalIn
_findVarDeclarator
(code), the function currently only handles finding its own declaration within the same file. We lack a step to locate import declarations, which leads to multiple cases where the import can be a file, a native package (Eg 'fs', 'path'), or a package name (node_module's package. Eg: 'react'). Therefore, I believe the best course of action is to add a step to prevent the function from breaking and causing incorrect errors in various situations, as discussed here: GitHub Discussion.Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!
Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal
,ci:merged
orci:daily
GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli/src/sandbox-templates.ts
Make sure this PR contains one of the labels below:
Available labels
bug
: Internal changes that fixes incorrect behavior.maintenance
: User-facing maintenance tasks.dependencies
: Upgrading (sometimes downgrading) dependencies.build
: Internal-facing build tooling & test updates. Will not show up in release changelog.cleanup
: Minor cleanup style change. Will not show up in release changelog.documentation
: Documentation only changes. Will not show up in release changelog.feature request
: Introducing a new feature.BREAKING CHANGE
: Changes that break compatibility in some way with current major version.other
: Changes that don't fit in the above categories.🦋 Canary release
This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the
@storybookjs/core
team here.core team members can create a canary release here or locally with
gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>
Greptile Summary
This pull request adds a safety check in the ConfigFile class to handle imported variables correctly and includes a new test case to verify the behavior. Here are the key changes:
code/core/src/csf-tools/ConfigFile.ts
code/core/src/csf-tools/ConfigFile.test.ts
for handling imported and re-exported variablesThese changes improve the robustness of the ConfigFile class when dealing with imports and ensure proper test coverage for the new functionality.