-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Aurelia Bindings #4
Comments
I can't really think of anything useful to implement for this; the binding itself should be sanitized by Aurelia's templating engine. |
could possibly run this through aurelia's binding and expression engine to see if it is well formed at least. requires: aurelia/dependency-injection#95 |
This is done in run-time, it is too late to catch bugs. The linter should check it in build-time. |
I think there are a few issues here;
checking the syntax is possible; I did try to make up a regex check, but the binds can be extremely complex. Someone would need to come up with a comprehensive list of what is good syntax (all the complex cases) and what is bad syntax. As for checking that bindings to the view-model are okay - that's a difficult proposition for a stream-based linter. The crude solution would be to look for a js file with the same name, load it up and check variables, but there are so many different ways that people can use aurelia that this solution seems pointless... also if you include all the The better solution would be to have an entirely separate testing tool that effectively load up the app in a testing area then runs automated tests based off the input files... for example: Load up the app with web-driver / selenium / protractor, analyze the view and view-model and look check to make sure its all bound up correctly and everything has been found. You can also check with the webdriver to ensure no 404's etc... So basically... I think if you want build-time checking for your complex bindings, it'll need to be some kind of automatically generated E2E test and run it through protractor. @EisenbergEffect thoughts? |
@MeirionHughes, note that in additon to build-time validation issue in aurelia/tools, I've created another issue(Common platform for all IDE plugins). One thing that both of the "features" rely on, would be a service from Aurelia.
as well as build tools, such as gulp.
lots of great things i listed in that issue. I think it is possible to build such service from Aurelia and to implement extensive static code analysis on top of it. That said, i really hope that following would not be needed:
When Aurelia implements the service that provides the model and tools to verify expressions, this task wouldn't probably be difficult any more for the linter (as I understand).
@EisenbergEffect, i guess it is doable, what do You think? |
Another option (to automated e2e) would be to feed the linter with all html and js file streams (by name). Get them parsed through
then you find the component named foo.html: <template bindable="person">
${person.name}
</template> at which point you can detect that the template has been used correctly. i.e. However, if you want to make sure your template is well formed, then I think you'd need to introduce typescript types: <template bindable="person:Person">
${person.nme} <!-- oops -->
</template> Now, technically you could do this entirely outside of aurelia... i.e. we simply introduce the syntax |
I've planned a few improvements to template-lint that should help achieve the "second-pass" feature (i.e. rules that require checking other files); MeirionHughes/template-lint#17 |
effectively solved by checking the types (need to load up bindings). continue discussion in https://github.com/MeirionHughes/aurelia-template-lint/issues/24 |
Sanity check Aurelia Bindings
The text was updated successfully, but these errors were encountered: