Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Jordan Harband <ljharb@gmail.com>
  • Loading branch information
Wesitos and ljharb committed Aug 30, 2021
1 parent a734c0f commit 20caf10
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/util/Components.js
Expand Up @@ -620,10 +620,10 @@ function componentRule(rule, context) {
if (node.type === 'FunctionExpression' || node.type === 'ArrowFunctionExpression') {
const isMethod = parent.type === 'Property' && parent.method;
const isPropertyAssignment = parent.type === 'AssignmentExpression'
&& parent.left.type === 'MemberExpression';
&& parent.left.type === 'MemberExpression';
const isModuleExportsAssignment = isPropertyAssignment
&& parent.left.object.name === 'module'
&& parent.left.property.name === 'exports';
&& parent.left.object.name === 'module'
&& parent.left.property.name === 'exports';

if (node.parent.type === 'ExportDefaultDeclaration') {
if (utils.isReturningJSX(node)) {
Expand Down Expand Up @@ -661,9 +661,11 @@ function componentRule(rule, context) {
return isFirstLetterCapitalized(node.id.name) ? node : undefined;
}

if (isPropertyAssignment
&& !isModuleExportsAssignment
&& !isFirstLetterCapitalized(parent.left.property.name)) {
if (
isPropertyAssignment
&& !isModuleExportsAssignment
&& !isFirstLetterCapitalized(parent.left.property.name)
) {
return undefined;
}

Expand Down

0 comments on commit 20caf10

Please sign in to comment.