# prefer-short-arrow-method

Rule `unicorn/prefer-short-arrow-method`. Prefer arrow function properties over methods with a single return.

- Source: unicorn
- Technologies: JavaScript
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 0 weekly downloads of presets that enable it
- Trend: 0% last quarter
- Rank: #2037 by reach

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `unicorn/prefer-short-arrow-method` | no | safe | package `eslint-plugin-unicorn` | [docs](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v80.0.0/docs/rules/prefer-short-arrow-method.md) |

## Code examples

### Incorrect: the rule reports this

```js
const api = {
  getUrl() {
    return 'https://api.example.com';
  },
};
```

```js
const calculator = {
  add(a, b) {
    return a + b;
  },
};
```

```js
const asyncApi = {
  async fetchData(url) {
    return fetch(url);
  },
};
```

### Correct: the rule accepts this

```js
const api = {
  getUrl: () => 'https://api.example.com',
};
```

```js
const calculator = {
  add: (a, b) => a + b,
};
```

```js
const asyncApi = {
  fetchData: async (url) => fetch(url),
};
```

Examples from the ESLint documentation.

## Enable it

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

```js
import unicorn from "eslint-plugin-unicorn";

export default [
  {
    plugins: { unicorn },
    rules: {
      "unicorn/prefer-short-arrow-method": "error",
    },
  },
];
```

## Related rules

- [unicorn/prefer-regexp-escape](https://lintradar.dev/rules/unicorn/prefer-regexp-escape.md): Prefer `RegExp.escape()` for escaping strings to use in regular expressions.
- [unicorn/prefer-temporal](https://lintradar.dev/rules/unicorn/prefer-temporal.md): Prefer `Temporal` over `Date`.
- [unicorn/prefer-uint8array-base64](https://lintradar.dev/rules/unicorn/prefer-uint8array-base64.md): Prefer `Uint8Array#toBase64()` and `Uint8Array.fromBase64()` over legacy base64 conversions and manual postprocessing.
- [unicorn/prefer-uint8array-hex](https://lintradar.dev/rules/unicorn/prefer-uint8array-hex.md): Prefer `Uint8Array#toHex()` and `Uint8Array.fromHex()` over manual and Buffer hex conversions.
- [unicorn/prefer-json-import](https://lintradar.dev/rules/unicorn/prefer-json-import.md): Prefer JSON imports over reading and parsing JSON files.
- [unicorn/prefer-iterator-concat](https://lintradar.dev/rules/unicorn/prefer-iterator-concat.md): Prefer `Iterator.concat(…)` over temporary spread arrays.

---

Web page: https://lintradar.dev/rules/unicorn/prefer-short-arrow-method. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
