Skip to content

Commit

Permalink
Merge pull request #923 from bmish/no-actions-hash-test-spread
Browse files Browse the repository at this point in the history
Fix crash with spread syntax in `no-actions-hash` rule
  • Loading branch information
bmish committed Aug 27, 2020
2 parents a66a983 + 9b88fa8 commit 8be94f9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/utils/ember.js
Expand Up @@ -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) {
Expand Down
5 changes: 5 additions & 0 deletions tests/lib/rules/no-actions-hash.js
Expand Up @@ -64,6 +64,11 @@ ruleTester.run('no-actions-hash', rule, {
},
});
`,

// Spread syntax
'Route.extend({ ...foo });',
'Route.extend(Evented, { ...foo });',
'Route.extend(...foo);',
],

invalid: [
Expand Down

0 comments on commit 8be94f9

Please sign in to comment.