Skip to content

linter: unicorn/no-array-callback-reference and unicorn/no-array-for-each false positives on Effect library methods #18876

@eyenalxai

Description

@eyenalxai

Oxlint's unicorn rules incorrectly flag Effect library methods that share names with array methods, even though they operate on completely different types.

import { Effect, Console, Option } from "effect";

// eslint-plugin-unicorn(no-array-for-each): Do not use `Array#forEach`
const _result = Effect.forEach([1, 2, 3, 4, 5], (n, index) =>
  Console.log(`Currently at index ${index}`).pipe(Effect.as(n * 2)),
);

const oof = "s";

// eslint-plugin-unicorn(no-array-callback-reference): Avoid passing a function reference directly to iterator methods
const _someOof = Option.some(oof);

Playground

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Priority

    None yet

    Effort

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions