You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.
I think I am going to close this issue with 2 comments:
The point of the no-backbone-get-set-outside-model rule is to make sure that you don't invoke dynamically dispatched methods that the compiler cannot enforce correctness on. For example, the compiler will not complain if you type route.params.get('id'), route.params.get('ID'), route.params.get('Id') but only one of those invocations will actually work at runtime. The design advice is to define a statically typed "getId(): number" method on the RouteParams object so the compiler can enforce these calls. So, in my opinion the rule actually has found an issue in your code that you should fix (but see my second point :) )
The static type analyzer in tslint does not work, so it is impossible for a tslint to know if this.routeParams is a Backbone Model or if it is some Angular object. It tells us 'any' 99% of the time. This makes it impossible to know the type of routeParams, so we assume that any method that looks like a Backbone get is a Backbone get. tslint will fix this issue with this bug, but it is an architectural issue on their side: Lint Programs as a Whole palantir/tslint#680
How do you feel about this response? Do you think it is fair for me to close this item?
Using
RouteParams
from Angular2 will cause a false positive:The:
routeParams.get('id')
part will flag the rule: no-backbone-get-set-outside-modelThe text was updated successfully, but these errors were encountered: