template-lint icon indicating copy to clipboard operation
template-lint copied to clipboard

TypeError: Cannot read property 'Symbol(Symbol.iterator)' of undefined Ln -1 Col -1

Open bondib opened this issue 7 years ago • 4 comments

I'm getting (with a few of my html files):

WARNING: TypeError: Cannot read property 'Symbol(Symbol.iterator)' of undefined Ln -1 Col -1 /src/analysis/vg-selection.html

And I don't see anything special in the html template itself (e.g of /src/analysis/vg-selection.html) that should error like that:

bondib avatar Mar 28 '17 17:03 bondib

hmmm, It would be helpful if you could whittle down your html until you can find something that triggers it; then post the related view-model property for it.

MeirionHughes avatar Mar 28 '17 18:03 MeirionHughes

OK, so I found the issue. It's this part from the HTML above: <a click.delegate="vg.collapsed = !vg.collapsed">

So i agree the code isn't the best - and that this logic should have been placed in a function in the VM, and not inline as it's - but still the linter shouldn't fail on this - as linter wise - it's legit as the code works.

I do understand why it's complicated to validate - so I suggest that instead of validating this type of code (which is complex and not a good approach generally speaking) - maybe a warning should be written - that it's not recommended and that the linter can't verify this type of code...

bondib avatar Mar 30 '17 15:03 bondib

Generally if something isn't supported I'll at least triage it to stop the warnings. What is the view-model property for vg and what is vg type?

MeirionHughes avatar Mar 30 '17 17:03 MeirionHughes

Had the same issue, since the code seem to be failing here: https://github.com/MeirionHughes/aurelia-template-lint/blob/develop/source/rules/binding.ts#L236

..because of args is undefined, it looks like it could be easily patched. I could open a PR but I'm not sure in what way this should behave, would reporting the issue as a warning be good enough?

For now, I've monkey patched it by doing access.args || [] so that it skips the problematic parts of the templates but at least it still proceeds and checks the rest instead of just throwing an error.

bfil avatar May 08 '17 20:05 bfil