Skip to content

Commit 17ac433

Browse files
committed
fix(sort-prop-types): Fix sortShapeProp when shape is not an object literal
1 parent d8dff26 commit 17ac433

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/rules/sort-prop-types.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ module.exports = {
7777
* @returns {void}
7878
*/
7979
function checkSorted(declarations) {
80+
// Declarations will be `undefined` if the `shape` is not a literal. For
81+
// example, if it is a propType imported from another file.
82+
if (!declarations) {
83+
return;
84+
}
85+
8086
declarations.reduce((prev, curr, idx, decls) => {
8187
if (/SpreadProperty$/.test(curr.type)) {
8288
return decls[idx + 1];

0 commit comments

Comments
 (0)