{"action":"created","issue":{"url":"https://api.github.com/repos/eslint/eslint/issues/5776","repository_url":"https://api.github.com/repos/eslint/eslint","labels_url":"https://api.github.com/repos/eslint/eslint/issues/5776/labels{/name}","comments_url":"https://api.github.com/repos/eslint/eslint/issues/5776/comments","events_url":"https://api.github.com/repos/eslint/eslint/issues/5776/events","html_url":"https://github.com/eslint/eslint/issues/5776","id":145515009,"number":5776,"title":"[switch-case] space between colon and opening brace whend defining a case","user":{"login":"lucendio","id":6096589,"avatar_url":"https://avatars.githubusercontent.com/u/6096589?v=3","gravatar_id":"","url":"https://api.github.com/users/lucendio","html_url":"https://github.com/lucendio","followers_url":"https://api.github.com/users/lucendio/followers","following_url":"https://api.github.com/users/lucendio/following{/other_user}","gists_url":"https://api.github.com/users/lucendio/gists{/gist_id}","starred_url":"https://api.github.com/users/lucendio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucendio/subscriptions","organizations_url":"https://api.github.com/users/lucendio/orgs","repos_url":"https://api.github.com/users/lucendio/repos","events_url":"https://api.github.com/users/lucendio/events{/privacy}","received_events_url":"https://api.github.com/users/lucendio/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/eslint/eslint/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/eslint/eslint/labels/evaluating","name":"evaluating","color":"fef2c0"},{"url":"https://api.github.com/repos/eslint/eslint/labels/rule","name":"rule","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-04-03T16:14:38Z","updated_at":"2016-04-03T19:12:25Z","closed_at":null,"body":"**What version of ESLint are you using?**\r\n`2.6.0`\r\n\r\n**What parser (default, Babel-ESLint, etc.) are you using?**\r\n`Espree`\r\n\r\n**Please show your full configuration:**\r\n```js\r\nparserOptions:\r\n    ecmaVersion: 6\r\n    sourceType: module\r\n    ecmaFeatures: \r\n        globalReturn: true\r\n        impliedStrict: true\r\n        jsx: false\r\n\r\nenv:\r\n    browser: true\r\n    commonjs: true\r\n    es6: true\r\n    node: true\r\n    mocha: true\r\n    jasmine: true\r\n    meteor: true\r\n\r\nplugins: [ ]\r\n\r\nrules:\r\n    indent: [ 2, 4, { SwitchCase: 1 } ] \r\n    linebreak-style: [ 2, 'unix' ]\r\n    quotes: [ 2, 'single', 'avoid-escape' ]\r\n    semi: [ 2, always ]\r\n    \r\n    no-case-declarations: 2\r\n    space-before-blocks: [\r\n        2,\r\n        {\r\n            functions: 'never', \r\n            keywords: 'never', \r\n            classes: 'never'\r\n        }\r\n    ]\r\n```\r\n**What did you do? Please include the actual source code causing the issue.**\r\n```js\r\nswitch( state ){\r\n    case 'state1': {\r\n        console.log( 'foo' );\r\n        break;\r\n    }\r\n    case 'state2': {\r\n        console.log( 'bar' );\r\n        break;\r\n    }    \r\n    default: {\r\n        throw new Error( 'unsupported state' );\r\n    }\r\n}\r\n```\r\n\r\n**What did you expect to happen?**\r\nthat the opening braces in the same line of each `case` wont get marked, because there is a space in front of them.\r\n\r\n**What actually happened? Please include the actual, raw output from ESLint.**\r\n`error  Unexpected space before opening brace  space-before-blocks`\r\n\r\n**additional info and thoughts:**\r\nWhen changing the the config to `keywords: 'always'` the mentioned braces dont get marked. Since this syntax looks a lot more like a simple field declatartion in an object literal, I think, it does make sense to put a space between colon and brace in this case. Imho this situation doesnt so great into the `keywords` group or in any other given group. What are your thoughts on this? Maybe an additional rule is needed for this?\r\nNOTE: I have a lot more rules, but the combination of the last two seem to cause the error. (Tried the simplified config above - same problem) \r\n"},"comment":{"url":"https://api.github.com/repos/eslint/eslint/issues/comments/205036690","html_url":"https://github.com/eslint/eslint/issues/5776#issuecomment-205036690","issue_url":"https://api.github.com/repos/eslint/eslint/issues/5776","id":205036690,"user":{"login":"mysticatea","id":1937871,"avatar_url":"https://avatars.githubusercontent.com/u/1937871?v=3","gravatar_id":"","url":"https://api.github.com/users/mysticatea","html_url":"https://github.com/mysticatea","followers_url":"https://api.github.com/users/mysticatea/followers","following_url":"https://api.github.com/users/mysticatea/following{/other_user}","gists_url":"https://api.github.com/users/mysticatea/gists{/gist_id}","starred_url":"https://api.github.com/users/mysticatea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mysticatea/subscriptions","organizations_url":"https://api.github.com/users/mysticatea/orgs","repos_url":"https://api.github.com/users/mysticatea/repos","events_url":"https://api.github.com/users/mysticatea/events{/privacy}","received_events_url":"https://api.github.com/users/mysticatea/received_events","type":"User","site_admin":false},"created_at":"2016-04-03T19:12:24Z","updated_at":"2016-04-03T19:12:24Z","body":"@platinumazure No worries. I had forgotten `\"never\"` option of `space-before-blocks` rule and I had focused on the number (1) of messages in the issue before I read it enough. I confirmed `space-before-blocks` is warning between `:` and `{`.\r\n\r\n`no-case-declarations` enforce the blocks in switch-case in order to introduce block-scoping for each `case`.\r\n\r\nIndeed, eslint does not have the rule to enforce/disallow spacing around colon of labels, `case`, and `default`.\r\nSo this issue can be a proposal of some new spacing rule."}}