unicorn/no-unreadable-iife
eslint-plugin-unicorn
Suggestion
eslint.config.js
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/no-unreadable-iife": "error",
},
},
];const foo = (bar => (bar ? bar.baz : baz))(getBar());const foo = ((bar, baz) => ({bar, baz}))(bar, baz);const bar = getBar();
const foo = bar ? bar.baz : baz;const getBaz = bar => (bar ? bar.baz : baz);
const foo = getBaz(getBar());const foo = {bar, baz};Examples from the ESLint documentation.
unicorn/no-unreadable-iife
eslint-plugin-unicorn
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/no-unreadable-iife": "error",
},
},
];unicorn/no-unreadable-iife
unicorn plugin · pedantic
{
"rules": {
"unicorn/no-unreadable-iife": "error"
}
}nursery/noUnreadableIife
nursery · since 2.6.4
{
"linter": {
"rules": {
"nursery": {
"noUnreadableIife": "error"
}
}
}
}Disallow classes that only have static members.
Require consistent decimal numbers without redundant zeros.
Disallow negated expression in equality check.
Prefer negative index over .length - index when possible.
Prefer .querySelector() and .querySelectorAll() over older DOM query methods.