Skip to content

Add optional chain to return #359

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Add optional chain to return #359

wants to merge 2 commits into from

Conversation

TylerJDev
Copy link
Member

Fixes an error when imported does not exist in the specifier object. Adds an optional chain to return for cases where imported isn't present.

@Copilot Copilot AI review requested due to automatic review settings June 30, 2025 15:33
@TylerJDev TylerJDev requested a review from a team as a code owner June 30, 2025 15:33
@TylerJDev TylerJDev requested a review from jonrohan June 30, 2025 15:33
Copy link

changeset-bot bot commented Jun 30, 2025

🦋 Changeset detected

Latest commit: 87e74cb

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 Patch

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

Copy link

@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 addresses an error when a specifier's "imported" property is missing by adding optional chaining support.

  • Update in rule file to use optional chaining on "specifier.imported.name" when checking existence in the "entrypoint" map.
  • Addition of a test case to cover wildcard import usage.
  • A changeset update documenting the fix.

Reviewed Changes

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

File Description
src/rules/no-deprecated-experimental-components.js Use optional chaining to safely access specifier.imported.name
src/rules/tests/no-deprecated-experimental-components.test.js Added test case for wildcard import scenario
.changeset/proud-terms-fetch.md Documents the fix for missing "imported" in specifier objects

@TylerJDev TylerJDev enabled auto-merge (squash) June 30, 2025 15:34
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