aurelia / template-lint

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

Integration with aurelia-validation #176

Closed michaelbull closed 3 years ago

michaelbull commented 7 years ago

In the Aurelia validation docs there is an example of using the validation-errors custom attribute to bind to specific validation errors. The field it binds to does not need to exist in the ViewModel for this to work, as such aurelia-template-lint complains about the field being missing from the ViewModel when typechecking is enabled:

ERROR in ./src/components/login-form.html
(Emitted value instead of an instance of Error) [4, 5]: cannot find 'nameErrors' in type 'LoginForm'
[7, 7]: cannot find 'nameErrors' in type 'LoginForm'

Example code:

    <div validation-errors.bind="nameErrors">
      <label for="name">Name:</label>
      <input id="name" value.bind="name & validate"/>
      <strong repeat.for="result of nameErrors">${result.error.message}</strong>
    </div>