Skip to content

Commit

Permalink
chore(linting): enable @typescript-eslint/methd-signature-style for s…
Browse files Browse the repository at this point in the history
…afer types (#9690)

**Related Issue:** N/A

## Summary

Prevents method shorthand syntax to avoid potential pitfals described in
https://www.totaltypescript.com/method-shorthand-syntax-considered-harmful
  • Loading branch information
jcfranco authored Jun 26, 2024
1 parent f2f3c93 commit 8a1ab5c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/calcite-components/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ module.exports = {
],
},
],
"@typescript-eslint/method-signature-style": ["error", "property"],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "error",
curly: "error",
Expand Down
2 changes: 1 addition & 1 deletion packages/calcite-components/src/utils/floating-ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ export interface FloatingUIComponent {
*
* @param delayed – (internal) when true, it will reposition the component after a delay. the default is false. This is useful for components that have multiple watched properties that schedule repositioning.
*/
reposition(delayed?: boolean): Promise<void>;
reposition: (delayed?: boolean) => Promise<void>;

/**
* Used to store the effective floating layout for components that use arrows.
Expand Down
4 changes: 2 additions & 2 deletions packages/calcite-components/src/utils/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@ export interface FormComponent<T = any> extends FormOwner {
/**
* Hook for components to provide custom form reset behavior.
*/
onFormReset?(): void;
onFormReset?: () => void;

/**
* Hook for components to sync _extra_ props on the hidden input form element used for form-submitting.
*
* Note: The following props are set by default: disabled, hidden, name, required, value.
*/
syncHiddenFormInput?(input: HTMLInputElement): void;
syncHiddenFormInput?: (input: HTMLInputElement) => void;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/calcite-components/src/utils/observers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Build } from "@stencil/core";

export interface ExtendedMutationObserver extends MutationObserver {
new: () => ExtendedMutationObserver;
unobserve(target: Node): void;
unobserve: (target: Node) => void;
}

declare const ExtendedMutationObserver: {
Expand Down
2 changes: 1 addition & 1 deletion packages/calcite-components/src/utils/t9n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export interface T9nComponent extends LocalizedComponent {
* \/* wired up by t9n util *\/
* }
*/
onMessagesChange(): void;
onMessagesChange: () => void;
}

function defaultOnMessagesChange(this: T9nComponent): void {
Expand Down

0 comments on commit 8a1ab5c

Please sign in to comment.