# prefer-array-some

Rule `unicorn/prefer-array-some`. Prefer `.some(…)` over `.filter(…).length` check and `.{find,findLast,findIndex,findLastIndex}(…)`.

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

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `unicorn/prefer-array-some` | no | safe | package `eslint-plugin-unicorn` | [docs](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v80.0.0/docs/rules/prefer-array-some.md) |
| Oxlint | `unicorn/prefer-array-some` | no | safe | plugin `unicorn`, category pedantic | [docs](https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-array-some.html) |
| Biome | `complexity/useArraySome` | no | unsafe | group complexity, since 2.4.5 | [docs](https://biomejs.dev/linter/rules/use-array-some/) |

## Code examples

### Incorrect: the rule reports this

```js
const hasUnicorn = array.filter(element => isUnicorn(element)).length > 0;
```

```js
const hasUnicorn = array.filter(element => isUnicorn(element)).length !== 0;
```

```js
const hasUnicorn = array.find(element => isUnicorn(element)) !== undefined;
```

### Correct: the rule accepts this

```js
const hasUnicorn = array.some(element => isUnicorn(element));
```

```js
if (array.some(element => isUnicorn(element))) {
  // …
}
```

```js
const found = array.some(item => item > 2);
Boolean(found);
```

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

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "unicorn/prefer-array-some": "error"
  }
}
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "complexity": {
        "useArraySome": "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% |
| [Unicorn unopinionated](https://lintradar.dev/presets/unicorn-unopinionated.md) | ESLint | `eslint-plugin-unicorn` | 236 | 9.5M | +30.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% |

## Related rules

- [unicorn/numeric-separators-style](https://lintradar.dev/rules/unicorn/numeric-separators-style.md): Enforce the style of numeric separators by correctly grouping digits.
- [unicorn/prefer-at](https://lintradar.dev/rules/unicorn/prefer-at.md): Prefer `.at()` method for index access and `String#charAt()`.
- [unicorn/no-lonely-if](https://lintradar.dev/rules/unicorn/no-lonely-if.md): Disallow `if` statements as the only statement in `if` blocks without `else`.
- [unicorn/prefer-module](https://lintradar.dev/rules/unicorn/prefer-module.md): Prefer JavaScript modules (ESM) over CommonJS.
- [unicorn/prefer-regexp-test](https://lintradar.dev/rules/unicorn/prefer-regexp-test.md): Prefer `RegExp#test()` over `String#match()`, `String#search()`, and `RegExp#exec()`.
- [unicorn/prefer-string-slice](https://lintradar.dev/rules/unicorn/prefer-string-slice.md): Prefer `String#slice()` over `String#substr()` and `String#substring()`.

---

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