no-unreadable-iife

March 27, 2026 ยท View on GitHub

๐Ÿ“ Disallow unreadable IIFEs.

๐Ÿ’ผ This rule is enabled in the following configs: โœ… recommended, โ˜‘๏ธ unopinionated.

IIFE with parenthesized arrow function body is considered unreadable.

Examples

// โŒ
const foo = (bar => (bar ? bar.baz : baz))(getBar());

// โœ…
const bar = getBar();
const foo = bar ? bar.baz : baz;

// โœ…
const getBaz = bar => (bar ? bar.baz : baz);
const foo = getBaz(getBar());
// โŒ
const foo = ((bar, baz) => ({bar, baz}))(bar, baz);
// โœ…
const foo = (bar => {
	return bar ? bar.baz : baz;
})(getBar());