{"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":[{"url":"https://api.github.com/repos/eslint/eslint/labels/accepted","name":"accepted","color":"0052cc"},{"url":"https://api.github.com/repos/eslint/eslint/labels/breaking","name":"breaking","color":"e11d21"},{"url":"https://api.github.com/repos/eslint/eslint/labels/core","name":"core","color":"c7def8"},{"url":"https://api.github.com/repos/eslint/eslint/labels/enhancement","name":"enhancement","color":"84b6eb"}],"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":3,"closed_issues":0,"state":"open","created_at":"2016-08-19T18:22:54Z","updated_at":"2016-08-19T18:23:42Z","due_on":null,"closed_at":null},"comments":17,"created_at":"2016-07-20T19:18:05Z","updated_at":"2016-09-06T18:16:49Z","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/245040597","html_url":"https://github.com/eslint/eslint/issues/6724#issuecomment-245040597","issue_url":"https://api.github.com/repos/eslint/eslint/issues/6724","id":245040597,"user":{"login":"kaicataldo","id":7041728,"avatar_url":"https://avatars.githubusercontent.com/u/7041728?v=3","gravatar_id":"","url":"https://api.github.com/users/kaicataldo","html_url":"https://github.com/kaicataldo","followers_url":"https://api.github.com/users/kaicataldo/followers","following_url":"https://api.github.com/users/kaicataldo/following{/other_user}","gists_url":"https://api.github.com/users/kaicataldo/gists{/gist_id}","starred_url":"https://api.github.com/users/kaicataldo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaicataldo/subscriptions","organizations_url":"https://api.github.com/users/kaicataldo/orgs","repos_url":"https://api.github.com/users/kaicataldo/repos","events_url":"https://api.github.com/users/kaicataldo/events{/privacy}","received_events_url":"https://api.github.com/users/kaicataldo/received_events","type":"User","site_admin":false},"created_at":"2016-09-06T18:16:49Z","updated_at":"2016-09-06T18:16:49Z","body":"@nzakas @JamesHenry Sounds like an interesting challenge! Happy to help in any way I can (whether it's working on it myself or collaborating/discussing with @JamesHenry). I've worked on comment attachment in Espree - so have some working knowledge in that area - but I'm not an expert by any means :)"}}
{"actor":{"display_login":"kaicataldo"}}