Skip to content

Latest commit

 

History

History
36 lines (26 loc) · 795 Bytes

no-unreadable-iife.md

File metadata and controls

36 lines (26 loc) · 795 Bytes

Disallow unreadable IIFEs

💼 This rule is enabled in the ✅ recommended config.

IIFE with parenthesized arrow function body is considered unreadable.

Fail

const foo = (bar => (bar ? bar.baz : baz))(getBar());
const foo = ((bar, baz) => ({bar, baz}))(bar, baz);

Pass

const bar = getBar();
const foo = bar ? bar.baz : baz;
const getBaz = bar => (bar ? bar.baz : baz);
const foo = getBaz(getBar());
const foo = (bar => {
	return bar ? bar.baz : baz;
})(getBar());