If the first class in the view model file is not exported, it is scanned nevertheless. Unexported classes are not used as view models by Aurelia and should be skipped.
it("will reject access in unexported class", (done) => {
let viewmodel = `
class Foo{
invalid:string;
}`;
let view = `
<template>
<input type="text" value.bind="invalid">
</template>`;
let reflection = new Reflection();
let rule = new BindingRule(reflection, new AureliaReflection());
let linter = new Linter([rule]);
reflection.add("./foo.ts", viewmodel);
linter.lint(view, "./foo.html")
.then((issues) => {
expect(issues.length).toBe(1);
expect(issues[0].message).toBe("cannot find 'invalid' in type 'Foo'");
done();
});
});
If the first class in the view model file is not exported, it is scanned nevertheless. Unexported classes are not used as view models by Aurelia and should be skipped.