Skip to content

Commit

Permalink
fix(sort-prop-types): Fix sortShapeProp when shape is not an object l…
Browse files Browse the repository at this point in the history
…iteral
  • Loading branch information
justinanastos committed Jan 31, 2018
1 parent d8dff26 commit 17ac433
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/rules/sort-prop-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ module.exports = {
* @returns {void}
*/
function checkSorted(declarations) {
// Declarations will be `undefined` if the `shape` is not a literal. For
// example, if it is a propType imported from another file.
if (!declarations) {
return;
}

declarations.reduce((prev, curr, idx, decls) => {
if (/SpreadProperty$/.test(curr.type)) {
return decls[idx + 1];
Expand Down

0 comments on commit 17ac433

Please sign in to comment.