Skip to content

Commit

Permalink
Perform callback detection before toLowerCase()
Browse files Browse the repository at this point in the history
  • Loading branch information
Joachim Seminck committed May 23, 2017
1 parent b66268b commit 12067db
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/rules/jsx-sort-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ module.exports = {
var currentPropName = propName(decl);
var previousValue = memo.value;
var currentValue = decl.value;
var previousIsCallback = isCallbackPropName(previousPropName);
var currentIsCallback = isCallbackPropName(currentPropName);

if (ignoreCase) {
previousPropName = previousPropName.toLowerCase();
Expand Down Expand Up @@ -186,9 +188,6 @@ module.exports = {
}

if (callbacksLast) {
var previousIsCallback = isCallbackPropName(previousPropName);
var currentIsCallback = isCallbackPropName(currentPropName);

if (!previousIsCallback && currentIsCallback) {
// Entering the callback prop section
return decl;
Expand Down

0 comments on commit 12067db

Please sign in to comment.