ember-no-implicit-this-codemod icon indicating copy to clipboard operation
ember-no-implicit-this-codemod copied to clipboard

Transform to `{{@foo}}` if component class does not define the property

Open jelhan opened this issue 5 years ago • 7 comments

In it's current state the codemod transforms {{foo}} always to {{this.foo}} (skipping template-only components). It should transform {{foo}} to {{@foo}} instead if the property is not defined by the class of the codemod.

It may always transform to {{this.foo}} if the component extends from another component cause parsing parent classes may be to complex. It should print a warning in that case.

jelhan avatar Jan 18 '20 10:01 jelhan

I think given that we can use the arguments passed into the component to reference what needs this. and what needs @ this should be straightforward. Looking into fixing this for our use cases in our application.

gabrielcsapo avatar Apr 10 '20 21:04 gabrielcsapo

I'm pretty sure that @suchitadoshi1987 has work in progress to address this.

rwjblue avatar Apr 16 '20 18:04 rwjblue

@rwjblue she said she would link to this issue in a conversation I had with her. @suchitadoshi1987 😄

gabrielcsapo avatar Apr 16 '20 19:04 gabrielcsapo

https://github.com/ember-codemods/ember-no-implicit-this-codemod/pull/123 This PR would address this issue. However, it will not assume the prefixing of @. It just makes the prefixing of this more stricter.

suchitadoshi1987 avatar Apr 16 '20 20:04 suchitadoshi1987

cc @gabrielcsapo ^^

suchitadoshi1987 avatar Apr 16 '20 20:04 suchitadoshi1987

thank you @suchitadoshi1987

gabrielcsapo avatar Apr 16 '20 20:04 gabrielcsapo

Any update on this?

kexposito avatar Apr 01 '24 17:04 kexposito