Skip to content

Commit

Permalink
Extract argument into a variable
Browse files Browse the repository at this point in the history
  • Loading branch information
alexzherdev committed Sep 8, 2018
1 parent 490f90c commit b356076
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/rules/sort-prop-types.js
Expand Up @@ -262,10 +262,11 @@ module.exports = {
return;
}

if (node.arguments[0].properties) {
checkSorted(node.arguments[0].properties);
} else if (node.arguments[0].type === 'Identifier') {
const variable = variableUtil.findVariableByName(context, node.arguments[0].name);
const firstArg = node.arguments[0];
if (firstArg.properties) {
checkSorted(firstArg.properties);
} else if (firstArg.type === 'Identifier') {
const variable = variableUtil.findVariableByName(context, firstArg.name);
if (variable && variable.properties) {
checkSorted(variable.properties);
}
Expand Down

0 comments on commit b356076

Please sign in to comment.