Enable no-case-declarations lint rule

Lexical declarations in `case` and `default` clauses are a footgun,
since they are visible in the entire switch block, but they only
get initialized upon assignment, which only happens if the relevant
`case` is actually reached.

To ensure that such lexical declarations only apply to the current
`case` (which is usually the intention), `case` clauses containing
them should be wrapped in curly braces to create an explicit block.

More information:
https://eslint.org/docs/rules/no-case-declarations

Change-Id: I63d9341fcd76d4b9ce8281bd0e6573b886577f08
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2119685
Reviewed-by: Tim van der Lippe <[email protected]>
Commit-Queue: Mathias Bynens <[email protected]>
diff --git a/front_end/ui/ContextMenu.js b/front_end/ui/ContextMenu.js
index c2d882a..d2d8a56 100644
--- a/front_end/ui/ContextMenu.js
+++ b/front_end/ui/ContextMenu.js
@@ -88,7 +88,7 @@
    */
   _buildDescriptor() {
     switch (this._type) {
-      case 'item':
+      case 'item': {
         const result = {type: 'item', id: this._id, label: this._label, enabled: !this._disabled};
         if (this._customElement) {
           result.element = this._customElement;
@@ -97,10 +97,13 @@
           result.shortcut = this._shortcut;
         }
         return result;
-      case 'separator':
+      }
+      case 'separator': {
         return {type: 'separator'};
-      case 'checkbox':
+      }
+      case 'checkbox': {
         return {type: 'checkbox', id: this._id, label: this._label, checked: !!this._checked, enabled: !this._disabled};
+      }
     }
     throw new Error('Invalid item type:' + this._type);
   }