ember-codemods / ember-angle-brackets-codemod

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

Add disambiguation of helpers (wrapping in round brackets) #504

Closed mansona closed 4 months ago

lolmaus commented 6 months ago

So this has been fixed by #509.

The problem is that unambiguous helpers do not work in normal Ember! Demo: https://stackblitz.com/edit/ember-cli-editor-output-evmggg?file=app%2Ftemplates%2Fapplication.hbs

It only works with Embroider and staticHelpers flag.

AmilKey commented 5 months ago

@lolmaus maybe add a flag to ignore this(wrapping in round brackets) because it doesn't really work in a normal application

lolmaus commented 5 months ago

@AmilKey I was going to, but I think it has been decided that it was a bug in Ember and should be fixed in Ember.

@mansona Do you know the deets and status?

AmilKey commented 5 months ago

@AmilKey I was going to, but I think it has been decided that it was a bug in Ember and should be fixed in Ember.

this error occurs in versions that are no longer supported, for example 3.28

ef4 commented 5 months ago

It's probably not good for the codemod to do this at all. The parentheses are only required under certain narrow combinations of ember version, embroider version, and embroider settings. Both before and after you complete migration to embroider they're not needed (at least we think that's true if we address our bugs).

ef4 commented 5 months ago

Maybe there's a separate issue with classic builds not supporting this syntax. If so that is a bug though and we should fix that too.

samk1 commented 5 months ago

We're upgrading an Ember application from 3.4, one LTS at a time. Our ember templates are refusing to compile after applying this codemod since helper expression are getting round brackets. For example:

{{partial 'footer'}}

is becoming

{{(partial 'footer')}}

and that's refusing to compile - so being able to turn off this behavior would be helpful to us.

In fact, I might try a monkeypatch to do just that and see if that eases our upgrade path.