[cleanup] Remove implicit any from no-imperative-dom-api rule

This provides types for the rules so it's easier to append more thing
in the future and provides better tyo safety.


Bug: none
Change-Id: Ic85bcb02a555db0632050c8a5b69493a07b58c26
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6757117
Reviewed-by: Danil Somsikov <[email protected]>
Auto-Submit: Nikolay Vitkov <[email protected]>
Commit-Queue: Nikolay Vitkov <[email protected]>
diff --git a/scripts/eslint_rules/lib/no-imperative-dom-api.ts b/scripts/eslint_rules/lib/no-imperative-dom-api.ts
index 3ce2869..ecdbde5 100644
--- a/scripts/eslint_rules/lib/no-imperative-dom-api.ts
+++ b/scripts/eslint_rules/lib/no-imperative-dom-api.ts
@@ -22,31 +22,12 @@
 import {uiUtils} from './no-imperative-dom-api/ui-utils.ts';
 import {widget} from './no-imperative-dom-api/widget.ts';
 import {createRule} from './utils/ruleCreator.ts';
-type CallExpression = TSESTree.CallExpression;
 type Identifier = TSESTree.Identifier;
 type MemberExpression = TSESTree.MemberExpression;
-type NewExpression = TSESTree.NewExpression;
 type CallExpressionArgument = TSESTree.CallExpressionArgument;
 type Node = TSESTree.Node;
 type Range = TSESTree.Range;
 
