Skip to content

no-actions-hash false positive & failing #2215

@lifeart

Description

@lifeart

Rule: https://github.com/ember-cli/eslint-plugin-ember/blob/master/docs/rules/no-actions-hash.md
Failing on code like:

class MyComponent {
     declare actions: typeof dispatchToActions;
}
class MyComponent {
      actions!: typeof dispatchToActions;
}

Workaround:

class MyComponent {
      ['actions']!: typeof dispatchToActions;
}

Error: TypeError: Cannot read properties of null (reading 'type')

function isActionsProp(property) {
  return (
    types.isIdentifier(property.key) &&
    property.key.name === 'actions' &&
    types.isObjectExpression(property.value) // here property value is null
  );
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions