{"action":"created","issue":{"url":"https://api.github.com/repos/eslint/eslint/issues/6724","repository_url":"https://api.github.com/repos/eslint/eslint","labels_url":"https://api.github.com/repos/eslint/eslint/issues/6724/labels{/name}","comments_url":"https://api.github.com/repos/eslint/eslint/issues/6724/comments","events_url":"https://api.github.com/repos/eslint/eslint/issues/6724/events","html_url":"https://github.com/eslint/eslint/issues/6724","id":166660067,"number":6724,"title":"Calculate leading/trailing comments","user":{"login":"nzakas","id":38546,"avatar_url":"https://avatars.githubusercontent.com/u/38546?v=3","gravatar_id":"","url":"https://api.github.com/users/nzakas","html_url":"https://github.com/nzakas","followers_url":"https://api.github.com/users/nzakas/followers","following_url":"https://api.github.com/users/nzakas/following{/other_user}","gists_url":"https://api.github.com/users/nzakas/gists{/gist_id}","starred_url":"https://api.github.com/users/nzakas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nzakas/subscriptions","organizations_url":"https://api.github.com/users/nzakas/orgs","repos_url":"https://api.github.com/users/nzakas/repos","events_url":"https://api.github.com/users/nzakas/events{/privacy}","received_events_url":"https://api.github.com/users/nzakas/received_events","type":"User","site_admin":false},"labels":[{"id":131106229,"url":"https://api.github.com/repos/eslint/eslint/labels/accepted","name":"accepted","color":"0052cc","default":false},{"id":185518888,"url":"https://api.github.com/repos/eslint/eslint/labels/breaking","name":"breaking","color":"e11d21","default":false},{"id":82922548,"url":"https://api.github.com/repos/eslint/eslint/labels/core","name":"core","color":"c7def8","default":false},{"id":45711352,"url":"https://api.github.com/repos/eslint/eslint/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"open","locked":false,"assignee":{"login":"nzakas","id":38546,"avatar_url":"https://avatars.githubusercontent.com/u/38546?v=3","gravatar_id":"","url":"https://api.github.com/users/nzakas","html_url":"https://github.com/nzakas","followers_url":"https://api.github.com/users/nzakas/followers","following_url":"https://api.github.com/users/nzakas/following{/other_user}","gists_url":"https://api.github.com/users/nzakas/gists{/gist_id}","starred_url":"https://api.github.com/users/nzakas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nzakas/subscriptions","organizations_url":"https://api.github.com/users/nzakas/orgs","repos_url":"https://api.github.com/users/nzakas/repos","events_url":"https://api.github.com/users/nzakas/events{/privacy}","received_events_url":"https://api.github.com/users/nzakas/received_events","type":"User","site_admin":false},"assignees":[{"login":"nzakas","id":38546,"avatar_url":"https://avatars.githubusercontent.com/u/38546?v=3","gravatar_id":"","url":"https://api.github.com/users/nzakas","html_url":"https://github.com/nzakas","followers_url":"https://api.github.com/users/nzakas/followers","following_url":"https://api.github.com/users/nzakas/following{/other_user}","gists_url":"https://api.github.com/users/nzakas/gists{/gist_id}","starred_url":"https://api.github.com/users/nzakas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nzakas/subscriptions","organizations_url":"https://api.github.com/users/nzakas/orgs","repos_url":"https://api.github.com/users/nzakas/repos","events_url":"https://api.github.com/users/nzakas/events{/privacy}","received_events_url":"https://api.github.com/users/nzakas/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/eslint/eslint/milestones/17","html_url":"https://github.com/eslint/eslint/milestones/v4.0.0","labels_url":"https://api.github.com/repos/eslint/eslint/milestones/17/labels","id":1952093,"number":17,"title":"v4.0.0","description":"","creator":{"login":"nzakas","id":38546,"avatar_url":"https://avatars.githubusercontent.com/u/38546?v=3","gravatar_id":"","url":"https://api.github.com/users/nzakas","html_url":"https://github.com/nzakas","followers_url":"https://api.github.com/users/nzakas/followers","following_url":"https://api.github.com/users/nzakas/following{/other_user}","gists_url":"https://api.github.com/users/nzakas/gists{/gist_id}","starred_url":"https://api.github.com/users/nzakas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nzakas/subscriptions","organizations_url":"https://api.github.com/users/nzakas/orgs","repos_url":"https://api.github.com/users/nzakas/repos","events_url":"https://api.github.com/users/nzakas/events{/privacy}","received_events_url":"https://api.github.com/users/nzakas/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":0,"state":"open","created_at":"2016-08-19T18:22:54Z","updated_at":"2016-10-19T20:25:40Z","due_on":null,"closed_at":null},"comments":47,"created_at":"2016-07-20T19:18:05Z","updated_at":"2016-10-29T21:36:24Z","closed_at":null,"body":"**Problem**\r\n\r\nRight now, leading and trailing comments are calculated in Espree and passed to ESLint. ESLint depends on these comments from things like configuration and determining if someone has opted-out of a rule (such as providing a comment in an empty block). That works well when using Espree, but if you're using a different parser, it forces that parser to reimplement the same comment attachment strategy as Espree, which is a lot of work and not very easy. Case in point, we're working on `typescript-eslint-parser` and are a bit stuck on getting the same leading/trailing comment information from Espree.\r\n\r\n**Solution**\r\n\r\nIf we didn't require parsers to provide leading/trailing comments, and instead calculated them inside of ESLint, we dramatically decrease the complexity of creating ESLint-compatible parsers. We could just require parsers to pass in the `comments` array, and we could figure out where the comments belong on-demand when a rule calls `context.getComments()`. This is probably a bit tricky, as we'd want to ensure we get the same results that Espree gives us right now, but ultimately, I think this would help the parser ecosystem tremendously and, as a side benefit, normalize ESLint behavior across parsers."},"comment":{"url":"https://api.github.com/repos/eslint/eslint/issues/comments/257117420","html_url":"https://github.com/eslint/eslint/issues/6724#issuecomment-257117420","issue_url":"https://api.github.com/repos/eslint/eslint/issues/6724","id":257117420,"user":{"login":"nzakas","id":38546,"avatar_url":"https://avatars.githubusercontent.com/u/38546?v=3","gravatar_id":"","url":"https://api.github.com/users/nzakas","html_url":"https://github.com/nzakas","followers_url":"https://api.github.com/users/nzakas/followers","following_url":"https://api.github.com/users/nzakas/following{/other_user}","gists_url":"https://api.github.com/users/nzakas/gists{/gist_id}","starred_url":"https://api.github.com/users/nzakas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nzakas/subscriptions","organizations_url":"https://api.github.com/users/nzakas/orgs","repos_url":"https://api.github.com/users/nzakas/repos","events_url":"https://api.github.com/users/nzakas/events{/privacy}","received_events_url":"https://api.github.com/users/nzakas/received_events","type":"User","site_admin":false},"created_at":"2016-10-29T21:36:24Z","updated_at":"2016-10-29T21:36:24Z","body":"@kaicataldo thanks for the update. Did you and @mikesherov talk about how JSCS handled comments and if it could make sense for us to just not traverse into comments and rely on `getCommentBefore()` in rules instead?"}}
{"actor":{"display_login":"nzakas"}}