-type Subrule = Partial<{
-  getEvent(event: Node): string | null,
-  propertyAssignment(property: Identifier, propertyValue: Node, domFragment: DomFragment): boolean,
-  methodCall(property: Identifier, firstArg: Node, secondArg: Node, domFragment: DomFragment, call: CallExpression):
-      boolean,
-  propertyMethodCall(property: Identifier, method: Node, firstArg: Node, domFragment: DomFragment): boolean,
-  subpropertyAssignment(
-      property: Identifier, subproperty: Identifier, subpropertyValue: Node, domFragment: DomFragment): boolean,
-  functionCall(call: CallExpression, firstArg: Node, secondArg: Node, domFragment: DomFragment): boolean,
-  // eslint-disable-next-line @typescript-eslint/naming-convention
-  MemberExpression: (node: MemberExpression) => void,
-  // eslint-disable-next-line @typescript-eslint/naming-convention
-  NewExpression: (node: NewExpression) => void,
-  // eslint-disable-next-line @typescript-eslint/naming-convention
-  CallExpression: (node: CallExpression) => void,
-}>;
-
 export default createRule({
   name: 'no-imperative-dom-api',
   meta: {
@@ -65,7 +46,7 @@
   create: function(context) {
     const sourceCode = context.sourceCode;
 
-    const subrules: Subrule[] = [
+    const subrules = [
       adorner.create(context),
       ariaUtils.create(context),
       button.create(context),
diff --git a/scripts/eslint_rules/lib/no-imperative-dom-api/adorner.ts b/scripts/eslint_rules/lib/no-imperative-dom-api/adorner.ts
index 41b2eac..16fed7d 100644
--- a/scripts/eslint_rules/lib/no-imperative-dom-api/adorner.ts
+++ b/scripts/eslint_rules/lib/no-imperative-dom-api/adorner.ts
@@ -5,19 +5,14 @@
  * @fileoverview A library to identify and templatize manually constructed Adorner.
  */
 
-import type {TSESTree} from '@typescript-eslint/utils';
-
-import {type Context, isIdentifier, isIdentifierChain} from './ast.ts';
+import {isIdentifier, isIdentifierChain, type RuleCreator} from './ast.ts';
 import {DomFragment} from './dom-fragment.ts';
 
-type Identifier = TSESTree.Identifier;
-type Node = TSESTree.Node;
-
-export const adorner = {
-  create(context: Context) {
+export const adorner: RuleCreator = {
+  create(context) {
     const sourceCode = context.sourceCode;
     return {
-      propertyAssignment(property: Identifier, propertyValue: Node, domFragment: DomFragment) {
+      propertyAssignment(property, propertyValue, domFragment) {
         if (domFragment.tagName === 'devtools-adorner' && isIdentifier(property, 'data') &&
             propertyValue.type === 'ObjectExpression') {
           for (const property of propertyValue.properties) {
diff --git a/scripts/eslint_rules/lib/no-imperative-dom-api/aria-utils.ts b/scripts/eslint_rules/lib/no-imperative-dom-api/aria-utils.ts
index c63c51e..89c0926 100644
--- a/scripts/eslint_rules/lib/no-imperative-dom-api/aria-utils.ts
+++ b/scripts/eslint_rules/lib/no-imperative-dom-api/aria-utils.ts
@@ -7,17 +7,14 @@
 
 import type {TSESTree} from '@typescript-eslint/utils';
 
-import {type Context, isIdentifier, isIdentifierChain, isMemberExpression} from './ast.ts';
-import type {DomFragment} from './dom-fragment.ts';
+import {isIdentifier, isIdentifierChain, isMemberExpression, type RuleCreator} from './ast.ts';
 
-type Node = TSESTree.Node;
-type CallExpression = TSESTree.CallExpression;
 type Identifier = TSESTree.Identifier;
 
-export const ariaUtils = {
-  create(_context: Context) {
+export const ariaUtils: RuleCreator = {
+  create() {
     return {
-      functionCall(call: CallExpression, _firstArg: Node, secondArg: Node, domFragment: DomFragment): boolean {
+      functionCall(call, _firstArg, secondArg, domFragment) {
         const func = isMemberExpression(
             call.callee, n => isIdentifierChain(n, ['UI', 'ARIAUtils']), n => n.type === 'Identifier');
         if (!func) {
diff --git a/scripts/eslint_rules/lib/no-imperative-dom-api/ast.ts b/scripts/eslint_rules/lib/no-imperative-dom-api/ast.ts
index 819280e..e28e577 100644
--- a/scripts/eslint_rules/lib/no-imperative-dom-api/ast.ts
+++ b/scripts/eslint_rules/lib/no-imperative-dom-api/ast.ts
@@ -6,10 +6,30 @@
  */
 
 import type {TSESTree} from '@typescript-eslint/utils';
-import type {RuleContext} from '@typescript-eslint/utils/ts-eslint';
+import type {RuleContext, RuleListener} from '@typescript-eslint/utils/ts-eslint';
+
+import type {DomFragment} from './dom-fragment';
 
 type Node = TSESTree.Node;
-export type Context = RuleContext<'preferTemplateLiterals', []>;
+type CallExpression = TSESTree.CallExpression;
+type Identifier = TSESTree.Identifier;
+
+type Context = RuleContext<'preferTemplateLiterals', []>;
+type Subrule = Partial<{
+  getEvent(event: Node): string | null,
+  propertyAssignment(property: Identifier, propertyValue: Node, domFragment: DomFragment): boolean,
+  methodCall(property: Identifier, firstArg: Node, secondArg: Node, domFragment: DomFragment, call: CallExpression):
+      boolean,
+  propertyMethodCall(property: Identifier, method: Node, firstArg: Node, domFragment: DomFragment): boolean,
+  subpropertyAssignment(
+      property: Identifier, subproperty: Identifier, subpropertyValue: Node, domFragment: DomFragment): boolean,
+  functionCall(call: CallExpression, firstArg: Node, secondArg: Node, domFragment: DomFragment): boolean,
+
+}>&Pick<RuleListener, 'MemberExpression'|'NewExpression'|'CallExpression'>;
+
+export interface RuleCreator {
+  create(context: Context): Subrule;
+}
 
 export function isIdentifier(node: Node, name: string|string[]): boolean {
   return node.type === 'Identifier' && (Array.isArray(name) ? name.includes(node.name) : node.name === name);
diff --git a/scripts/eslint_rules/lib/no-imperative-dom-api/button.ts b/scripts/eslint_rules/lib/no-imperative-dom-api/button.ts
index 222fc16..2229aaf 100644
--- a/scripts/eslint_rules/lib/no-imperative-dom-api/button.ts
+++ b/scripts/eslint_rules/lib/no-imperative-dom-api/button.ts
@@ -7,14 +7,14 @@
 
 import type {TSESTree} from '@typescript-eslint/utils';
 
-import {type Context, isIdentifier, isIdentifierChain} from './ast.ts';
+import {isIdentifier, isIdentifierChain, type RuleCreator} from './ast.ts';
 import {DomFragment} from './dom-fragment.ts';
 
 type Identifier = TSESTree.Identifier;
 type Node = TSESTree.Node;
 
-export const button = {
-  create(context: Context) {
+export const button: RuleCreator = {
+  create(context) {
     const sourceCode = context.sourceCode;
     return {
       propertyAssignment(property: Identifier, propertyValue: Node, domFragment: DomFragment) {
diff --git a/scripts/eslint_rules/lib/no-imperative-dom-api/data-grid.ts b/scripts/eslint_rules/lib/no-imperative-dom-api/data-grid.ts
index f9687ba..27f30b4 100644
--- a/scripts/eslint_rules/lib/no-imperative-dom-api/data-grid.ts
+++ b/scripts/eslint_rules/lib/no-imperative-dom-api/data-grid.ts
@@ -7,20 +7,16 @@
 
 import type {TSESTree} from '@typescript-eslint/utils';
 
-import {type Context, isIdentifier, isIdentifierChain, isMemberExpression} from './ast.ts';
+import {isIdentifier, isIdentifierChain, isMemberExpression, type RuleCreator} from './ast.ts';
 import {DomFragment} from './dom-fragment.ts';
 
 type Identifier = TSESTree.Identifier;
-type Node = TSESTree.Node;
-type CallExpression = TSESTree.CallExpression;
 
-export const dataGrid = {
-  create(context: Context) {
+export const dataGrid: RuleCreator = {
+  create(context) {
     const sourceCode = context.sourceCode;
     return {
-      methodCall(
-          property: Identifier, firstArg: Node, _secondArg: Node|undefined, domFragment: DomFragment,
-          _call: CallExpression) {
+      methodCall(property, firstArg, _secondArg, domFragment) {
         if (domFragment.tagName !== 'devtools-data-grid') {
           return false;
         }
@@ -47,18 +43,17 @@
         }
         return false;
       },
-      getEvent(event: Node): string |
-          null {
-            switch (sourceCode.getText(event)) {
-              case 'DataGrid.DataGrid.Events.SELECTED_NODE':
-              case 'DataGrid.DataGrid.Events.DESELECTED_NODE':
-                return 'select';
-              case 'DataGrid.DataGrid.Events.SORTING_CHANGED':
-                return 'sort';
-              default:
-                return null;
-            }
-          },
+      getEvent(event) {
+        switch (sourceCode.getText(event)) {
+          case 'DataGrid.DataGrid.Events.SELECTED_NODE':
+          case 'DataGrid.DataGrid.Events.DESELECTED_NODE':
+            return 'select';
+          case 'DataGrid.DataGrid.Events.SORTING_CHANGED':
+            return 'sort';
+          default:
+            return null;
+        }
+      },
       NewExpression(node) {
         if (isIdentifierChain(node.callee, ['DataGrid', 'DataGrid', 'DataGridImpl']) ||
             isIdentifierChain(node.callee, ['DataGrid', 'ViewportDataGrid', 'ViewportDataGrid']) ||
@@ -94,13 +89,15 @@
                 const columnFragment = columnsFragment.appendChild(column, sourceCode);
                 columnFragment.tagName = 'th';
                 for (const property of column.properties) {
-                  if (property.type !== 'Property' || isIdentifier(property.value, 'undefined')) {
+                  if (property.type !== 'Property' || isIdentifier(property.value, 'undefined') ||
+                      property.key.type !== 'Identifier') {
                     continue;
                   }
+
                   if (isIdentifier(property.key, ['id', 'weight', 'width'])) {
                     columnFragment.attributes.push({key: property.key.name, value: property.value});
                   } else if (isIdentifier(property.key, 'align')) {
-                    const value: Node|string|null = isMemberExpression(
+                    const value = isMemberExpression(
                         property.value, n => isIdentifierChain(n, ['DataGrid', 'DataGrid', 'Align']),
                         n => n.type === 'Identifier');
                     columnFragment.attributes.push({
@@ -112,7 +109,7 @@
                   } else if (isIdentifier(property.key, 'fixedWidth')) {
                     columnFragment.booleanAttributes.push({key: 'fixed', value: property.value});
                   } else if (isIdentifier(property.key, 'dataType')) {
-                    const value: Node|string|null = isMemberExpression(
+                    const value = isMemberExpression(
                         property.value, n => isIdentifierChain(n, ['DataGrid', 'DataGrid', 'DataType']),
                         n => n.type === 'Identifier');
                     columnFragment.attributes.push({
@@ -138,7 +135,7 @@
           }
         }
       },
-      CallExpression(node: CallExpression) {
+      CallExpression(node) {
         if (node.callee.type !== 'MemberExpression' ||
             !isIdentifier(node.callee.property, ['createTD', 'createTDWithClass', 'createCell'])) {
           return;
diff --git a/scripts/eslint_rules/lib/no-imperative-dom-api/dom-api-devtools-extensions.ts b/scripts/eslint_rules/lib/no-imperative-dom-api/dom-api-devtools-extensions.ts
index f035e68..4000750 100644
--- a/scripts/eslint_rules/lib/no-imperative-dom-api/dom-api-devtools-extensions.ts
+++ b/scripts/eslint_rules/lib/no-imperative-dom-api/dom-api-devtools-extensions.ts
@@ -5,19 +5,14 @@
  * @fileoverview Library to identify and templatize manually calls to DevTools DOM API extensions.
  */
 
-import type {TSESTree} from '@typescript-eslint/utils';
+import {isIdentifier, type RuleCreator} from './ast.ts';
 
-import {type Context, isIdentifier} from './ast.ts';
-import type {DomFragment} from './dom-fragment.ts';
-
-type Node = TSESTree.Node;
-
-export const domApiDevtoolsExtensions = {
-  create: function(context: Context) {
+export const domApiDevtoolsExtensions: RuleCreator = {
+  create: function(context) {
     const sourceCode = context.sourceCode;
 
     return {
-      methodCall(property: Node, firstArg: Node, secondArg: Node, domFragment: DomFragment, call: Node): boolean {
+      methodCall(property, firstArg, secondArg, domFragment, call) {
         if (isIdentifier(property, 'createChild')) {
           if (firstArg?.type === 'Literal') {
             const childFragment = domFragment.appendChild(
diff --git a/scripts/eslint_rules/lib/no-imperative-dom-api/dom-api.ts b/scripts/eslint_rules/lib/no-imperative-dom-api/dom-api.ts
index 94d67f6..0018b1c 100644
--- a/scripts/eslint_rules/lib/no-imperative-dom-api/dom-api.ts
+++ b/scripts/eslint_rules/lib/no-imperative-dom-api/dom-api.ts
@@ -5,20 +5,14 @@
  * @fileoverview Library to identify and templatize manually DOM API calls.
  */
 
-import type {TSESTree} from '@typescript-eslint/utils';
-
-import {type Context, isIdentifier, isLiteral} from './ast.ts';
+import {isIdentifier, isLiteral, type RuleCreator} from './ast.ts';
 import {DomFragment} from './dom-fragment.ts';
 
-type CallExpression = TSESTree.CallExpression;
-type Identifier = TSESTree.Identifier;
-type Node = TSESTree.Node;
-
-export const domApi = {
-  create: function(context: Context) {
+export const domApi: RuleCreator = {
+  create: function(context) {
     const sourceCode = context.sourceCode;
     return {
-      propertyAssignment(property: Identifier, propertyValue: Node, domFragment: DomFragment) {
+      propertyAssignment(property, propertyValue, domFragment) {
         if (isIdentifier(property, 'className')) {
           domFragment.classList.push(propertyValue);
           return true;
@@ -40,14 +34,14 @@
         }
         return false;
       },
-      propertyMethodCall(property: Identifier, method: Node, firstArg: Node, domFragment: DomFragment): boolean {
+      propertyMethodCall(property, method, firstArg, domFragment) {
         if (isIdentifier(property, 'classList') && isIdentifier(method, 'add')) {
           domFragment.classList.push(firstArg);
           return true;
         }
         return false;
       },
-      subpropertyAssignment(property: Identifier, subproperty: Node, subpropertyValue: Node, domFragment: DomFragment) {
+      subpropertyAssignment(property, subproperty, subpropertyValue, domFragment) {
         if (isIdentifier(property, 'style') && subproperty.type === 'Identifier') {
           const property = subproperty.name.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
           if (subpropertyValue.type !== 'SpreadElement') {
@@ -70,9 +64,7 @@
         }
         return false;
       },
-      methodCall(
-          property: Identifier, firstArg: Node, secondArg: Node|undefined, domFragment: DomFragment,
-          call: CallExpression) {
+      methodCall(property, firstArg, secondArg, domFragment, call) {
         if (isIdentifier(property, 'setAttribute')) {
           const attribute = firstArg;
           const value = secondArg;
@@ -133,15 +125,17 @@
         }
         return false;
       },
+
       MemberExpression(node) {
         if (isIdentifier(node.object, 'document') && isIdentifier(node.property, 'createElement') &&
             node.parent.type === 'CallExpression' && node.parent.callee === node) {
           const domFragment = DomFragment.getOrCreate(node.parent, sourceCode);
           if (node.parent.arguments.length >= 1 && node.parent.arguments[0].type === 'Literal') {
-            domFragment.tagName = node.parent.arguments[0].value;
+            domFragment.tagName = String(node.parent.arguments[0].value);
           }
         }
       },
+
     };
   }
 };
diff --git a/scripts/eslint_rules/lib/no-imperative-dom-api/dom-fragment.ts b/scripts/eslint_rules/lib/no-imperative-dom-api/dom-fragment.ts
index e6b64ea..8ac6b01 100644
--- a/scripts/eslint_rules/lib/no-imperative-dom-api/dom-fragment.ts
+++ b/scripts/eslint_rules/lib/no-imperative-dom-api/dom-fragment.ts
@@ -135,7 +135,7 @@
       return '${' + text + '}';
     }
 
-    function appendExpression(expression) {
+    function appendExpression(expression: string) {
       if (lineLength + expression.length + 1 > MAX_LINE_LENGTH) {
         components.push(`\n${' '.repeat(indent + 4)}`);
         lineLength = expression.length + indent + 4;
diff --git a/scripts/eslint_rules/lib/no-imperative-dom-api/split-widget.ts b/scripts/eslint_rules/lib/no-imperative-dom-api/split-widget.ts
index 840adc4..35fb12b 100644
--- a/scripts/eslint_rules/lib/no-imperative-dom-api/split-widget.ts
+++ b/scripts/eslint_rules/lib/no-imperative-dom-api/split-widget.ts
@@ -7,15 +7,13 @@
 
 import type {TSESTree} from '@typescript-eslint/utils';
 
-import {type Context, isIdentifier, isIdentifierChain} from './ast.ts';
+import {isIdentifier, isIdentifierChain, type RuleCreator} from './ast.ts';
 import {DomFragment} from './dom-fragment.ts';
 
-type Identifier = TSESTree.Identifier;
 type Node = TSESTree.Node;
-type CallExpression = TSESTree.CallExpression;
 
-export const splitWidget = {
-  create(context: Context) {
+export const splitWidget: RuleCreator = {
+  create(context) {
     const sourceCode = context.sourceCode;
 
     function setVertical(domFragment: DomFragment, vertical: Node) {
@@ -57,9 +55,7 @@
     }
 
     return {
-      methodCall(
-          property: Identifier, firstArg: Node, _secondArg: Node|undefined, domFragment: DomFragment,
-          _call: CallExpression) {
+      methodCall(property, firstArg, _secondArg, domFragment) {
         if (domFragment.tagName !== 'devtools-split-view') {
           return false;
         }
@@ -89,15 +85,14 @@
         }
         return false;
       },
-      getEvent(event: Node): string |
-          null {
-            switch (sourceCode.getText(event)) {
-              case 'UI.SplitWidget.Events.SHOW_MODE_CHANGED':
-                return 'change';
-              default:
-                return null;
-            }
-          },
+      getEvent(event) {
+        switch (sourceCode.getText(event)) {
+          case 'UI.SplitWidget.Events.SHOW_MODE_CHANGED':
+            return 'change';
+          default:
+            return null;
+        }
+      },
       NewExpression(node) {
         if (isIdentifierChain(node.callee, ['UI', 'SplitWidget', 'SplitWidget'])) {
           const domFragment = DomFragment.getOrCreate(node, sourceCode);
diff --git a/scripts/eslint_rules/lib/no-imperative-dom-api/toolbar.ts b/scripts/eslint_rules/lib/no-imperative-dom-api/toolbar.ts
index bf592e5..2c5f5a0 100644
--- a/scripts/eslint_rules/lib/no-imperative-dom-api/toolbar.ts
+++ b/scripts/eslint_rules/lib/no-imperative-dom-api/toolbar.ts
@@ -7,37 +7,35 @@
 
 import type {TSESTree} from '@typescript-eslint/utils';
 
-import {type Context, isIdentifier, isIdentifierChain, isMemberExpression} from './ast.ts';
+import {isIdentifier, isIdentifierChain, isMemberExpression, type RuleCreator} from './ast.ts';
 import {DomFragment} from './dom-fragment.ts';
 
 type Node = TSESTree.Node;
-type NewExpression = TSESTree.NewExpression;
 
-export const toolbar = {
-  create(context: Context) {
+export const toolbar: RuleCreator = {
+  create(context) {
     const sourceCode = context.sourceCode;
     return {
-      getEvent(event: Node): string |
-          null {
-            switch (sourceCode.getText(event)) {
-              case 'UI.Toolbar.ToolbarInput.Event.TEXT_CHANGED':
-                return 'change';
-              case 'UI.Toolbar.ToolbarInput.Event.ENTER_PRESSED':
-                return 'submit';
-              case 'UI.Toolbar.ToolbarButton.Events.CLICK':
-                return 'click';
-              default:
-                return null;
-            }
-          },
-      methodCall(property: Node, firstArg: Node, _secondArg: Node, domFragment: DomFragment, _call: Node): boolean {
+      getEvent(event) {
+        switch (sourceCode.getText(event)) {
+          case 'UI.Toolbar.ToolbarInput.Event.TEXT_CHANGED':
+            return 'change';
+          case 'UI.Toolbar.ToolbarInput.Event.ENTER_PRESSED':
+            return 'submit';
+          case 'UI.Toolbar.ToolbarButton.Events.CLICK':
+            return 'click';
+          default:
+            return null;
+        }
+      },
+      methodCall(property, firstArg, _secondArg, domFragment) {
         if (isIdentifier(property, 'appendToolbarItem')) {
           domFragment.appendChild(firstArg, sourceCode);
           return true;
         }
         return false;
       },
-      NewExpression(node: NewExpression) {
+      NewExpression(node) {
         const toolbarItem =
             isMemberExpression(node.callee, n => isIdentifierChain(n, ['UI', 'Toolbar']), n => n.type === 'Identifier');
         if (!toolbarItem) {
diff --git a/scripts/eslint_rules/lib/no-imperative-dom-api/ui-fragment.ts b/scripts/eslint_rules/lib/no-imperative-dom-api/ui-fragment.ts
index 166a590..a3c9964 100644
--- a/scripts/eslint_rules/lib/no-imperative-dom-api/ui-fragment.ts
+++ b/scripts/eslint_rules/lib/no-imperative-dom-api/ui-fragment.ts
@@ -5,19 +5,14 @@
  * @fileoverview A library to identify and templatize UI.Fragment and related calls.
  */
 
-import type {TSESTree} from '@typescript-eslint/utils';
-
-import {type Context, isIdentifier, isIdentifierChain} from './ast.ts';
+import {isIdentifier, isIdentifierChain, type RuleCreator} from './ast.ts';
 import {DomFragment} from './dom-fragment.ts';
 
-type CallExpression = TSESTree.CallExpression;
-type MemberExpression = TSESTree.MemberExpression;
-
-export const uiFragment = {
-  create(context: Context) {
+export const uiFragment: RuleCreator = {
+  create(context) {
     const sourceCode = context.sourceCode;
     return {
-      MemberExpression(node: MemberExpression) {
+      MemberExpression(node) {
         if (isIdentifierChain(node, ['UI', 'Fragment', 'Fragment', 'build']) &&
             node.parent?.type === 'TaggedTemplateExpression') {
           const domFragment = DomFragment.getOrCreate(node.parent, sourceCode);
@@ -25,11 +20,11 @@
               sourceCode.getText(node.parent.quasi)
                   .replace(
                       /\$=["']([^"']*)["']/g,
-                      (_, id) =>
+                      (_, id: string) =>
                           `\${ref(e => { output.${id.replace(/-[a-z]/g, c => c.substr(1).toUpperCase())} = e; })}`);
         }
       },
-      CallExpression(node: CallExpression) {
+      CallExpression(node) {
         if (node.callee.type !== 'MemberExpression' || !isIdentifier(node.callee.property, ['element', '$'])) {
           return;
         }
diff --git a/scripts/eslint_rules/lib/no-imperative-dom-api/ui-utils.ts b/scripts/eslint_rules/lib/no-imperative-dom-api/ui-utils.ts
index 0b8b850..290f2a8 100644
--- a/scripts/eslint_rules/lib/no-imperative-dom-api/ui-utils.ts
+++ b/scripts/eslint_rules/lib/no-imperative-dom-api/ui-utils.ts
@@ -7,18 +7,17 @@
 
 import type {TSESTree} from '@typescript-eslint/utils';
 
-import {type Context, isIdentifier, isIdentifierChain, isMemberExpression} from './ast.ts';
+import {isIdentifier, isIdentifierChain, isMemberExpression, type RuleCreator} from './ast.ts';
 import {DomFragment} from './dom-fragment.ts';
 
-type CallExpression = TSESTree.CallExpression;
 type Node = TSESTree.Node;
 
-export const uiUtils = {
-  create(context: Context) {
+export const uiUtils: RuleCreator = {
+  create(context) {
     const sourceCode = context.sourceCode;
 
     return {
-      CallExpression(node: CallExpression) {
+      CallExpression(node) {
         let func = isMemberExpression(
             node.callee, n => isIdentifierChain(n, ['UI', 'UIUtils', 'CheckboxLabel']),
             n => isIdentifier(n, ['create', 'createWithStringLiteral']));
@@ -179,7 +178,7 @@
           }
         }
       },
-      functionCall(call: CallExpression, _firstArg: Node, secondArg: Node, domFragment: DomFragment): boolean {
+      functionCall(call, _firstArg, secondArg, domFragment) {
         if (isIdentifierChain(call.callee, ['UI', 'SettingsUI', 'bindCheckbox'])) {
           let setting = secondArg;
           if (setting.type === 'CallExpression' &&
diff --git a/scripts/eslint_rules/lib/no-imperative-dom-api/widget.ts b/scripts/eslint_rules/lib/no-imperative-dom-api/widget.ts
index 8691cb9..eadae51 100644
--- a/scripts/eslint_rules/lib/no-imperative-dom-api/widget.ts
+++ b/scripts/eslint_rules/lib/no-imperative-dom-api/widget.ts
@@ -6,23 +6,19 @@
  */
 import type {TSESTree} from '@typescript-eslint/utils';
 
-import {type Context, isIdentifier, isIdentifierChain, isMemberExpression} from './ast.ts';
+import {isIdentifier, isIdentifierChain, isMemberExpression, type RuleCreator} from './ast.ts';
 import {ClassMember} from './class-member.ts';
 import {DomFragment} from './dom-fragment.ts';
 
 type Identifier = TSESTree.Identifier;
-type Node = TSESTree.Node;
-type CallExpression = TSESTree.CallExpression;
 type MemberExpression = TSESTree.MemberExpression;
-type AssignmentExpression = TSESTree.AssignmentExpression;
 
-export const widget = {
-  create: function(context: Context) {
+export const widget: RuleCreator = {
+  create: function(context) {
     const sourceCode = context.sourceCode;
+
     return {
-      methodCall(
-          property: Identifier, firstArg: Node, secondArg: Node|undefined, domFragment: DomFragment,
-          _call: CallExpression) {
+      methodCall(property, firstArg, secondArg, domFragment) {
         if (domFragment.tagName !== 'devtools-widget') {
           return false;
         }
@@ -35,8 +31,7 @@
         }
         return false;
       },
-      propertyAssignment(
-          property: Identifier, value: Node, domFragment: DomFragment, _assignment: AssignmentExpression) {
+      propertyAssignment(property, value, domFragment) {
         if (domFragment.tagName !== 'devtools-widget') {
           return false;
         }
@@ -48,7 +43,7 @@
         }
         return false;
       },
-      functionCall(call: CallExpression, _firstArg: Node, _secondArg: Node|undefined, domFragment: DomFragment) {
+      functionCall(call, _firstArg, _secondArg, domFragment) {
         if (isMemberExpression(call.callee, _ => true, n => isIdentifier(n, 'show'))) {
           let widget = (call.callee as MemberExpression).object;
           if (widget.type === 'CallExpression' &&