Skip to content

Commit

Permalink
Fix crash with default computed property import in `no-unused-service…
Browse files Browse the repository at this point in the history
…s` rule (#1870)
  • Loading branch information
bmish committed May 21, 2023
1 parent 71be77f commit 3f9a95f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/rules/no-unused-services.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ module.exports = {
}
if (node.source.value === '@ember/object/computed') {
for (const spec of node.specifiers) {
if (spec.type === 'ImportDefaultSpecifier') {
continue;
}
const name = spec.imported.name;
if (macros.includes(name)) {
const localName = spec.local.name;
Expand Down
1 change: 1 addition & 0 deletions tests/lib/rules/no-unused-services.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ ruleTester.run('no-unused-services', rule, {
`${SERVICE_IMPORT} class MyClass {}`,
`${SERVICE_IMPORT} Component.extend({});`,
'const foo = service();',
"import ComputedProperty from '@ember/object/computed';",
],
invalid: [
{
Expand Down

0 comments on commit 3f9a95f

Please sign in to comment.