# prefer-options-parameter

Rule `unicorn/prefer-options-parameter`. Prefer an options object over optional positional parameters.

- Source: unicorn
- Technologies: JavaScript
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 9.9M weekly downloads of presets that enable it
- Trend: +28.3% last quarter
- Rank: #1075 by reach, #1330 by growth

## Linters

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

## Code examples

### Incorrect: the rule reports this

```js
function run(input, verbose = false, options = {}) {}
```

### Correct: the rule accepts this

```js
function run(input, {verbose = false, ...options} = {}) {}
```

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-options-parameter": "error",
    },
  },
];
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Unicorn recommended](https://lintradar.dev/presets/unicorn-recommended.md) | ESLint | `eslint-plugin-unicorn` | 340 | 9.5M | +30.3% |
| [XO](https://lintradar.dev/presets/xo.md) | ESLint | `eslint-config-xo` | 618 | 413K | −5.0% |

## Related rules

- [unicorn/prefer-observer-apis](https://lintradar.dev/rules/unicorn/prefer-observer-apis.md): Prefer observer APIs over resize and scroll listeners with layout reads.
- [unicorn/prefer-private-class-fields](https://lintradar.dev/rules/unicorn/prefer-private-class-fields.md): Prefer private class fields over the underscore-prefix convention.
- [unicorn/prefer-object-destructuring-defaults](https://lintradar.dev/rules/unicorn/prefer-object-destructuring-defaults.md): Prefer object destructuring defaults over default object literals with spread.
- [unicorn/prefer-promise-try](https://lintradar.dev/rules/unicorn/prefer-promise-try.md): Prefer `Promise.try()` over promise-wrapping boilerplate.
- [unicorn/prefer-number-is-safe-integer](https://lintradar.dev/rules/unicorn/prefer-number-is-safe-integer.md): Prefer `Number.isSafeInteger()` over integer checks.
- [unicorn/prefer-regexp-exec](https://lintradar.dev/rules/unicorn/prefer-regexp-exec.md): Prefer `RegExp#exec()` over `String#match()` for non-global regular expressions.

---

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