@putout/plugin-remove-useless-array-constructor
v3.0.0
Published
šPutout plugin adds ability to remove useless Array constructor
Maintainers
Readme
@putout/plugin-remove-useless-array-constructor 
TypeScript code must not use the
Array()constructor, with or without new. It has confusing and contradictory usage.
šPutout plugin removes useless Array constructor. It has a different meaning for one, and couple arguments:
const a = new Array(2); // [undefined, undefined]
const b = new Array(2, 3); // [2, 3];Install
npm i @putout/plugin-remove-useless-array-constructor -DRule
{
"rules": {
"remove-useless-array-constructor": "on"
}
}ā Example of incorrect code
const a = Array(1, 2, 3);ā Example of correct code
const a = [1, 2, 3];Comparison
Linter | Rule | Fix
--------|-------|------------|
š Putout| remove-useless-array-constructor| ā
⣠ESLint | no-array-constructor | ā
License
MIT
