Skip to content

Latest commit

Β 

History

History
37 lines (27 loc) Β· 871 Bytes

File metadata and controls

37 lines (27 loc) Β· 871 Bytes

no-unreadable-iife

πŸ“ 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());