unicorn/no-array-splice
eslint-plugin-unicorn
Suggestion
eslint.config.js
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/no-array-splice": "error",
},
},
];array.splice(1, 1);let array = items.filter(isActive);
array.splice(1, 1);array = array.toSpliced(1, 1);let array = items.filter(isActive);
array = array.toSpliced(1, 1);const removed = array.splice(1, 1);Examples from the ESLint documentation.
unicorn/no-array-splice
eslint-plugin-unicorn
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/no-array-splice": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Disallow array accumulation with Array#concat() in loops.
Disallow asterisk prefixes and shared indentation in multiline comments.
Enforce replacements for variable, property, and filenames.
Disallow break and optionally continue in nested loops and switches inside loops.
Require or disallow logical assignment operator shorthand
Disallow dynamic object property existence checks.