{"action":"created","issue":{"url":"https://api.github.com/repos/airbnb/javascript/issues/543","labels_url":"https://api.github.com/repos/airbnb/javascript/issues/543/labels{/name}","comments_url":"https://api.github.com/repos/airbnb/javascript/issues/543/comments","events_url":"https://api.github.com/repos/airbnb/javascript/issues/543/events","html_url":"https://github.com/airbnb/javascript/issues/543","id":111236144,"number":543,"title":"Unused local variable in react render","user":{"login":"ggarek","id":5501062,"avatar_url":"https://avatars.githubusercontent.com/u/5501062?v=3","gravatar_id":"","url":"https://api.github.com/users/ggarek","html_url":"https://github.com/ggarek","followers_url":"https://api.github.com/users/ggarek/followers","following_url":"https://api.github.com/users/ggarek/following{/other_user}","gists_url":"https://api.github.com/users/ggarek/gists{/gist_id}","starred_url":"https://api.github.com/users/ggarek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ggarek/subscriptions","organizations_url":"https://api.github.com/users/ggarek/orgs","repos_url":"https://api.github.com/users/ggarek/repos","events_url":"https://api.github.com/users/ggarek/events{/privacy}","received_events_url":"https://api.github.com/users/ggarek/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-10-13T18:06:05Z","updated_at":"2015-10-14T06:34:33Z","closed_at":"2015-10-13T20:54:33Z","body":"Hello, recently i found a use case when unused local variable could be allowed.\r\n\r\nThe use case:\r\nI need to omit some own props in React component render method, because i want to pass the rest of the props to other component (e.g. own child).\r\nThe *prop1, prop2, prop3 are used* in components handlers and thus they are not used in render.\r\nI want to leverage es6 destructuring assignment to omit some keys and get the rest props packed in a newly created object. Thus the omited props appear as unused local variables. This makes ESLint sad.\r\n\r\nI could use something like `_.omit(this.props, [ 'prop1', 'prop2', 'prop3' ])`, but why not use the almost native es6 ability? \r\nThe other option would be to allow unused variables in React component render method if the destructuring assignment contains `...rest`.\r\n\r\nHere is a code sampe:\r\n\r\n```\r\nrender() {\r\n    const {\r\n      prop1,\r\n      prop2,\r\n      prop3,\r\n      ...restProps\r\n      } = this.props;\r\n\r\n    return (\r\n      <OneComponent>\r\n        <OtherComponent {...restProps}/>\r\n      </OneComponent>\r\n    );\r\n  }\r\n```\r\n\r\nWhat could you suggest regarding the use case?"},"comment":{"url":"https://api.github.com/repos/airbnb/javascript/issues/comments/147951469","html_url":"https://github.com/airbnb/javascript/issues/543#issuecomment-147951469","issue_url":"https://api.github.com/repos/airbnb/javascript/issues/543","id":147951469,"user":{"login":"ggarek","id":5501062,"avatar_url":"https://avatars.githubusercontent.com/u/5501062?v=3","gravatar_id":"","url":"https://api.github.com/users/ggarek","html_url":"https://github.com/ggarek","followers_url":"https://api.github.com/users/ggarek/followers","following_url":"https://api.github.com/users/ggarek/following{/other_user}","gists_url":"https://api.github.com/users/ggarek/gists{/gist_id}","starred_url":"https://api.github.com/users/ggarek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ggarek/subscriptions","organizations_url":"https://api.github.com/users/ggarek/orgs","repos_url":"https://api.github.com/users/ggarek/repos","events_url":"https://api.github.com/users/ggarek/events{/privacy}","received_events_url":"https://api.github.com/users/ggarek/received_events","type":"User","site_admin":false},"created_at":"2015-10-14T06:34:33Z","updated_at":"2015-10-14T06:34:33Z","body":"Thanks for the explanation. This makes sense. :+1: \r\n\r\n[There is no rest element in an object assignment pattern in ecma-262 indeed.](http://www.ecma-international.org/ecma-262/6.0/#sec-destructuring-assignment)"}}