Skip to content

Commit b3ed9d6

Browse files
committed
Add SpreadElement and RestElement support to no-unused-state
1 parent ce1fec7 commit b3ed9d6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/rules/no-unused-state.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ module.exports = {
136136
if (prop.type === 'Property') {
137137
addUsedStateField(prop.key);
138138
} else if (
139-
prop.type === 'ExperimentalRestProperty' &&
139+
(prop.type === 'ExperimentalRestProperty' || prop.type === 'RestElement') &&
140140
classInfo.aliases
141141
) {
142142
classInfo.aliases.add(getName(prop.argument));
@@ -378,6 +378,12 @@ module.exports = {
378378
if (classInfo && isStateReference(node.argument)) {
379379
classInfo = null;
380380
}
381+
},
382+
383+
SpreadElement(node) {
384+
if (classInfo && isStateReference(node.argument)) {
385+
classInfo = null;
386+
}
381387
}
382388
};
383389
})

0 commit comments

Comments
 (0)