# func-names

Rule `eslint/func-names`. Require or disallow named `function` expressions

- Source: eslint
- Technologies: JavaScript
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 12.4M weekly downloads of presets that enable it
- Trend: +13.0% last quarter
- Rank: #748 by reach, #1441 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `func-names` | no | no | package `eslint` | [docs](https://eslint.org/docs/latest/rules/func-names) |
| Oxlint | `func-names` | no | safe | plugin `eslint`, category style | [docs](https://oxc.rs/docs/guide/usage/linter/rules/eslint/func-names.html) |
| Biome | `nursery/useNamedFunction` | no | no | group nursery, since 2.6.0 | [docs](https://biomejs.dev/linter/rules/use-named-function/) |

## Code examples

### Incorrect: the rule reports this

```js
Foo.prototype.bar = function() {};

const cat = {
  meow: function() {}
}

(function() {
    // ...
}())

export default function() {}
```

```js
Foo.prototype.bar = function() {};

(function() {
    // ...
}())

export default function() {}
```

```js
Foo.prototype.bar = function bar() {};

(function bar() {
    // ...
}())
```

### Correct: the rule accepts this

```js
Foo.prototype.bar = function bar() {};

const cat = {
  meow() {}
}

(function bar() {
    // ...
}())

export default function foo() {}
```

```js
const bar = function() {};

const cat = {
  meow: function() {}
}

class C {
    #bar = function() {};
    baz = function() {};
}

quux ??= function() {};

(function bar() {
    // ...
}())

export default function foo() {}
```

```js
Foo.prototype.bar = function() {};

(function() {
    // ...
}())
```

Examples from the ESLint documentation.

## Enable it

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

```js
export default [
  {
    rules: {
      "func-names": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "func-names": "error"
  }
}
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "nursery": {
        "useNamedFunction": "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 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% |

## Related rules

- [eslint/prefer-destructuring](https://lintradar.dev/rules/eslint/prefer-destructuring.md): Require destructuring from arrays and/or objects
- [eslint/no-param-reassign](https://lintradar.dev/rules/eslint/no-param-reassign.md): Disallow reassigning function parameters
- [eslint/no-else-return](https://lintradar.dev/rules/eslint/no-else-return.md): Disallow `else` blocks after `return` statements in `if` statements
- [eslint/no-plusplus](https://lintradar.dev/rules/eslint/no-plusplus.md): Disallow the unary operators `++` and `--`
- [eslint/operator-assignment](https://lintradar.dev/rules/eslint/operator-assignment.md): Require or disallow assignment operator shorthand where possible
- [eslint/no-multi-assign](https://lintradar.dev/rules/eslint/no-multi-assign.md): Disallow use of chained assignment expressions

---

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