---
title: "unicorn/no-unnecessary-array-flat-depth"
description: "Disallow passing `1` as the depth to `Array#flat()`"
# Generated by src/codegen/lint-rule-docs.ts. Do not edit below this line.
plugin: "unicorn"
aliases: []
kind: "suggestion"
category: "pedantic"
default: "off"
fixable: "suggestion"
typeAware: false
deprecated: false
---

`flat()` flattens one level by default, so the `1` in `flat(1)` does nothing.

`--fix-suggestions` removes the argument.

{/* Generated by src/codegen/lint-rule-docs.ts. Do not edit this section. */}

## Configure

Off by default. To turn it on:

```toml bunfig.toml
[lint.rules]
"unicorn/no-unnecessary-array-flat-depth" = "error" # or "warn"
```

{/* End of the generated section. */}

## Examples

Reported:

{/* bad */}
```js
const tags = posts.map(post => post.tags).flat(1);
```

Not reported:

{/* good */}
```js
const tags = posts.map(post => post.tags).flat();

const leaves = tree.flat(2);
const everything = tree.flat(Infinity);
```
