--- source: crates/biome_js_analyze/tests/spec_tests.rs expression: invalid.jsonc --- # Input ```cjs [0, [12]].map(Number).flat(); ``` # Diagnostics ``` invalid.jsonc:1:1 lint/complexity/useFlatMap FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The call chain .map().flat() can be replaced with a single .flatMap() call. > 1 │ [0, [12]].map(Number).flat(); │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ i Safe fix: Replace the chain with .flatMap(). - [0,·[12]].map(Number).flat(); + [0,·[12]].flatMap(Number); ``` # Input ```cjs [0, [12], [[16]]].map(Number).flat(1); ``` # Diagnostics ``` invalid.jsonc:1:1 lint/complexity/useFlatMap FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The call chain .map().flat() can be replaced with a single .flatMap() call. > 1 │ [0, [12], [[16]]].map(Number).flat(1); │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ i Safe fix: Replace the chain with .flatMap(). - [0,·[12],·[[16]]].map(Number).flat(1); + [0,·[12],·[[16]]].flatMap(Number); ``` # Input ```cjs [0, [12], [[16]]].map((element) => {}).flat(1); ``` # Diagnostics ``` invalid.jsonc:1:1 lint/complexity/useFlatMap FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The call chain .map().flat() can be replaced with a single .flatMap() call. > 1 │ [0, [12], [[16]]].map((element) => {}).flat(1); │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ i Safe fix: Replace the chain with .flatMap(). - [0,·[12],·[[16]]].map((element)·=>·{}).flat(1); + [0,·[12],·[[16]]].flatMap((element)·=>·{}); ``` # Input ```cjs [0, [12], [[16]]].map((element, index) => {}).flat(1); ``` # Diagnostics ``` invalid.jsonc:1:1 lint/complexity/useFlatMap FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The call chain .map().flat() can be replaced with a single .flatMap() call. > 1 │ [0, [12], [[16]]].map((element, index) => {}).flat(1); │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ i Safe fix: Replace the chain with .flatMap(). - [0,·[12],·[[16]]].map((element,·index)·=>·{}).flat(1); + [0,·[12],·[[16]]].flatMap((element,·index)·=>·{}); ``` # Input ```cjs [0, [12], [[16]]].map((element, index, array) => {}).flat(1); ``` # Diagnostics ``` invalid.jsonc:1:1 lint/complexity/useFlatMap FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! The call chain .map().flat() can be replaced with a single .flatMap() call. > 1 │ [0, [12], [[16]]].map((element, index, array) => {}).flat(1); │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ i Safe fix: Replace the chain with .flatMap(). - [0,·[12],·[[16]]].map((element,·index,·array)·=>·{}).flat(1); + [0,·[12],·[[16]]].flatMap((element,·index,·array)·=>·{}); ```