{"action":"created","issue":{"url":"https://api.github.com/repos/jshint/jshint/issues/2542","labels_url":"https://api.github.com/repos/jshint/jshint/issues/2542/labels{/name}","comments_url":"https://api.github.com/repos/jshint/jshint/issues/2542/comments","events_url":"https://api.github.com/repos/jshint/jshint/issues/2542/events","html_url":"https://github.com/jshint/jshint/pull/2542","id":94540253,"number":2542,"title":"[[FIX]] Do not allow spread operators where not allowed","user":{"login":"lukeapage","id":309321,"avatar_url":"https://avatars.githubusercontent.com/u/309321?v=3","gravatar_id":"","url":"https://api.github.com/users/lukeapage","html_url":"https://github.com/lukeapage","followers_url":"https://api.github.com/users/lukeapage/followers","following_url":"https://api.github.com/users/lukeapage/following{/other_user}","gists_url":"https://api.github.com/users/lukeapage/gists{/gist_id}","starred_url":"https://api.github.com/users/lukeapage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukeapage/subscriptions","organizations_url":"https://api.github.com/users/lukeapage/orgs","repos_url":"https://api.github.com/users/lukeapage/repos","events_url":"https://api.github.com/users/lukeapage/events{/privacy}","received_events_url":"https://api.github.com/users/lukeapage/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jshint/jshint/labels/Needs%20review","name":"Needs review","color":"fef2c0"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-07-12T06:38:13Z","updated_at":"2015-09-13T07:02:55Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/jshint/jshint/pulls/2542","html_url":"https://github.com/jshint/jshint/pull/2542","diff_url":"https://github.com/jshint/jshint/pull/2542.diff","patch_url":"https://github.com/jshint/jshint/pull/2542.patch"},"body":"Fixes #2525 \r\n\r\nAfter some consideration I mark the token as to whether it can be a spread operator. It seems the closest to what is done elsewhere, the other viable alternative would be making `prefix(\"...\"` into `spreadExpression` and calling that in the 2 places, which optionally allows a spread before the expression (this is close to what identifier does, but in the issue @jugglinmike wasn't so keen).\r\n\r\nI looked at using an expression classifier, but I think that approach involves a substantial change to the way jshint works - as I understand it, all expressions would track their type as they went along and then at the end of the expression the caller would work out whether that type was valid. This is the same approach discussed as an option for #2511 - at the point of the assignop, work out if its a destructure, in all other places if a destructure occurs, after parsing that bit, then show an error.. I think thats a large change because jshint a) it starts taking as down a road that makes the parser *harder* to understand (when the approach is used by v8 for performance reasons) b) jshint tracks state and does asserts as it goes along, it doesn't parse and then afterwards traverse and error - all errors and state changes would have to be put into the expression classifier as it went along."},"comment":{"url":"https://api.github.com/repos/jshint/jshint/issues/comments/139848093","html_url":"https://github.com/jshint/jshint/pull/2542#issuecomment-139848093","issue_url":"https://api.github.com/repos/jshint/jshint/issues/2542","id":139848093,"user":{"login":"lukeapage","id":309321,"avatar_url":"https://avatars.githubusercontent.com/u/309321?v=3","gravatar_id":"","url":"https://api.github.com/users/lukeapage","html_url":"https://github.com/lukeapage","followers_url":"https://api.github.com/users/lukeapage/followers","following_url":"https://api.github.com/users/lukeapage/following{/other_user}","gists_url":"https://api.github.com/users/lukeapage/gists{/gist_id}","starred_url":"https://api.github.com/users/lukeapage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukeapage/subscriptions","organizations_url":"https://api.github.com/users/lukeapage/orgs","repos_url":"https://api.github.com/users/lukeapage/repos","events_url":"https://api.github.com/users/lukeapage/events{/privacy}","received_events_url":"https://api.github.com/users/lukeapage/received_events","type":"User","site_admin":false},"created_at":"2015-09-13T07:02:54Z","updated_at":"2015-09-13T07:02:54Z","body":"Added your commit @jugglinmike and rebased"}}