Skip to content

ntnyq/no-member-accessibility

Disallow usage of typescript member accessibility.

  • 🔧 The --fix option on the command line can automatically fix some of the problems reported by this rule.

📖 Rule Details

This rule reports usage of TypeScript member accessibility.

ts
class Test {
  x: number

  constructor(x: number) {
    this.x = x
  }

  get internalValue() {
    return this.x
  }

  set internalValue(value: number) {
    this.x = value
  }

  square(): number {
    return this.x * this.x
  }

  half(): number {
    return this.x / 2
  }
}
correct
ts
class Test {
  
private
x: number
public
constructor(x: number) {
this.x = x }
protected
get internalValue() {
return this.x }
protected
set internalValue(value: number) {
this.x = value }
public
square(): number {
return this.x * this.x }
private
half(): number {
return this.x / 2 } }
incorrect

🔧 Options

Nothing.

🚀 Version

This rule was introduced in eslint-plugin-ntnyq v0.0.1

🔍 Implementation