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

Fails on simple liquid-if block #19

Closed
jacobq opened this issue Apr 19, 2019 · 2 comments · Fixed by #30
Closed

Fails on simple liquid-if block #19

jacobq opened this issue Apr 19, 2019 · 2 comments · Fixed by #30

Comments

@jacobq
Copy link

jacobq commented Apr 19, 2019

Input:

{{#liquid-if (gt rows.length 0)}}{{/liquid-if}}

Error:

Transformation error (Transformation angle-brackets-syntax.js errored on file app/templates/components/some-component.hbs. Reason TypeError: Cannot read property 'startsWith' of undefined.
Please report this in https://github.com/rajasegar/ember-angle-brackets-codemod/issues 
Stack trace: TypeError: Cannot read property 'startsWith' of undefined
     at startsWith (/home/user/.npm/_npx/13031/lib/node_modules/ember-angle-brackets-codemod/transforms/angle-brackets/transforms/angle-brackets-syntax.js:155:69)
     at Array.filter (<anonymous>)
     at filter (/home/user/.npm/_npx/13031/lib/node_modules/ember-angle-brackets-codemod/transforms/angle-brackets/transforms/angle-brackets-syntax.js:155:38)
     at tranformValuelessDataParams (/home/user/.npm/_npx/13031/lib/node_modules/ember-angle-brackets-codemod/transforms/angle-brackets/transforms/angle-brackets-syntax.js:193:44)
     at visitNode (../../../../../packages/@glimmer/syntax/lib/traversal/traverse.ts:97:14)
     at visitArray (../../../../../packages/@glimmer/syntax/lib/traversal/traverse.ts:187:18)
     at visitKey (../../../../../packages/@glimmer/syntax/lib/traversal/traverse.ts:168:5)
     at visitNode (../../../../../packages/@glimmer/syntax/lib/traversal/traverse.ts:117:7)
     at Object.traverse (../../../../../packages/@glimmer/syntax/lib/traversal/traverse.ts:231:3)
     at traverse (/home/user/.npm/_npx/13031/lib/node_modules/ember-angle-brackets-codemod/transforms/angle-brackets/transforms/angle-brackets-syntax.js:161:11)
Source: {{#liquid-if (gt rows.length 0)}}{{/liquid-if}} )

Also, if the condition/argument is changed then it doesn't throw this error yet produces incorrect output (interprets helper name as component name):

Input 2:

{{#liquid-if foo}}{{/liquid-if}}

Output:

<LiquidIf />

This appears to be related to #12

@GavinJoyce
Copy link
Collaborator

https://github.com/rajasegar/ember-angle-brackets-codemod/pull/28 should help.

We should probably consider expanding the list of built in known helpers though

@tylerturdenpants
Copy link
Collaborator

See issue #29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants