# grouped-accessor-pairs

Rule `eslint/grouped-accessor-pairs`. Require grouped accessor pairs in object literals and classes

- Source: eslint
- Technologies: JavaScript
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 12.6M weekly downloads of presets that enable it
- Trend: +13.4% last quarter
- Rank: #737 by reach, #1424 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `grouped-accessor-pairs` | no | no | package `eslint` | [docs](https://eslint.org/docs/latest/rules/grouped-accessor-pairs) |
| Oxlint | `grouped-accessor-pairs` | no | no | plugin `eslint`, category style | [docs](https://oxc.rs/docs/guide/usage/linter/rules/eslint/grouped-accessor-pairs.html) |
| Biome | `style/useGroupedAccessorPairs` | no | no | group style, since 2.0.0 | [docs](https://biomejs.dev/linter/rules/use-grouped-accessor-pairs/) |

## Code examples

### Incorrect: the rule reports this

```js
const foo = {
    get a() {
        return this.val;
    },
    b: 1,
    set a(value) {
        this.val = value;
    }
};

const bar = {
    set b(value) {
        this.val = value;
    },
    a: 1,
    get b() {
        return this.val;
    }
}

class Foo {
    set a(value) {
        this.val = value;
    }
    b(){}
    get a() {
        return this.val;
    }
}

const Bar = class {
    static get a() {
// …
```

### Correct: the rule accepts this

```js
const foo = {
    get a() {
        return this.val;
    },
    set a(value) {
        this.val = value;
    },
    b: 1
};

const bar = {
    set b(value) {
        this.val = value;
    },
    get b() {
        return this.val;
    },
    a: 1
}

class Foo {
    set a(value) {
        this.val = value;
    }
    get a() {
        return this.val;
    }
    b(){}
}

const Bar = class {
    static get a() {
// …
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
export default [
  {
    rules: {
      "grouped-accessor-pairs": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "grouped-accessor-pairs": "error"
  }
}
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "style": {
        "useGroupedAccessorPairs": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Airbnb base](https://lintradar.dev/presets/airbnb-base.md) | ESLint | `eslint-config-airbnb-base` | 241 | 6.5M | +2.1% |
| [Airbnb](https://lintradar.dev/presets/airbnb.md) | ESLint | `eslint-config-airbnb` | 346 | 3.4M | +2.3% |
| [Ultracite for Biome](https://lintradar.dev/presets/ultracite-biome.md) | Biome | `ultracite` | 616 | 2.1M | +151.7% |
| [Ultracite for Oxlint](https://lintradar.dev/presets/ultracite-oxlint.md) | Oxlint | `ultracite` | 475 | 2.1M | +151.7% |
| [XO](https://lintradar.dev/presets/xo.md) | ESLint | `eslint-config-xo` | 618 | 413K | −5.0% |
| [eslint-config-love](https://lintradar.dev/presets/love.md) | ESLint | `eslint-config-love` | 258 | 171.7K | +39.3% |
| [Alloy](https://lintradar.dev/presets/alloy.md) | ESLint | `eslint-config-alloy` | 166 | 31.4K | +32.4% |

## Related rules

- [eslint/vars-on-top](https://lintradar.dev/rules/eslint/vars-on-top.md): Require `var` declarations be placed at the top of their containing scope
- [eslint/prefer-object-spread](https://lintradar.dev/rules/eslint/prefer-object-spread.md): Disallow using `Object.assign` with an object literal as the first argument and prefer the use of object spread instead
- [eslint/no-promise-executor-return](https://lintradar.dev/rules/eslint/no-promise-executor-return.md): Disallow returning values from Promise executor functions
- [eslint/arrow-body-style](https://lintradar.dev/rules/eslint/arrow-body-style.md): Require braces around arrow function bodies
- [eslint/no-await-in-loop](https://lintradar.dev/rules/eslint/no-await-in-loop.md): Disallow `await` inside of loops
- [eslint/no-lonely-if](https://lintradar.dev/rules/eslint/no-lonely-if.md): Disallow `if` statements as the only statement in `else` blocks

---

Web page: https://lintradar.dev/rules/eslint/grouped-accessor-pairs. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
