Skip to content

Fix yarn.lock v1 scoped alias for unscoped package - #5470

Open
Shubham-dev-stack wants to merge 1 commit into
aboutcode-org:developfrom
Shubham-dev-stack:fix-yarn-lock-v1-scoped-alias
Open

Shubham-dev-stack wants to merge 1 commit into
aboutcode-org:developfrom
Shubham-dev-stack:fix-yarn-lock-v1-scoped-alias

Conversation

@Shubham-dev-stack

Copy link
Copy Markdown

Fixes #5466

When a yarn.lock v1 file has a scoped alias for an unscoped package (like @jest/react-is-18@npm:react-is@^18.3.1), YarnLockV1Handler.parse was failing with an AssertionError because req.count('@') is 3 instead of 2 or 4.

Also, if we only allowed 3 @s, splitting on / first would leave @jest as the namespace for react-is. So I stripped the <alias>@npm: prefix before rpartition('/') to get the right package name and empty namespace.

Added a test case and expected fixture for this in tests/packagedcode/test_npm.py.

Tasks

  • Reviewed contribution guidelines
  • PR is descriptively titled and links the original issue above
  • Tests pass -- ran pytest tests/packagedcode/test_npm.py -k yarn_lock locally
  • Commits are in uniquely-named feature branch and has no merge conflicts

@Shubham-dev-stack

Copy link
Copy Markdown
Author

Hi @JonoYang @pombredanne, gentle ping on this PR when you have a moment. All package parsing tests and fixtures pass locally. Happy to address any feedback or adjust anything needed!

Signed-off-by: Shubham <shubhamcyberr@gmail.com>
@Shubham-dev-stack
Shubham-dev-stack force-pushed the fix-yarn-lock-v1-scoped-alias branch from faed1da to ee88d60 Compare December 2, 2026 03:05

This branch has not been deployed

No deployments
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.

yarn.lock v1 with a scoped alias of an unscoped package yields no packages and no error

1 participant