# consistent-function-style

Rule `unicorn/consistent-function-style`. Enforce function syntax by role.

- 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: #2003 by reach

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `unicorn/consistent-function-style` | no | suggestion | package `eslint-plugin-unicorn` | [docs](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v80.0.0/docs/rules/consistent-function-style.md) |

## Code examples

### Incorrect: the rule reports this

```js
const parse = value => value;
```

```js
function parse(value) {
  return JSON.parse(value);
}
```

### Correct: the rule accepts this

```js
function parse(value) {
  return value;
}
```

```js
let transform = value => value;

if (debug) {
  transform = wrap(transform);
}
```

```js
items.map(item => item.id);
```

Examples from the ESLint documentation.

## Enable it

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

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

export default [
  {
    plugins: { unicorn },
    rules: {
      "unicorn/consistent-function-style": "error",
    },
  },
];
```

## Related rules

- [unicorn/consistent-destructuring](https://lintradar.dev/rules/unicorn/consistent-destructuring.md): Use destructured variables over properties.
- [unicorn/id-match](https://lintradar.dev/rules/unicorn/id-match.md): Require identifiers to match a specified regular expression.
- [unicorn/consistent-arrow-return-style](https://lintradar.dev/rules/unicorn/consistent-arrow-return-style.md): Enforce a consistent return style for multiline arrow function bodies.
- [unicorn/indent](https://lintradar.dev/rules/unicorn/indent.md): Enforce consistent indentation in JSON and CSS.
- [unicorn/comment-content](https://lintradar.dev/rules/unicorn/comment-content.md): Enforce better comment content.
- [unicorn/iteration-fallback-style](https://lintradar.dev/rules/unicorn/iteration-fallback-style.md): Enforce a consistent style for optional loop sources.

---

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