superglue icon indicating copy to clipboard operation
superglue copied to clipboard

Add type annotations to `lib/utils/ujs.ts`

Open jho406 opened this issue 1 year ago • 1 comments

Context

Continuing on with the conversion to Typescript, lib/utils/ujs creates the handlers for UJS attributes

Issue

HandlerBuilder is a regular class, we'll need to convert this to typescript and remove the npm run lint warnings:

    4:27  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
    5:17  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
    6:18  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
    8:15  warning  Object pattern argument should be typed   @typescript-eslint/explicit-module-boundary-types
   20:3   warning  Missing return type on function           @typescript-eslint/explicit-module-boundary-types
   20:16  warning  Argument 'target' should be typed         @typescript-eslint/explicit-module-boundary-types
   34:3   warning  Missing return type on function           @typescript-eslint/explicit-module-boundary-types
   34:22  warning  Argument 'event' should be typed          @typescript-eslint/explicit-module-boundary-types
   44:3   warning  Missing return type on function           @typescript-eslint/explicit-module-boundary-types
   44:9   warning  Argument 'node' should be typed           @typescript-eslint/explicit-module-boundary-types
   55:3   warning  Missing return type on function           @typescript-eslint/explicit-module-boundary-types
   55:16  warning  Argument 'event' should be typed          @typescript-eslint/explicit-module-boundary-types
   79:3   warning  Missing return type on function           @typescript-eslint/explicit-module-boundary-types
   79:15  warning  Argument 'event' should be typed          @typescript-eslint/explicit-module-boundary-types
   93:3   warning  Missing return type on function           @typescript-eslint/explicit-module-boundary-types
   93:17  warning  Argument 'linkOrForm' should be typed     @typescript-eslint/explicit-module-boundary-types
   93:29  warning  Argument 'url' should be typed            @typescript-eslint/explicit-module-boundary-types
   93:40  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  117:3   warning  Missing return type on function           @typescript-eslint/explicit-module-boundary-types
  125:28  warning  Missing return type on function           @typescript-eslint/explicit-module-boundary-types
  125:29  warning  Object pattern argument should be typed   @typescript-eslint/explicit-module-boundary-types

Note that the export at the bottom of that page:

export const ujsHandlers = ({
 ...

Doesn't actually need the parameters navigatorRef, store at all. As part of the work, go ahead and remove those two parameters too.

jho406 avatar Jun 22 '24 20:06 jho406

Picking this up.

jho406 avatar Jun 29 '24 19:06 jho406