Skip to content

[Feature Request] - Force output fields to be readonly #515

@pgrm

Description

@pgrm

I'm not sure if this is 100% correct, since I don't recall seeing it anywhere else, but in our Angular project, we are marking all @Output fields readonly because really, there is no need to ever re-assign them.

Unless there are some edge cases, which we aren't aware of right now, it would be great if codelyzer could do the check, if all @Output fields are marked as readonly for us, otherwise we always need to check for it manually in code reviews.

Similarly it could be also checked that @Input is never marked as readonly (I have seen it sometimes in our code base and typescript never complained about it, even though it was definitely wrong and set at a later point).

I've never implemented a tslint rule myself, but if you think this one makes sense and you know of some which I could basically copy/paste with few adjustments, to achieve those checks, I'd be fine with contributing the rule as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions