Skip to content

Commit

Permalink
Add SpreadElement and RestElement support to no-unused-state
Browse files Browse the repository at this point in the history
  • Loading branch information
yannickcr committed May 28, 2018
1 parent ce1fec7 commit b3ed9d6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/rules/no-unused-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ module.exports = {
if (prop.type === 'Property') {
addUsedStateField(prop.key);
} else if (
prop.type === 'ExperimentalRestProperty' &&
(prop.type === 'ExperimentalRestProperty' || prop.type === 'RestElement') &&
classInfo.aliases
) {
classInfo.aliases.add(getName(prop.argument));
Expand Down Expand Up @@ -378,6 +378,12 @@ module.exports = {
if (classInfo && isStateReference(node.argument)) {
classInfo = null;
}
},

SpreadElement(node) {
if (classInfo && isStateReference(node.argument)) {
classInfo = null;
}
}
};
})
Expand Down

0 comments on commit b3ed9d6

Please sign in to comment.