Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint against using class and .extend together (except with mixins) #4

Open
pzuraq opened this issue Jan 23, 2019 · 0 comments
Open

Lint against using class and .extend together (except with mixins) #4

pzuraq opened this issue Jan 23, 2019 · 0 comments

Comments

@pzuraq
Copy link
Collaborator

@pzuraq pzuraq commented Jan 23, 2019

In general, the following pattern should be avoided:

export default class PersonComponent extends Component.extend({
  fullName: computed({
    get() {
      return `${this.firstName} ${this.lastName}`; 
    }
  })
}) {
  firstName = 'Diana';
  lastName = 'Prince';
}

However, it is valid to pass a number of mixins to .extend()

export default class PersonComponent extends Component.extend(FullNameMixin, OtherMixin) {
  firstName = 'Diana';
  lastName = 'Prince';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant