unicorn/no-array-for-each
unicorn plugin · restriction
No autofix
.oxlintrc.json
{
"rules": {
"unicorn/no-array-for-each": "error"
}
}const foo = [1, 2, 3];
foo.forEach((element) => { /* ... */ });const foo = [1, 2, 3];
for (const element of foo) { /* ... */ }
for (const [index, element] of foo.entries()) { /* ... */ }Examples from the Oxlint documentation.
ESLint does not have this rule.
unicorn/no-array-for-each
unicorn plugin · restriction
{
"rules": {
"unicorn/no-array-for-each": "error"
}
}complexity/noForEach
complexity · since 1.0.0
{
"linter": {
"rules": {
"complexity": {
"noForEach": "error"
}
}
}
}Enforce correct Error subclassing.
Prefer import.meta.{dirname,filename} over legacy techniques for getting file paths.
Enforce using the targetOrigin argument with window.postMessage().
Disallow invalid accept values on file inputs.