aurelia / template-lint

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

Errors when referencing computedFrom variable in another class #140

Closed timfish closed 7 years ago

timfish commented 7 years ago

Using the following config:

"gulp-aurelia-template-lint": "0.9.1",
config.useRuleAureliaBindingAccess = true;
config.reflectionOpts.sourceFileGlob = 'my/scr/path/**/*.ts';

And the following source files:

my-element.html

<div class="row ${something.classString}">

my-element.ts

export class MyElement {
   public something = new AnotherObj();
}

another-obj.ts

export class AnotherObj {
   public enabled = true;

   @computedFrom('enabled')
   public get classString(){
      // some logic here using this.enabled
   }
}

I get the following error:

WARNING: cannot find 'enabled' in type 'MyElement' Ln X Col Y /src/my-element.html

where X and Y reference the start of the div in the HTML file.

MeirionHughes commented 7 years ago

So it works if you remove the @computedFrom?

timfish commented 7 years ago

Yep. No error if I remove the @computedFrom

MeirionHughes commented 7 years ago

I've disabled the check of @computedFrom; unfortunately the way it had been implemented meant it was difficult to distinguish between ViewModel and imported Class and there wasn't an easy way to refactor the code to support it. Reopened #128