-
Notifications
You must be signed in to change notification settings - Fork 10
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
Support native components with event handlers #52
base: master
Are you sure you want to change the base?
Conversation
This is the result of running the tagless-ember-components-codemod against Ember Bootstrap. The following open pull request have been merged in before: - Support native classes: ember-codemods/tagless-ember-components-codemod#44 - Support component with event handlers: ember-codemods/tagless-ember-components-codemod#52 - Support aria role for native classes: ember-codemods/tagless-ember-components-codemod#56 Steps: mv addon/templates/components/common addon/templates/components/base npx jelhan/tagless-ember-components-codemod#merged-native-class-support mv addon/templates/components/base addon/templates/components/common
Noticed a small bug when running it against Ember Bootstrap. The event handlers are not converted to lower case. @tagName('form')
export default MyComponent extends Component {
keyPress() {
// ...
}
} is transformed to <form {{on "keyPress" this.handleKeyPress}}>
</form> but should be <form {{on "keypress" this.handleKeyPress}}>
</form> It might be enough to call |
Ah, good catch, thanks @jelhan! Fixed it! |
@Turbo87 thanks for merging the other PR. I rebased this, should be ready now as well! Don't want you to feel bored! 😉 |
@simonihmig sorry the radio silence. can you add this as a CLI option? maybe something like |
@Turbo87 sorry, I might have forgotten as some time has passed, but which caveats are you referring to? |
I was talking about the second point of https://github.com/ember-codemods/tagless-ember-components-codemod#known-caveats I've unfortunately seen several codebases already that did something like that :-/ Luckily, there is https://github.com/ember-template-lint/ember-template-lint/blob/master/docs/rule/no-passed-in-event-handlers.md now, that catches this issue, but probably not everyone is using that yet. |
Fixes #42, at least for native components.
Needs #43 and #44 to be merged first. Other than that this should be ready.