Skip to content

Commit

Permalink
add some guards
Browse files Browse the repository at this point in the history
  • Loading branch information
quantizor committed Jul 8, 2021
1 parent bc53627 commit 0c16c1b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/visitors/displayNameAndId.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const addConfig = t => (path, displayName, componentId) => {
if (
existingConfig &&
existingConfig.arguments.length &&
Array.isArray(existingConfig.arguments[0].properties) &&
!existingConfig.arguments[0].properties.some(prop =>
['displayName', 'componentId'].includes(prop.key.name)
)
Expand All @@ -59,6 +60,7 @@ const addConfig = t => (path, displayName, componentId) => {
path.node.callee.callee.property.name &&
path.node.callee.callee.property.name == 'withConfig' &&
path.node.callee.arguments.length &&
Array.isArray(path.node.callee.arguments[0].properties) &&
!path.node.callee.arguments[0].properties.some(prop =>
['displayName', 'componentId'].includes(prop.key.name)
)
Expand Down Expand Up @@ -216,6 +218,8 @@ export default t => (path, state) => {
path.node.callee.callee.property &&
path.node.callee.callee.property.name &&
path.node.callee.callee.property.name === 'withConfig' &&
path.node.callee.arguments.length &&
Array.isArray(path.node.callee.arguments[0].properties) &&
!path.node.callee.arguments[0].properties.some(prop =>
['displayName', 'componentId'].includes(prop.key.name)
))
Expand Down

0 comments on commit 0c16c1b

Please sign in to comment.