MarsBased / marstyle

MarsBased code linter rules for Ruby and Typescript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Typescript/no-parameter-properties

davidgg opened this issue · comments

Rule definition: https://palantir.github.io/tslint/rules/no-parameter-properties/

Parameter properties allow the declaration of class properties using only the constructor with the member access (public, private, protected) , for example:

class Person {
    constructor(private firstName: string, private lastName: string) {
    }
}

is equivalent to:

class Person {
    private firstName: string;
    private lastName: string;
    
    constructor(firstName: string, lastName: string) {
        this.firstName = firstName;
        this.lastName = lastName;
    }
}

I prefer the first one since is shorter, I vote for disable this rule.

This rule will be discussed this week in the ruby-tapas.

We want to allow it.