wrap-iife
eslint
Safe autofix
eslint.config.js
export default [
{
rules: {
"wrap-iife": "error",
},
},
];This rule is deprecated. Check its documentation for a replacement before enabling it.
var x = function () { return { y: 1 };}(); // unwrapped
var x = (function () { return { y: 1 };})(); // wrapped function expressionvar x = function () { return { y: 1 };}(); // unwrapped
var x = (function () { return { y: 1 };}()); // wrapped call expressionvar x = function () { return { y: 1 };}(); // unwrappedvar x = (function () { return { y: 1 };}()); // wrapped call expressionvar x = (function () { return { y: 1 };})(); // wrapped function expressionvar x = (function () { return { y: 1 };}()); // wrapped call expression
var x = (function () { return { y: 1 };})(); // wrapped function expressionExamples from the ESLint documentation.
wrap-iife
eslint
export default [
{
rules: {
"wrap-iife": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Require var declarations be placed at the top of their containing scope
Require grouped accessor pairs in object literals and classes
Require for-in loops to include an if statement
Disallow using Object.assign with an object literal as the first argument and prefer the use of object spread instead
Disallow returning values from Promise executor functions