1.0.3 • Published 8 years ago

eslint-plugin-prefer-spread v1.0.3

Weekly downloads
2,144
License
MIT
Repository
github
Last release
8 years ago

eslint-plugin-prefer-spread Build Status

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"]
  }
}