accessor-pairs
Configuration
rslint.config.ts
Enforce getter and setter pairs in objects and classes.
Rule Details
By default the rule flags setters declared without a matching getter. It can optionally flag getters declared without a matching setter, and also extends to class bodies and TypeScript type-literal / interface members.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Options
All options are boolean with the following defaults:
setWithoutGet(defaulttrue): report setters without a matching getter.getWithoutSet(defaultfalse): report getters without a matching setter.enforceForClassMembers(defaulttrue): apply to class declarations and expressions.enforceForTSTypes(defaultfalse): apply to TypeScript type literals and interfaces.
Original Documentation
- ESLint rule: https://eslint.org/docs/latest/rules/accessor-pairs