aurelia / template-lint

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

Support slot and replace-part template replacement. #77

Open MeirionHughes opened 8 years ago

MeirionHughes commented 8 years ago

@ppn2 commented on Tue Aug 09 2016

Many times while using slot and replaceable template, the target element might introduce overriding context. At this moment the linter does not recognize that.

Example (I have omitted the view models for bravity)

--some-element.html
<template>
  <div repeat.for="item of items">
     <template replaceable part="item-template">
         ${item.itemName}
      </template>
  </div>
</template>

Usage:

--main.html
<template>
  <some-element>
    <template replace-part="item-template">
      <div style="color:blue">${item.itemName}</div>
    </template> 
  </some-element>
</template>

In this case linter will look for the item property in the main.ts and raise it as error. Similar behavior can be seen with the slots.

MeirionHughes commented 8 years ago

full support for this would require support for custom elements first : https://github.com/MeirionHughes/aurelia-template-lint/issues/67

I will try to triage this asap so it stops complaining for now.