Skip to content

Rule Change: accessor-pairs and grouped-accessor-pairs should support types #19860

@DMartens

Description

@DMartens

What rule do you want to change?

accessor-pairs and grouped-accessor-pairs

What change do you want to make?

Generate more warnings

How do you think the change should be implemented?

A new option

Example code

// accessor-pairs
interface I {
  get prop(): any
}

// grouped-accessor-pairs
interface I {
  get prop(): any
  propInBetween: true
  set prop(value: any): any
}

What does the rule currently do for this code?

Nothing as only object properties and class members are linted.

What will the rule do after it's changed?

Also check accessors in types (TSTypeLiteral and TSInterfaceDeclaration) if enabled by an option (similar to enforceForClassMembers).

Participation

  • I am willing to submit a pull request to implement this change.

Additional comments

As more core rules are now TypeScript-aware, I hope these changes are welcome as typescript-eslint does not offer extension rules for the accessor rules.

Metadata

Metadata

Assignees

Labels

acceptedThere is consensus among the team that this change meets the criteria for inclusionenhancementThis change enhances an existing feature of ESLintruleRelates to ESLint's core rules

Type

No type

Projects

Status

Complete

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions