Skip to main content

uppercase-iife

Disallow unreadable immediately invoked arrow function expressions.

Targeted pattern scopeโ€‹

This rule targets immediately invoked arrow function expressions (IIFEs).

What this rule reportsโ€‹

This rule reports IIFEs whose arrow function body is an unnecessary parenthesized expression.

Why this rule existsโ€‹

Extra parentheses in IIFE arrow bodies reduce readability and add noise.

โŒ Incorrectโ€‹

(() => doWork())();

โœ… Correctโ€‹

(() => doWork())();

Behavior and migration notesโ€‹

This rule forwards options and behavior to unicorn/no-unreadable-iife.

Additional examplesโ€‹

const value = (() => compute())();
// โŒ reported by forwarded unicorn rule

const valueFixed = (() => compute())();
// โœ… valid

ESLint flat config exampleโ€‹

import etcMisc from "eslint-plugin-etc-misc";

export default [
{
plugins: { "etc-misc": etcMisc },
rules: {
"etc-misc/uppercase-iife": "error",
},
},
];

When not to use itโ€‹

Disable this rule if your team deliberately keeps this parenthesized IIFE style for historical consistency.

Package documentationโ€‹

Rule catalog ID: R078

Further readingโ€‹

Adoption resourcesโ€‹

  • Start at warning level in CI, then move to error after cleanup.
  • Use focused codemods/autofix batches per package or directory.