diff --git a/lib/rules/no-unused-state.js b/lib/rules/no-unused-state.js index cf8cbf917f..a142890c11 100644 --- a/lib/rules/no-unused-state.js +++ b/lib/rules/no-unused-state.js @@ -371,7 +371,7 @@ module.exports = { } const scope = childScope.variableScope.childScopes.find((x) => x.block === node.value); const stateArg = node.value.params[1]; // probably "state" - if (!scope.variables) { + if (!scope || !scope.variables) { return; } const argVar = scope.variables.find((x) => x.name === stateArg.name);