What do you think about a rule, which checks whether a variable can be made read-only?
Read-Only is a TypeScript 2 Feature. The rule could maybe determined by checking whether a field is assigned only inside the constructor or the field will be initialized at the same place like the declaration.
yeah, this could be pretty cool; it's similar in spirit to the prefer-const rule (https://github.com/palantir/tslint/issues/491)
Perhaps an extension of this would be a functional-programming-only rule that ensures all function inputs are marked with the Readonly<T> annotation
Just found https://www.npmjs.com/package/tslint-immutable - Super!
Scratch that, definitely does not check function inputs. Will put an issue on that project though as it seems more tuned to this type of rule.
It should be configurable for access modifiers. public and protected properties could be assigned outside of the current class context.
Fixed by #2896
Most helpful comment
yeah, this could be pretty cool; it's similar in spirit to the
prefer-construle (https://github.com/palantir/tslint/issues/491)