{"action":"created","comment":{"url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/pulls/comments/329073293","pull_request_review_id":294327137,"id":329073293,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDMyOTA3MzI5Mw==","diff_hunk":"@@ -1,24 +1,46 @@\n # Require a consistent member declaration order (member-ordering)\n \n-A consistent ordering of fields, methods and constructors can make interfaces, type literals, classes and class\n-expressions easier to read, navigate and edit.\n+A consistent ordering of fields, methods and constructors can make interfaces, type literals, classes and class expressions easier to read, navigate and edit.\n \n ## Rule Details\n \n-This rule aims to standardize the way class declarations, class expressions, interfaces and type literals are structured.\n+This rule aims to standardize the way class declarations, class expressions, interfaces and type literals are structured and ordered.\n \n-It allows to group members by their type (e.g. `public-static-field`, `protected-static-field`, `private-static-field`, `public-instance-field`, ...). By default, their order is the same inside `classes`, `classExpressions`, `interfaces` and `typeLiterals` (note: not all member types apply to `interfaces` and `typeLiterals`). It is possible to define the order for any of those individually or to change the default order for all of them by setting the `default` option.\n+### Grouping and sorting member groups\n+\n+It allows to group members by their type (e.g. `public-static-field`, `protected-static-field`, `private-static-field`, `public-instance-field`, ...) and enforce a certain order for these groups. By default, their order is the same inside `classes`, `classExpressions`, `interfaces` and `typeLiterals` (note: not all member types apply to `interfaces` and `typeLiterals`). It is possible to define the order for any of those individually or to change the default order for all of them by setting the `default` option.\n+\n+### Sorting members\n+\n+Besides grouping the members and sorting their groups, this rule also allows to sort the members themselves. You have 2 options: Sort all of them while ignoring their type or sort them inside of the member types (e.g. sort all fields in an interface alphabetically).\n \n ## Options\n \n+These options allow to specify how to group the members and sort their groups.\n+\n ```ts\n {\n-  default?: Array<MemberType> | never\n-  classes?: Array<MemberType> | never\n-  classExpressions?: Array<MemberType> | never\n+  default?: Array<MemberType> | 'never'","path":"packages/eslint-plugin/docs/rules/member-ordering.md","position":30,"original_position":30,"commit_id":"84a20ca827a47714edb10b80a301dcc081906f91","original_commit_id":"0ac39b4b17a59e0e121b749be2e8cd3d5d8e0ac6","user":{"login":"timkraut","id":509669,"node_id":"MDQ6VXNlcjUwOTY2OQ==","avatar_url":"https://avatars2.githubusercontent.com/u/509669?v=4","gravatar_id":"","url":"https://api.github.com/users/timkraut","html_url":"https://github.com/timkraut","followers_url":"https://api.github.com/users/timkraut/followers","following_url":"https://api.github.com/users/timkraut/following{/other_user}","gists_url":"https://api.github.com/users/timkraut/gists{/gist_id}","starred_url":"https://api.github.com/users/timkraut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timkraut/subscriptions","organizations_url":"https://api.github.com/users/timkraut/orgs","repos_url":"https://api.github.com/users/timkraut/repos","events_url":"https://api.github.com/users/timkraut/events{/privacy}","received_events_url":"https://api.github.com/users/timkraut/received_events","type":"User","site_admin":false},"body":"Hm... this is an interesting approach. I'm not sure if the documentation should diverge from the implementation. Maybe we deprecate the \"old\" syntax and remove it on the next major update?","created_at":"2019-09-27T13:32:47Z","updated_at":"2019-09-27T13:32:47Z","html_url":"https://github.com/typescript-eslint/typescript-eslint/pull/263#discussion_r329073293","pull_request_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/pulls/263","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/typescript-eslint/typescript-eslint/pulls/comments/329073293"},"html":{"href":"https://github.com/typescript-eslint/typescript-eslint/pull/263#discussion_r329073293"},"pull_request":{"href":"https://api.github.com/repos/typescript-eslint/typescript-eslint/pulls/263"}},"in_reply_to_id":327707947},"pull_request":{"url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/pulls/263","id":252391559,"node_id":"MDExOlB1bGxSZXF1ZXN0MjUyMzkxNTU5","html_url":"https://github.com/typescript-eslint/typescript-eslint/pull/263","diff_url":"https://github.com/typescript-eslint/typescript-eslint/pull/263.diff","patch_url":"https://github.com/typescript-eslint/typescript-eslint/pull/263.patch","issue_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/issues/263","number":263,"state":"open","locked":false,"title":"feat(eslint-plugin): sort members alphabetically","user":{"login":"timkraut","id":509669,"node_id":"MDQ6VXNlcjUwOTY2OQ==","avatar_url":"https://avatars2.githubusercontent.com/u/509669?v=4","gravatar_id":"","url":"https://api.github.com/users/timkraut","html_url":"https://github.com/timkraut","followers_url":"https://api.github.com/users/timkraut/followers","following_url":"https://api.github.com/users/timkraut/following{/other_user}","gists_url":"https://api.github.com/users/timkraut/gists{/gist_id}","starred_url":"https://api.github.com/users/timkraut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timkraut/subscriptions","organizations_url":"https://api.github.com/users/timkraut/orgs","repos_url":"https://api.github.com/users/timkraut/repos","events_url":"https://api.github.com/users/timkraut/events{/privacy}","received_events_url":"https://api.github.com/users/timkraut/received_events","type":"User","site_admin":false},"body":"Hi,\r\n\r\nthis PR adds a new rule to sort members in `interface`s alphabetically. A use case for such a rule would be the following:\r\n\r\n### Use case\r\nSorting things can have certain benefits, e.g. fewer merge conflicts or easier manual comparison of implementations.\r\n\r\nCurrently, in ESLint, multiple things can be sorted alphabetically:\r\n- [sort-keys](https://eslint.org/docs/rules/sort-keys)\r\n- [sort-vars](https://eslint.org/docs/rules/sort-vars)\r\n- [sort-imports](https://eslint.org/docs/rules/sort-imports)\r\n\r\nAdditionally, it is possible to sort members using [member-ordering](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/member-ordering.md). Except if I didn't understand how to use the `member-ordering` rule correctly, currently, there is no option to sort members of interfaces alphabetically.\r\n\r\nLet's say we have an interface which looks as follows:\r\n```ts\r\ninterface Foo {\r\n  B: string; // should come after `A`\r\n  A: string;\r\n  C: string;\r\n}\r\n```\r\n\r\nThe intended definition of this `interface` is:\r\n```ts\r\ninterface Foo {\r\n  A: string;\r\n  B: string;\r\n  C: string;\r\n}\r\n```\r\n\r\nThis PR adds a rule which detects these issues. This is probably something where we could also provide a fix. I just wanted to make sure this goes into the right direction before. Looks like there is an open issue to create a rule for this in TSLint: [Feature Request: alphabetize interface members/fields](https://github.com/palantir/tslint/issues/3482). Let me know what you think!","created_at":"2019-02-12T16:49:13Z","updated_at":"2019-09-27T13:32:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4111ef7b81b80dd1612a9838c7c2e6d693a78e6f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":1199081572,"node_id":"MDU6TGFiZWwxMTk5MDgxNTcy","url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/labels/enhancement:%20new%20plugin%20rule","name":"enhancement: new plugin rule","color":"b2dddf","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/pulls/263/commits","review_comments_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/pulls/263/comments","review_comment_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/pulls/comments{/number}","comments_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/issues/263/comments","statuses_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/statuses/84a20ca827a47714edb10b80a301dcc081906f91","head":{"label":"timkraut:sort-interface-properties","ref":"sort-interface-properties","sha":"84a20ca827a47714edb10b80a301dcc081906f91","user":{"login":"timkraut","id":509669,"node_id":"MDQ6VXNlcjUwOTY2OQ==","avatar_url":"https://avatars2.githubusercontent.com/u/509669?v=4","gravatar_id":"","url":"https://api.github.com/users/timkraut","html_url":"https://github.com/timkraut","followers_url":"https://api.github.com/users/timkraut/followers","following_url":"https://api.github.com/users/timkraut/following{/other_user}","gists_url":"https://api.github.com/users/timkraut/gists{/gist_id}","starred_url":"https://api.github.com/users/timkraut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timkraut/subscriptions","organizations_url":"https://api.github.com/users/timkraut/orgs","repos_url":"https://api.github.com/users/timkraut/repos","events_url":"https://api.github.com/users/timkraut/events{/privacy}","received_events_url":"https://api.github.com/users/timkraut/received_events","type":"User","site_admin":false},"repo":{"id":169247033,"node_id":"MDEwOlJlcG9zaXRvcnkxNjkyNDcwMzM=","name":"typescript-eslint","full_name":"timkraut/typescript-eslint","private":false,"owner":{"login":"timkraut","id":509669,"node_id":"MDQ6VXNlcjUwOTY2OQ==","avatar_url":"https://avatars2.githubusercontent.com/u/509669?v=4","gravatar_id":"","url":"https://api.github.com/users/timkraut","html_url":"https://github.com/timkraut","followers_url":"https://api.github.com/users/timkraut/followers","following_url":"https://api.github.com/users/timkraut/following{/other_user}","gists_url":"https://api.github.com/users/timkraut/gists{/gist_id}","starred_url":"https://api.github.com/users/timkraut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timkraut/subscriptions","organizations_url":"https://api.github.com/users/timkraut/orgs","repos_url":"https://api.github.com/users/timkraut/repos","events_url":"https://api.github.com/users/timkraut/events{/privacy}","received_events_url":"https://api.github.com/users/timkraut/received_events","type":"User","site_admin":false},"html_url":"https://github.com/timkraut/typescript-eslint","description":":sparkles: Monorepo for all the tooling which enables ESLint to support TypeScript","fork":true,"url":"https://api.github.com/repos/timkraut/typescript-eslint","forks_url":"https://api.github.com/repos/timkraut/typescript-eslint/forks","keys_url":"https://api.github.com/repos/timkraut/typescript-eslint/keys{/key_id}","collaborators_url":"https://api.github.com/repos/timkraut/typescript-eslint/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/timkraut/typescript-eslint/teams","hooks_url":"https://api.github.com/repos/timkraut/typescript-eslint/hooks","issue_events_url":"https://api.github.com/repos/timkraut/typescript-eslint/issues/events{/number}","events_url":"https://api.github.com/repos/timkraut/typescript-eslint/events","assignees_url":"https://api.github.com/repos/timkraut/typescript-eslint/assignees{/user}","branches_url":"https://api.github.com/repos/timkraut/typescript-eslint/branches{/branch}","tags_url":"https://api.github.com/repos/timkraut/typescript-eslint/tags","blobs_url":"https://api.github.com/repos/timkraut/typescript-eslint/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/timkraut/typescript-eslint/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/timkraut/typescript-eslint/git/refs{/sha}","trees_url":"https://api.github.com/repos/timkraut/typescript-eslint/git/trees{/sha}","statuses_url":"https://api.github.com/repos/timkraut/typescript-eslint/statuses/{sha}","languages_url":"https://api.github.com/repos/timkraut/typescript-eslint/languages","stargazers_url":"https://api.github.com/repos/timkraut/typescript-eslint/stargazers","contributors_url":"https://api.github.com/repos/timkraut/typescript-eslint/contributors","subscribers_url":"https://api.github.com/repos/timkraut/typescript-eslint/subscribers","subscription_url":"https://api.github.com/repos/timkraut/typescript-eslint/subscription","commits_url":"https://api.github.com/repos/timkraut/typescript-eslint/commits{/sha}","git_commits_url":"https://api.github.com/repos/timkraut/typescript-eslint/git/commits{/sha}","comments_url":"https://api.github.com/repos/timkraut/typescript-eslint/comments{/number}","issue_comment_url":"https://api.github.com/repos/timkraut/typescript-eslint/issues/comments{/number}","contents_url":"https://api.github.com/repos/timkraut/typescript-eslint/contents/{+path}","compare_url":"https://api.github.com/repos/timkraut/typescript-eslint/compare/{base}...{head}","merges_url":"https://api.github.com/repos/timkraut/typescript-eslint/merges","archive_url":"https://api.github.com/repos/timkraut/typescript-eslint/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/timkraut/typescript-eslint/downloads","issues_url":"https://api.github.com/repos/timkraut/typescript-eslint/issues{/number}","pulls_url":"https://api.github.com/repos/timkraut/typescript-eslint/pulls{/number}","milestones_url":"https://api.github.com/repos/timkraut/typescript-eslint/milestones{/number}","notifications_url":"https://api.github.com/repos/timkraut/typescript-eslint/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/timkraut/typescript-eslint/labels{/name}","releases_url":"https://api.github.com/repos/timkraut/typescript-eslint/releases{/id}","deployments_url":"https://api.github.com/repos/timkraut/typescript-eslint/deployments","created_at":"2019-02-05T13:39:15Z","updated_at":"2019-02-05T13:39:19Z","pushed_at":"2019-09-25T10:46:13Z","git_url":"git://github.com/timkraut/typescript-eslint.git","ssh_url":"git@github.com:timkraut/typescript-eslint.git","clone_url":"https://github.com/timkraut/typescript-eslint.git","svn_url":"https://github.com/timkraut/typescript-eslint","homepage":"https://typescript-eslint.io","size":8180,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"typescript-eslint:master","ref":"master","sha":"cdf92949bec4686a74233ae49b6a28ff99b12cbd","user":{"login":"typescript-eslint","id":46634674,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ2NjM0Njc0","avatar_url":"https://avatars2.githubusercontent.com/u/46634674?v=4","gravatar_id":"","url":"https://api.github.com/users/typescript-eslint","html_url":"https://github.com/typescript-eslint","followers_url":"https://api.github.com/users/typescript-eslint/followers","following_url":"https://api.github.com/users/typescript-eslint/following{/other_user}","gists_url":"https://api.github.com/users/typescript-eslint/gists{/gist_id}","starred_url":"https://api.github.com/users/typescript-eslint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/typescript-eslint/subscriptions","organizations_url":"https://api.github.com/users/typescript-eslint/orgs","repos_url":"https://api.github.com/users/typescript-eslint/repos","events_url":"https://api.github.com/users/typescript-eslint/events{/privacy}","received_events_url":"https://api.github.com/users/typescript-eslint/received_events","type":"Organization","site_admin":false},"repo":{"id":165536154,"node_id":"MDEwOlJlcG9zaXRvcnkxNjU1MzYxNTQ=","name":"typescript-eslint","full_name":"typescript-eslint/typescript-eslint","private":false,"owner":{"login":"typescript-eslint","id":46634674,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ2NjM0Njc0","avatar_url":"https://avatars2.githubusercontent.com/u/46634674?v=4","gravatar_id":"","url":"https://api.github.com/users/typescript-eslint","html_url":"https://github.com/typescript-eslint","followers_url":"https://api.github.com/users/typescript-eslint/followers","following_url":"https://api.github.com/users/typescript-eslint/following{/other_user}","gists_url":"https://api.github.com/users/typescript-eslint/gists{/gist_id}","starred_url":"https://api.github.com/users/typescript-eslint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/typescript-eslint/subscriptions","organizations_url":"https://api.github.com/users/typescript-eslint/orgs","repos_url":"https://api.github.com/users/typescript-eslint/repos","events_url":"https://api.github.com/users/typescript-eslint/events{/privacy}","received_events_url":"https://api.github.com/users/typescript-eslint/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/typescript-eslint/typescript-eslint","description":":sparkles: Monorepo for all the tooling which enables ESLint to support TypeScript","fork":false,"url":"https://api.github.com/repos/typescript-eslint/typescript-eslint","forks_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/forks","keys_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/keys{/key_id}","collaborators_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/teams","hooks_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/hooks","issue_events_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/issues/events{/number}","events_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/events","assignees_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/assignees{/user}","branches_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/branches{/branch}","tags_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/tags","blobs_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/git/refs{/sha}","trees_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/git/trees{/sha}","statuses_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/statuses/{sha}","languages_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/languages","stargazers_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/stargazers","contributors_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/contributors","subscribers_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/subscribers","subscription_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/subscription","commits_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/commits{/sha}","git_commits_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/git/commits{/sha}","comments_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/comments{/number}","issue_comment_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/issues/comments{/number}","contents_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/contents/{+path}","compare_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/compare/{base}...{head}","merges_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/merges","archive_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/downloads","issues_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/issues{/number}","pulls_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/pulls{/number}","milestones_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/milestones{/number}","notifications_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/labels{/name}","releases_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/releases{/id}","deployments_url":"https://api.github.com/repos/typescript-eslint/typescript-eslint/deployments","created_at":"2019-01-13T17:52:15Z","updated_at":"2019-09-27T11:42:45Z","pushed_at":"2019-09-27T07:06:59Z","git_url":"git://github.com/typescript-eslint/typescript-eslint.git","ssh_url":"git@github.com:typescript-eslint/typescript-eslint.git","clone_url":"https://github.com/typescript-eslint/typescript-eslint.git","svn_url":"https://github.com/typescript-eslint/typescript-eslint","homepage":"https://typescript-eslint.io","size":8076,"stargazers_count":4918,"watchers_count":4918,"language":"TypeScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":331,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":210,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":331,"open_issues":210,"watchers":4918,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/typescript-eslint/typescript-eslint/pulls/263"},"html":{"href":"https://github.com/typescript-eslint/typescript-eslint/pull/263"},"issue":{"href":"https://api.github.com/repos/typescript-eslint/typescript-eslint/issues/263"},"comments":{"href":"https://api.github.com/repos/typescript-eslint/typescript-eslint/issues/263/comments"},"review_comments":{"href":"https://api.github.com/repos/typescript-eslint/typescript-eslint/pulls/263/comments"},"review_comment":{"href":"https://api.github.com/repos/typescript-eslint/typescript-eslint/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/typescript-eslint/typescript-eslint/pulls/263/commits"},"statuses":{"href":"https://api.github.com/repos/typescript-eslint/typescript-eslint/statuses/84a20ca827a47714edb10b80a301dcc081906f91"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"timkraut"}}