Skip to content

Disallow unreadable IIFEs ​

💼 This rule is enabled in the ✅ recommended config.

IIFE with parenthesized arrow function body is considered unreadable.

Fail ​

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

Pass ​

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

Released under the Apache License 2.0.