aurelia / template-lint

Sanity check of Aurelia-flavor template HTML
Apache License 2.0
56 stars 17 forks source link

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

Open bondib opened 7 years ago

bondib commented 7 years ago

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:

MeirionHughes commented 7 years ago

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.

bondib commented 7 years ago

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...

MeirionHughes commented 7 years ago

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?

bfil commented 7 years ago

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.