functional/prefer-tacit

March 2, 2026 ยท View on GitHub

๐Ÿ“ Replaces x => f(x) with just f.

โš ๏ธ This rule warns in the ๐ŸŽจ stylistic config.

๐Ÿ’ก This rule is manually fixable by editor suggestions.

๐Ÿ’ญ This rule requires type information.

This rule enforces using functions directly if they can be without wrapping them.

Rule Details

If a function can be used directly without being in a callback wrapper, then it's generally better to use it directly. Extra inline lambdas can slow the runtime down.

โš ๏ธ Warning โš ๏ธ: Use with caution as if not all parameters should be passed to the function, a wrapper function is then required.

โŒ Incorrect

/* eslint functional/prefer-tacit: "error" */

function f(x) {
  return x + 1;
}

const foo = [1, 2, 3].map((x) => f(x));

โœ… Correct

/* eslint functional/prefer-tacit: "error" */

function f(x) {
  return x + 1;
}

const foo = [1, 2, 3].map(f);

const bar = { f };
const baz = [1, 2, 3].map((x) => bar.f(x)); // Allowed unless using `checkMemberExpressions`

Options

This rule accepts an options object of the following type:

type Options = {
  checkMemberExpressions: boolean;
};

Default Options

type Options = {
  checkMemberExpressions: false;
};

checkMemberExpressions

If true, calls of member expressions are checked as well. If false, only calls of identifiers are checked.

โŒ Incorrect

/* eslint functional/prefer-tacit: ["error", { "checkMemberExpressions": true }] */

const bar = {
  f(x) {
    return x + 1;
  },
};

const foo = [1, 2, 3].map((x) => bar.f(x));

โœ… Correct

/* eslint functional/prefer-tacit: ["error", { "checkMemberExpressions": true }] */

const bar = {
  f(x) {
    return x + 1;
  },
};

const foo = [1, 2, 3].map(bar.f.bind(bar));