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

More helpful error message for {{action}} helper. #1079

Open
gokatz opened this issue Jan 16, 2020 · 2 comments
Open

More helpful error message for {{action}} helper. #1079

gokatz opened this issue Jan 16, 2020 · 2 comments

Comments

@gokatz
Copy link

gokatz commented Jan 16, 2020

The rule, no-action-modifier affects both modifier and helper.

However, the error message, Do not use 'action' as <div {{action ...}} />. Instead, use the 'on' modifier and 'fn' helper is only suitable for modifier usage.

In place of {{action}} helper (say, in closure action), the error message should advise using the @action decorator.

Screenshot 2020-01-16 at 11 35 01 AM

@lifeart
Copy link
Collaborator

lifeart commented Feb 6, 2020

I think @action decorator mention may confuse user, because of different context (template), but I like idea about error message improvment, could we figure out proper message?

<MyComponent @handler={{action this.test}} />

Do not use action helper for this.test context binding. Instead, use @action decorator for method this.test in component class.


<MyComponent @handler={{action this.test this.someProp}} />

Do not use action helper for this.test context binding. Instead, use @action decorator for method this.test in component class. And fn helper to bind method arguments, like: @handler={{fn this.test this.someProp}}

@rwjblue
Copy link
Member

rwjblue commented Feb 21, 2020

@gokatz - The no-action-modifierrule should only be warning about modifier usage, the no-action rule should flag both helper and modifier and the resulting message should tell you the right thing to use in each scenario.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants