aurelia / template-lint

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

Check template contents are valid for root #142

Open MeirionHughes opened 7 years ago

MeirionHughes commented 7 years ago

given a html container, when it has a <template> child then ensure that the template has a template-controller and ensure contents are valid for the root html container.

example:

<select>
  <template if.bind="foo">
    <template repeat.for="item of items">
       <option ... ></option> <!-- OK -->
       <div ...></div> <!-- INVALID -->
    </template>
  </template>
</select>

should report that <div> is not a valid child of <select>

<select>
  <template> 
     ...
  </template>
</select>

should warn that the template won't be activated in aurelia

zakjan commented 7 years ago

+1

Just a note, if.bind and repeat.for are not allowed on the same element, because their order is undefined. They need to be nested.

MeirionHughes commented 7 years ago

Good point; It'll have to check through nested templates.