Skip to content

Commit 3d995d1

Browse files
committed
Fix eslint failing with TypeError when default export is not an object
1 parent 6b0f0a5 commit 3d995d1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function findPropertyWithName(name, propertyArray) {
4545
// Does a component contain the right property? e.g. key, version
4646
function componentContainsPropertyCheck(context, node, propertyName, message) {
4747
let component;
48-
if (isDefaultExport(node)) {
48+
if (isDefaultExport(node) && isObjectWithProperties(node.declaration)) {
4949
component = node.declaration;
5050
}
5151

@@ -81,7 +81,7 @@ function getProps(moduleProperties) {
8181
// Do component props contain the right properties? e.g. label, description
8282
function componentPropsContainsPropertyCheck(context, node, propertyName) {
8383
let component;
84-
if (isDefaultExport(node)) {
84+
if (isDefaultExport(node) && isObjectWithProperties(node.declaration)) {
8585
component = node.declaration;
8686
}
8787
if (node.expression) {
@@ -120,7 +120,7 @@ function componentPropsContainsPropertyCheck(context, node, propertyName) {
120120

121121
function optionalComponentPropsHaveDefaultProperty(context, node) {
122122
let component;
123-
if (isDefaultExport(node)) {
123+
if (isDefaultExport(node) && isObjectWithProperties(node.declaration)) {
124124
component = node.declaration;
125125
}
126126

@@ -167,7 +167,7 @@ function optionalComponentPropsHaveDefaultProperty(context, node) {
167167
// the node with the name specified by the user
168168
function checkComponentIsSourceAndReturnTargetProp(node, propertyName) {
169169
let component;
170-
if (isDefaultExport(node)) {
170+
if (isDefaultExport(node) && isObjectWithProperties(node.declaration)) {
171171
component = node.declaration;
172172
}
173173

@@ -216,7 +216,7 @@ function componentSourceDescriptionCheck(context, node) {
216216

217217
function componentVersionTsMacroCheck(context, node) {
218218
let component;
219-
if (isDefaultExport(node)) {
219+
if (isDefaultExport(node) && isObjectWithProperties(node.declaration)) {
220220
component = node.declaration;
221221
}
222222

0 commit comments

Comments
 (0)