Content-Length: 323507 | pFad | http://github.com/primer/eslint-plugin-primer-react/commit/1480eba98bd8023c16d55aad5777a52c9da3079d

B1 Add optional chain to return (#359) · primer/eslint-plugin-primer-react@1480eba · GitHub
Skip to content

Commit 1480eba

Browse files
TylerJDevCopilot
andauthored
Add optional chain to return (#359)
* Add optional chain to return * Update src/rules/no-deprecated-experimental-components.js Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 6e69398 commit 1480eba

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

.changeset/proud-terms-fetch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'eslint-plugin-primer-react': patch
3+
---
4+
5+
Fixes error when `imported` does not exist in specifier object

src/rules/__tests__/no-deprecated-experimental-components.test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ ruleTester.run('no-deprecated-experimental-components', rule, {
2424
{
2525
code: `import {DataTable, ActionBar} from '@primer/react/experimental'`,
2626
},
27+
{
28+
code: `import * as RandomComponent from '@primer/react/experimental'`,
29+
},
2730
],
2831
invalid: [
2932
// Single experimental import

src/rules/no-deprecated-experimental-components.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ module.exports = {
4242
const entrypoint = entrypoints.get(node.source.value)
4343

4444
const experimental = node.specifiers.filter(specifier => {
45-
return entrypoint.has(specifier.imported.name)
45+
return entrypoint.has(specifier.imported?.name)
4646
})
4747

48-
const components = experimental.map(specifier => specifier.imported.name)
48+
const components = experimental.map(specifier => specifier.imported?.name)
4949

5050
if (experimental.length === 0) {
5151
return

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/primer/eslint-plugin-primer-react/commit/1480eba98bd8023c16d55aad5777a52c9da3079d

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy