{"action":"created","issue":{"url":"https://api.github.com/repos/eslint/eslint/issues/7230","repository_url":"https://api.github.com/repos/eslint/eslint","labels_url":"https://api.github.com/repos/eslint/eslint/issues/7230/labels{/name}","comments_url":"https://api.github.com/repos/eslint/eslint/issues/7230/comments","events_url":"https://api.github.com/repos/eslint/eslint/issues/7230/events","html_url":"https://github.com/eslint/eslint/issues/7230","id":179051308,"number":7230,"title":"Rule request: `prefer-object-spread`","user":{"login":"ljharb","id":45469,"avatar_url":"https://avatars1.githubusercontent.com/u/45469?v=4","gravatar_id":"","url":"https://api.github.com/users/ljharb","html_url":"https://github.com/ljharb","followers_url":"https://api.github.com/users/ljharb/followers","following_url":"https://api.github.com/users/ljharb/following{/other_user}","gists_url":"https://api.github.com/users/ljharb/gists{/gist_id}","starred_url":"https://api.github.com/users/ljharb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ljharb/subscriptions","organizations_url":"https://api.github.com/users/ljharb/orgs","repos_url":"https://api.github.com/users/ljharb/repos","events_url":"https://api.github.com/users/ljharb/events{/privacy}","received_events_url":"https://api.github.com/users/ljharb/received_events","type":"User","site_admin":false},"labels":[{"id":255319420,"url":"https://api.github.com/repos/eslint/eslint/labels/evaluating","name":"evaluating","color":"fef2c0","default":false},{"id":253473350,"url":"https://api.github.com/repos/eslint/eslint/labels/feature","name":"feature","color":"bfd4f2","default":false},{"id":45798639,"url":"https://api.github.com/repos/eslint/eslint/labels/rule","name":"rule","color":"fbca04","default":false}],"state":"open","locked":false,"assignee":{"login":"mysticatea","id":1937871,"avatar_url":"https://avatars2.githubusercontent.com/u/1937871?v=4","gravatar_id":"","url":"https://api.github.com/users/mysticatea","html_url":"https://github.com/mysticatea","followers_url":"https://api.github.com/users/mysticatea/followers","following_url":"https://api.github.com/users/mysticatea/following{/other_user}","gists_url":"https://api.github.com/users/mysticatea/gists{/gist_id}","starred_url":"https://api.github.com/users/mysticatea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mysticatea/subscriptions","organizations_url":"https://api.github.com/users/mysticatea/orgs","repos_url":"https://api.github.com/users/mysticatea/repos","events_url":"https://api.github.com/users/mysticatea/events{/privacy}","received_events_url":"https://api.github.com/users/mysticatea/received_events","type":"User","site_admin":false},"assignees":[{"login":"mysticatea","id":1937871,"avatar_url":"https://avatars2.githubusercontent.com/u/1937871?v=4","gravatar_id":"","url":"https://api.github.com/users/mysticatea","html_url":"https://github.com/mysticatea","followers_url":"https://api.github.com/users/mysticatea/followers","following_url":"https://api.github.com/users/mysticatea/following{/other_user}","gists_url":"https://api.github.com/users/mysticatea/gists{/gist_id}","starred_url":"https://api.github.com/users/mysticatea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mysticatea/subscriptions","organizations_url":"https://api.github.com/users/mysticatea/orgs","repos_url":"https://api.github.com/users/mysticatea/repos","events_url":"https://api.github.com/users/mysticatea/events{/privacy}","received_events_url":"https://api.github.com/users/mysticatea/received_events","type":"User","site_admin":false}],"milestone":null,"comments":25,"created_at":"2016-09-24T20:53:56Z","updated_at":"2018-02-05T20:11:26Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"**Please describe what the rule should do:**\nWhen it finds an `Object.assign` call where the first argument is an object literal, the rule should error, and recommend using the object spread operator instead.\n\n**What category of rule is this? (place an \"X\" next to just one item)**\n\n[ ] Enforces code style\n[ ] Warns about a potential error\n[x] Suggests an alternate way of doing something\n[ ] Other (please specify:)\n\n**Provide 2-3 code examples that this rule will warn about:**\n\n``` js\nreturn Object.assign({}, foo, { bar: baz }, quux); // should be `return { ...foo, bar: baz, ...quux };`\nreturn Object.assign({ foo }, bar, { baz }); // should be `return { foo, ...bar, baz };`\n\nreturn Object.assign(foo, bar, { baz }); // should not warn\n```\n\n**Why should this rule be included in ESLint (instead of a plugin)?**\nJust like http://eslint.org/docs/rules/prefer-spread, this recommends that users use a syntax feature (an operator) instead of API (Object.assign) for the cases where it makes sense. Both are core language features, and eslint core should be where core language feature rules live.\n"},"comment":{"url":"https://api.github.com/repos/eslint/eslint/issues/comments/363206637","html_url":"https://github.com/eslint/eslint/issues/7230#issuecomment-363206637","issue_url":"https://api.github.com/repos/eslint/eslint/issues/7230","id":363206637,"user":{"login":"ljharb","id":45469,"avatar_url":"https://avatars1.githubusercontent.com/u/45469?v=4","gravatar_id":"","url":"https://api.github.com/users/ljharb","html_url":"https://github.com/ljharb","followers_url":"https://api.github.com/users/ljharb/followers","following_url":"https://api.github.com/users/ljharb/following{/other_user}","gists_url":"https://api.github.com/users/ljharb/gists{/gist_id}","starred_url":"https://api.github.com/users/ljharb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ljharb/subscriptions","organizations_url":"https://api.github.com/users/ljharb/orgs","repos_url":"https://api.github.com/users/ljharb/repos","events_url":"https://api.github.com/users/ljharb/events{/privacy}","received_events_url":"https://api.github.com/users/ljharb/received_events","type":"User","site_admin":false},"created_at":"2018-02-05T20:11:26Z","updated_at":"2018-02-05T20:11:26Z","author_association":"CONTRIBUTOR","body":"@mysticatea we already have an implementation of this rule internally at @airbnb, mind if we submit a PR?"}}
{"actor":{"display_login":"ljharb"}}