-
Notifications
You must be signed in to change notification settings - Fork 25
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
Add support for prefixing this
only for owned properties
#123
base: main
Are you sure you want to change the base?
Conversation
3c0e546
to
084c922
Compare
The telemetry helpers PR has been merged and released as v1.2.0. |
Any update on this PR? This is something we are also running into. |
@rwjblue , could you review the PR whenever you get some time? I ll resolve the merge conflicts until then |
@suchitadoshi1987 Can you please fix the conflicts 😄 |
Ping @suchitadoshi1987 😸 |
I installed from this branch, then ran it and got this error; npx ember-no-implicit-this-codemod http://localhost:4200 .
Cannot find module 'find-package-json'
Require stack:
- /home/user/my-app/node_modules/ember-no-implicit-this-codemod/bin/cli.js Had to add Then I could run it successfully. At that point I noticed it was prefixing I get that problem with the main branch too so it might just be my use of pods. But I was hoping this branch would avoid that problem because it is supposed to be only prefixing this for owned properties. |
Ping! Is this still something we could move forward? |
Ping 😢, did you find a way of doing this @snewcomer ? |
Currently, the
no-implicit-this-codemod
prefixes the local, as well as the passed in args withthis
. While the resulting output of the codemod is guaranteed to be valid runable code, this approach would result in extra churn in the template by changing all paths tothis.*
paths and subsequently require additional cleanup to change anythis.*
paths to leverage named arguments such as@foo
whenever the backing class does not modify the specific property locally.Instead of always prefixing ambiguous paths with
this.
the codemod should only modify the paths that are guaranteed to be local properties of the component. Since the lint rule will complain about all the places in the template where there are still occurrences ofimplicit-this
, it would be easier for the developer to manually inspect all unchanged properties and determine if they need to be prefixed with@
.This PR depends on ember-codemods/ember-codemods-telemetry-helpers#28 PR to be merged
Note: this is an optional feature, to enable it, add the
prefix-component-properties-only=true
flag to your codemod command