ember-codemods / ember-angle-brackets-codemod

Codemod to convert curly braces syntax to angle brackets syntax
MIT License
60 stars 32 forks source link

Nodes whose data attributes are valueless are excluded from codemod #237

Closed steventsao closed 4 years ago

steventsao commented 4 years ago

https://github.com/ember-codemods/ember-angle-brackets-codemod/blob/21d0c11c8ef2c7a6774363b2a3be1f0d3e8383f7/transforms/angle-brackets/transform.test.js#L140

Why is this component excluded from the migration whereas the other is not? It seems like this PR has already addressed the issue I'm raising here, yet the test mentioned above is still included and passing.

excluded

{{x-foo
  data-foo
  name="Sophie"
}}

to:

{{x-foo
  data-foo
  name=\\"Sophie\\"
}}

included

{{x-foo data-foo=true}} 

to:

<XFoo @data-foo={{true}} />

At first, I thought Angle Brackets do not accept attributes without a value in general but it probably is not the case based on the blogpost here

<Todo
  role="list-item"
  data-test-todo-item
  data-test-id={{this.todo.id}}
  class="todo {{this.todoClass}}"
/>

Thanks!

backspace commented 4 years ago

Thanks for making a PR for this, it’s saving me a lot of mechanical work! Might I suggest adding a note to the documentation that this exists? I wouldn’t have known if I hadn’t seen this open issue.

rwjblue commented 4 years ago

Ya, documentation PR would be heartily welcomed 😸

backspace commented 4 years ago

fair enough, I don’t know why I didn’t just do it 🙃 but now #328 exists! I think this issue can be closed 🤓

steventsao commented 4 years ago

Closing =) @backspace