{"action":"created","issue":{"url":"https://api.github.com/repos/eslint/eslint/issues/5907","repository_url":"https://api.github.com/repos/eslint/eslint","labels_url":"https://api.github.com/repos/eslint/eslint/issues/5907/labels{/name}","comments_url":"https://api.github.com/repos/eslint/eslint/issues/5907/comments","events_url":"https://api.github.com/repos/eslint/eslint/issues/5907/events","html_url":"https://github.com/eslint/eslint/pull/5907","id":149592607,"number":5907,"title":"New: Adding new key-space config (fixes #5613)","user":{"login":"Kyle-Mendes","id":6400039,"avatar_url":"https://avatars.githubusercontent.com/u/6400039?v=3","gravatar_id":"","url":"https://api.github.com/users/Kyle-Mendes","html_url":"https://github.com/Kyle-Mendes","followers_url":"https://api.github.com/users/Kyle-Mendes/followers","following_url":"https://api.github.com/users/Kyle-Mendes/following{/other_user}","gists_url":"https://api.github.com/users/Kyle-Mendes/gists{/gist_id}","starred_url":"https://api.github.com/users/Kyle-Mendes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kyle-Mendes/subscriptions","organizations_url":"https://api.github.com/users/Kyle-Mendes/orgs","repos_url":"https://api.github.com/users/Kyle-Mendes/repos","events_url":"https://api.github.com/users/Kyle-Mendes/events{/privacy}","received_events_url":"https://api.github.com/users/Kyle-Mendes/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/eslint/eslint/labels/CLA:%20Valid","name":"CLA: Valid","color":"007700"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2016-04-19T21:43:24Z","updated_at":"2016-05-03T03:34:49Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/eslint/eslint/pulls/5907","html_url":"https://github.com/eslint/eslint/pull/5907","diff_url":"https://github.com/eslint/eslint/pull/5907.diff","patch_url":"https://github.com/eslint/eslint/pull/5907.patch"},"body":"This configuration allows specifying how spacing should work when aligning values via a new `alignment` property.\r\n\r\nExample Configuration using the new `alignment` property:\r\n\r\n```json\r\n\"key-spacing\": [2, {\r\n    \"singleLine\": {\r\n        \"beforeColon\": false,\r\n        \"afterColon\": true\r\n    },\r\n    \"multiLine\": {\r\n        \"beforeColon\": false,\r\n        \"afterColon\": true,\r\n        \"align\": \"colon\"\r\n    },\r\n    \"align\": {\r\n        \"beforeColon\": true,\r\n        \"afterColon\": true\r\n    }\r\n}]\r\n```\r\n\r\nThe following alignment would throw no errors: \r\n```js\r\nvar obj = {\r\n    _origin  : 0,\r\n    _x       : 1,\r\n    callback : function(cb) {\r\n        cb();\r\n    },\r\n    a  : 1,\r\n    bc : 2\r\n    d  : function() {\r\n        //...\r\n    },\r\n    o: {\r\n        internal : true,\r\n        int      : 1\r\n    }\r\n};\r\n```\r\n\r\n\r\nTests were added showing that it should work with both `align: colon` and `align: value` .\r\n\r\n------------------------------------------------------------\r\n\r\n### Why\r\n\r\nThis allows eslint users (like myself) more granular control over the styling of their alignment.  I specifically chose to add a new configuration property to allow separate styling between `singleLine`, `multiLine` and `alignment` if the user so chooses.\r\n\r\nThe `alignment` options are initialized as null to maintain backwards compatibility and ensure that no hidden configurations are forced on the user without them realizing. "},"comment":{"url":"https://api.github.com/repos/eslint/eslint/issues/comments/216427860","html_url":"https://github.com/eslint/eslint/pull/5907#issuecomment-216427860","issue_url":"https://api.github.com/repos/eslint/eslint/issues/5907","id":216427860,"user":{"login":"btmills","id":1709537,"avatar_url":"https://avatars.githubusercontent.com/u/1709537?v=3","gravatar_id":"","url":"https://api.github.com/users/btmills","html_url":"https://github.com/btmills","followers_url":"https://api.github.com/users/btmills/followers","following_url":"https://api.github.com/users/btmills/following{/other_user}","gists_url":"https://api.github.com/users/btmills/gists{/gist_id}","starred_url":"https://api.github.com/users/btmills/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/btmills/subscriptions","organizations_url":"https://api.github.com/users/btmills/orgs","repos_url":"https://api.github.com/users/btmills/repos","events_url":"https://api.github.com/users/btmills/events{/privacy}","received_events_url":"https://api.github.com/users/btmills/received_events","type":"User","site_admin":false},"created_at":"2016-05-03T03:34:49Z","updated_at":"2016-05-03T03:34:49Z","body":"This is good progress, @Kyle-Mendes - all of my comments are minor, so you should be good to start updating the documentation as well!"}}