{"action":"created","issue":{"url":"https://api.github.com/repos/phetsims/chipper/issues/485","repository_url":"https://api.github.com/repos/phetsims/chipper","labels_url":"https://api.github.com/repos/phetsims/chipper/issues/485/labels{/name}","comments_url":"https://api.github.com/repos/phetsims/chipper/issues/485/comments","events_url":"https://api.github.com/repos/phetsims/chipper/issues/485/events","html_url":"https://github.com/phetsims/chipper/issues/485","id":176093746,"number":485,"title":"add eslint rule to require default case in switch statements?","user":{"login":"pixelzoom","id":3046552,"avatar_url":"https://avatars.githubusercontent.com/u/3046552?v=3","gravatar_id":"","url":"https://api.github.com/users/pixelzoom","html_url":"https://github.com/pixelzoom","followers_url":"https://api.github.com/users/pixelzoom/followers","following_url":"https://api.github.com/users/pixelzoom/following{/other_user}","gists_url":"https://api.github.com/users/pixelzoom/gists{/gist_id}","starred_url":"https://api.github.com/users/pixelzoom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pixelzoom/subscriptions","organizations_url":"https://api.github.com/users/pixelzoom/orgs","repos_url":"https://api.github.com/users/pixelzoom/repos","events_url":"https://api.github.com/users/pixelzoom/events{/privacy}","received_events_url":"https://api.github.com/users/pixelzoom/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/phetsims/chipper/labels/meeting:developer","name":"meeting:developer","color":"000000"}],"state":"open","locked":false,"assignee":{"login":"pixelzoom","id":3046552,"avatar_url":"https://avatars.githubusercontent.com/u/3046552?v=3","gravatar_id":"","url":"https://api.github.com/users/pixelzoom","html_url":"https://github.com/pixelzoom","followers_url":"https://api.github.com/users/pixelzoom/followers","following_url":"https://api.github.com/users/pixelzoom/following{/other_user}","gists_url":"https://api.github.com/users/pixelzoom/gists{/gist_id}","starred_url":"https://api.github.com/users/pixelzoom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pixelzoom/subscriptions","organizations_url":"https://api.github.com/users/pixelzoom/orgs","repos_url":"https://api.github.com/users/pixelzoom/repos","events_url":"https://api.github.com/users/pixelzoom/events{/privacy}","received_events_url":"https://api.github.com/users/pixelzoom/received_events","type":"User","site_admin":false},"assignees":[{"login":"pixelzoom","id":3046552,"avatar_url":"https://avatars.githubusercontent.com/u/3046552?v=3","gravatar_id":"","url":"https://api.github.com/users/pixelzoom","html_url":"https://github.com/pixelzoom","followers_url":"https://api.github.com/users/pixelzoom/followers","following_url":"https://api.github.com/users/pixelzoom/following{/other_user}","gists_url":"https://api.github.com/users/pixelzoom/gists{/gist_id}","starred_url":"https://api.github.com/users/pixelzoom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pixelzoom/subscriptions","organizations_url":"https://api.github.com/users/pixelzoom/orgs","repos_url":"https://api.github.com/users/pixelzoom/repos","events_url":"https://api.github.com/users/pixelzoom/events{/privacy}","received_events_url":"https://api.github.com/users/pixelzoom/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2016-09-09T19:49:51Z","updated_at":"2016-09-13T23:38:00Z","closed_at":null,"body":"While working on plinko-probability, I encountered numerous cases (no pun intended) where `switch` statements had no `default` case. In a couple of cases, the code was relying on the `switch` being a no-op if none of the cases matched. In other (most) cases, it was just a blatant lack of error checking.\r\n\r\nHow do developers feel about enabling the eslint rule that requires a default case in switch statements, or an explicit commenting indicating that there is no default? \r\n\r\nSee documentation of the eslint `default-case` rule at http://eslint.org/docs/rules/default-case."},"comment":{"url":"https://api.github.com/repos/phetsims/chipper/issues/comments/246860333","html_url":"https://github.com/phetsims/chipper/issues/485#issuecomment-246860333","issue_url":"https://api.github.com/repos/phetsims/chipper/issues/485","id":246860333,"user":{"login":"pixelzoom","id":3046552,"avatar_url":"https://avatars.githubusercontent.com/u/3046552?v=3","gravatar_id":"","url":"https://api.github.com/users/pixelzoom","html_url":"https://github.com/pixelzoom","followers_url":"https://api.github.com/users/pixelzoom/followers","following_url":"https://api.github.com/users/pixelzoom/following{/other_user}","gists_url":"https://api.github.com/users/pixelzoom/gists{/gist_id}","starred_url":"https://api.github.com/users/pixelzoom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pixelzoom/subscriptions","organizations_url":"https://api.github.com/users/pixelzoom/orgs","repos_url":"https://api.github.com/users/pixelzoom/repos","events_url":"https://api.github.com/users/pixelzoom/events{/privacy}","received_events_url":"https://api.github.com/users/pixelzoom/received_events","type":"User","site_admin":false},"created_at":"2016-09-13T23:38:00Z","updated_at":"2016-09-13T23:38:00Z","body":"The following repositories have one or more switch statements with no default case:\r\n\r\n> energy-forms-and-changes\r\nfaradays-law\r\nfraction-matcher\r\nmaking-tens\r\nneuron\r\nstates-of-matter\r\nsun (buttons)\r\ntrig-tour\r\n\r\nReviewing these, none of them looks intentional or justified to my eye.  \r\n\r\nI also see this `default` case in states-of-matter.MultipleParticlesModel:\r\n\r\n```js\r\n        default:\r\n          break;\r\n```\r\n\r\n@jbphet Is this really what you intended? This leaves me wondering if the intent is really to use the default value of `triplePointInKelvin` for `MONATOMIC_OXYGEN` (the only molecule type that doesn't have a case), or whether this is a bug.   If it's not a bug, it would be better to have a case for `MONATOMIC_OXYGEN` and a default that does `throw Error( 'invalid molecule type: ' + this.currentMolecule )`."}}
{"actor":{"display_login":"pixelzoom"}}