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

Merged
merged 3 commits into from
Jul 7, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/proud-terms-fetch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'eslint-plugin-primer-react': patch
---

Fixes error when `imported` does not exist in specifier object
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ ruleTester.run('no-deprecated-experimental-components', rule, {
{
code: `import {DataTable, ActionBar} from '@primer/react/experimental'`,
},
{
code: `import * as RandomComponent from '@primer/react/experimental'`,
},
],
invalid: [
// Single experimental import
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-deprecated-experimental-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ module.exports = {
const entrypoint = entrypoints.get(node.source.value)

const experimental = node.specifiers.filter(specifier => {
return entrypoint.has(specifier.imported.name)
return entrypoint.has(specifier.imported?.name)
})

const components = experimental.map(specifier => specifier.imported.name)
Expand Down