Skip to content

Commit

Permalink
Fix array-to-string coercion bug
Browse files Browse the repository at this point in the history
  • Loading branch information
brettdh authored and ljharb committed Feb 21, 2018
1 parent 0f480f6 commit 8cc1aa8
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions lib/rules/no-typos.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,14 @@ module.exports = {
}

function isPropTypesPackage(node) {
// Note: we really do want == with the package names here,
// since we need value equality, not identity - and
// these values are always string or null.
/* eslint-disable eqeqeq */
return (
node.type === 'Identifier' &&
node.name == propTypesPackageName
node.name === propTypesPackageName
) || (
node.type === 'MemberExpression' &&
node.property.name === 'PropTypes' &&
node.object.name == reactPackageName
node.object.name === reactPackageName
);
/* eslint-enable eqeqeq */
}

/* eslint-disable no-use-before-define */
Expand Down Expand Up @@ -158,7 +153,7 @@ module.exports = {
node.specifiers
.filter(specifier => specifier.imported && specifier.imported.name === 'PropTypes')
.map(specifier => specifier.local.name)
) : null;
)[0] : null;
}
},

Expand Down

0 comments on commit 8cc1aa8

Please sign in to comment.