Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

member-access rule should trigger with readonly parameter property #3323

Closed
cyrilgandon opened this issue Oct 16, 2017 · 1 comment
Closed

Comments

@cyrilgandon
Copy link
Contributor

cyrilgandon commented Oct 16, 2017

Bug Report

  • TSLint version: 5.7.0
  • TypeScript version: 2.5.3
  • Running TSLint via: VSCode

TypeScript code being linted

class Point {
    constructor(
        readonly x: number,
        readonly y: number
    ) { }
}

with tslint.json configuration:

{
  "rules": {
    "member-access": [true, "check-accessor"]
  }
}

Actual behavior

No Error

Expected behavior

It should trigger the member-access rule:

The class property 'x' must be marked either 'private', 'public', or 'protected' (member-access)

The same code, written differently, triggers the error:

class Point {
    readonly x: number; // <-- Error
    readonly y: number; // <-- Error
    constructor(x: number, y: number) {
        this.x = x;
        this.y = y;
    }
}

Maybe there is a need for a new configuration of this rule, like check-parameter-property, because I'm not sure that it make sense to have it under check-accessor.

@cyrilgandon cyrilgandon changed the title member-access rule should trigger with readonly autoproperty member-access rule should trigger with readonly parameter property Oct 16, 2017
@ajafff
Copy link
Contributor

ajafff commented Oct 18, 2017

Fixed by #3325

@ajafff ajafff closed this as completed Oct 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants