From 9b88fa804b1211c92f4d8cc2f4911b81309927ab Mon Sep 17 00:00:00 2001 From: Bryan Mishkin <698306+bmish@users.noreply.github.com> Date: Tue, 25 Aug 2020 21:05:34 -0400 Subject: [PATCH] fix: crash with spread syntax in no-actions-hash rule --- lib/utils/ember.js | 6 +++++- tests/lib/rules/no-actions-hash.js | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/utils/ember.js b/lib/utils/ember.js index 2bb87f4b59..7f973f64ca 100644 --- a/lib/utils/ember.js +++ b/lib/utils/ember.js @@ -406,7 +406,11 @@ function isRouteLifecycleHook(property) { } function isActionsProp(property) { - return property.key.name === 'actions' && types.isObjectExpression(property.value); + return ( + types.isIdentifier(property.key) && + property.key.name === 'actions' && + types.isObjectExpression(property.value) + ); } function isComponentLifecycleHookName(name) { diff --git a/tests/lib/rules/no-actions-hash.js b/tests/lib/rules/no-actions-hash.js index a83b70c513..008acaedc5 100644 --- a/tests/lib/rules/no-actions-hash.js +++ b/tests/lib/rules/no-actions-hash.js @@ -64,6 +64,11 @@ ruleTester.run('no-actions-hash', rule, { }, }); `, + + // Spread syntax + 'Route.extend({ ...foo });', + 'Route.extend(Evented, { ...foo });', + 'Route.extend(...foo);', ], invalid: [