Rules
Every rule from ESLint, Oxlint and Biome. Pick a rule to see its example. Reach is the weekly npm downloads of the presets that enable a rule; trend is its change over the last quarter.
Every rule from ESLint, Oxlint and Biome. Pick a rule to see its example. Reach is the weekly npm downloads of the presets that enable a rule; trend is its change over the last quarter.
[1, 2, 3].reduce((arr, num) => arr.concat(num * 2), [] as number[]);
['a', 'b'].reduce(
(accumulator, name) => ({
...accumulator,
[name]: true,
}),
{} as Record<string, boolean>,
);[1, 2, 3].reduce<number[]>((arr, num) => arr.concat(num * 2), []);
['a', 'b'].reduce<Record<string, boolean>>(
(accumulator, name) => ({
...accumulator,
[name]: true,
}),
{},
);Popular · 1 of 28
Enforce using type parameter when calling Array#reduce instead of using a type assertion
[1, 2, 3].reduce((arr, num) => arr.concat(num * 2), [] as number[]);
['a', 'b'].reduce(
(accumulator, name) => ({
...accumulator,
[name]: true,
}),
{} as Record<string, boolean>,
);[1, 2, 3].reduce<number[]>((arr, num) => arr.concat(num * 2), []);
['a', 'b'].reduce<Record<string, boolean>>(
(accumulator, name) => ({
...accumulator,
[name]: true,
}),
{},
);