eslint-plugin-prefer-spread
v1.0.3
Published
Suggest using the spread operator over Object.assign.
Downloads
6,757
Maintainers
Readme
eslint-plugin-prefer-spread
Suggest using the spread operator over Object.assign.
Warns for the following (when the first argument is any object literal):
// copies own enumerable properties
Object.assign({}, foo /* ... */);
_.assign({}, foo /* ... */);
Also warns for the following (with the "includeNearEquivalents"
option):
// copies own and inherited enumerable properties
$.extend({}, foo /* ... */);
_.assignIn({}, foo /* ... */);
_.extend({}, foo /* ... */);
Does not warn:
// deep copy
$.extend(true, {}, foo);
Usage
npm i --save-dev eslint-plugin-prefer-spread
{
"plugins": [
"prefer-spread"
],
"rules": {
"prefer-spread/prefer-object-spread": [2, "includeNearEquivalents"]
}
}