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

Some properties not prefixed #34

Open
kategengler opened this issue Oct 22, 2019 · 10 comments
Open

Some properties not prefixed #34

kategengler opened this issue Oct 22, 2019 · 10 comments
Labels
bug Something isn't working

Comments

@kategengler
Copy link

In multiple places in my codebase, sometimes properties are not prefixed:

{{report.title}} remains unchanged, for example. In the same file {{report.data}} was transformed to {{this.report.data}}

@NullVoxPopuli
Copy link
Collaborator

is it possible to share the file that this behavior occurred in? I'd love to dissect it to try for a reproduction

@kategengler
Copy link
Author

Best I can do is a sanitized version, before running the codemod:

{{yield}}

<header class="sleepy">
  <div class="sneezy">
    <MyMenu @report={{report}} />
  </div>

  <div class="headings">
    <h1 class="title">{{report.title}}</h1>
    <h2 class="author">{{report.author}}<span class="bullet">&bull;</span>{{report.date}}</h2>
  </div>
</header>
<div class="bashful">
  <div class="details">
    <h2 class="headline">Dopey</h2>
    <h3 class="subhead">Count:</h3>
    <span class="body">{{pluralize report.count 'report'}}</span>
    <h3 class="subhead">Values:</h3>
    <span class="body">{{this.report.values}}</span>
  </div>

  <div class="grumpy happy">
    <MyProvider @report={{report.data}} as |data|>
      <MyDisplay @data={{data}} />
    </MyProvider>
    <LinkTo @route="doc.sleepy">
      <button class="wrap">
        {{svg-jar "fullscreen" class="svg-icon"}}
      </button>
    </LinkTo>
  </div>
</div>

<MyDetails @report={{report}} />

@NullVoxPopuli
Copy link
Collaborator

I just ran the codemod on that specific template, and all the report properties properly got a this. prefix. Does there happen to be a report helper in your app?

@kategengler
Copy link
Author

There is not a report helper.

@kategengler
Copy link
Author

This happened many places in the codebase, not all were report

@NullVoxPopuli
Copy link
Collaborator

is the repo you were running this on open source?

@kategengler
Copy link
Author

No, it is a private repo.

I just re-ran the newer version of the codemod on the repo, and while I don't get this particular problem, the files that had this problem before are no longer edited at all, and do not appear in codemods.log. So, {{report}} stays {{report}}, no this. prefix added.

@Turbo87 Turbo87 added the bug Something isn't working label Oct 28, 2019
@Turbo87
Copy link
Contributor

Turbo87 commented Oct 28, 2019

@NullVoxPopuli I think I can reproduce this in an OSS project

The row property should have been converted to this.row, but for some reason it wasn't touched at all.

@NullVoxPopuli
Copy link
Collaborator

Is this still an issue with the latest release? (1.0.1)

@ghost
Copy link

ghost commented Jan 28, 2020

We have observed overly eager transformation of properties.
I cannot reproduce using master and a snippet from fix-table-row.hbs mentioned above: https://github.com/ember-codemods/ember-no-implicit-this-codemod/compare/master...efx:verify-34?expand=1


I am confused however about the role of this codemod versus named arguments. While the test passes in that forked example, the row property comes from outside the component so shouldn't it be @row?.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants