Enable method signature style ESLint rule (#3849)

* Remove redundant rules handled by prettier

* Turn on method-signature-style

* Auto-lint files according to method-signature-style rule

* Add changeset
This commit is contained in:
Michał Droń 2023-07-05 11:19:58 +02:00 committed by GitHub
parent 72d4df482e
commit 8d16513eab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
52 changed files with 114 additions and 112 deletions

View file

@ -0,0 +1,5 @@
---
"saleor-dashboard": patch
---
Enable method signature style ESLint rule

View file

@ -64,9 +64,6 @@
// These rules should be reviewed - tracked in
// Tracked in https://github.com/saleor/saleor-dashboard/issues/3813
"@typescript-eslint/consistent-type-imports": "off",
"@typescript-eslint/indent": "off",
"@typescript-eslint/member-delimiter-style": "off",
"@typescript-eslint/method-signature-style": "off",
"@typescript-eslint/no-confusing-void-expression": "off",
"@typescript-eslint/no-unnecessary-type-assertion": "off",
"@typescript-eslint/prefer-reduce-type-parameter": "off",

View file

@ -22,7 +22,7 @@ interface Props {
refetch?: () => void;
dashboardVersion: string;
coreVersion?: string;
onError?(): void;
onError?: () => void;
}
const getOrigin = (url: string) => new URL(url).origin;

View file

@ -10,8 +10,8 @@ const messages = AppPermissionsDialogMessages.confirmation;
interface Props {
removedPermissions: PermissionEnum[];
addedPermissions: PermissionEnum[];
onBack(): void;
onApprove(): void;
onBack: () => void;
onApprove: () => void;
}
export const AppPermissionsDialogConfirmation = ({

View file

@ -10,9 +10,9 @@ const messages = AppPermissionsDialogMessages.permissionsPicker;
interface AppPermissionsDialogPermissionPickerProps {
allPermissions: AppPermission[];
selected: PermissionEnum[];
onSubmit(): void;
onChange(codes: PermissionEnum[]): void;
onClose(): void;
onSubmit: () => void;
onChange: (codes: PermissionEnum[]) => void;
onClose: () => void;
}
/**

View file

@ -9,7 +9,7 @@ import { messages } from "./messages";
import { useStyles } from "./styles";
interface InstallWithManifestFormButtonProps {
onSubmitted(manifestUrl: string): void;
onSubmitted: (manifestUrl: string) => void;
}
export const InstallWithManifestFormButton: React.FC<

View file

@ -21,11 +21,11 @@ export interface Extension {
label: string;
mount: AppExtensionMountEnum;
url: string;
open(): void;
open: () => void;
}
export interface ExtensionWithParams extends Omit<Extension, "open"> {
open(params: AppDetailsUrlMountQueryParams): void;
open: (params: AppDetailsUrlMountQueryParams) => void;
}
export const extensionMountPoints = {

View file

@ -20,7 +20,7 @@ export interface CategoryCreatePageProps {
disabled: boolean;
saveButtonBarState: ConfirmButtonTransitionState;
backUrl: string;
onSubmit(data: CategoryCreateData);
onSubmit: (data: CategoryCreateData) => any;
}
export const CategoryCreatePage: React.FC<CategoryCreatePageProps> = ({

View file

@ -31,8 +31,8 @@ const useStyles = makeStyles(
export interface CategoryDeleteDialogProps {
open: boolean;
name: string;
onClose();
onConfirm();
onClose: () => any;
onConfirm: () => any;
}
const CategoryDeleteDialog: React.FC<CategoryDeleteDialogProps> = props => {

View file

@ -45,8 +45,8 @@ export interface CategoryUpdatePageProps {
onProductsDelete: () => void;
onSelectProductsIds: (ids: number[], clearSelection: () => void) => void;
onSelectCategoriesIds: (ids: number[], clearSelection: () => void) => void;
onImageUpload(file: File);
onDelete();
onImageUpload: (file: File) => any;
onDelete: () => any;
}
const CategoriesTab = Tab(CategoryPageTab.categories);

View file

@ -16,7 +16,7 @@ export interface ActionDialogProps extends DialogProps {
title: string;
variant?: ActionDialogVariant;
backButtonText?: string;
onConfirm();
onConfirm: () => any;
}
const ActionDialog: React.FC<ActionDialogProps> = props => {

View file

@ -18,7 +18,7 @@ interface DialogButtonsProps {
children?: React.ReactNode;
showBackButton?: boolean;
backButtonText?: string;
onConfirm();
onConfirm: () => any;
}
const DialogButtons: React.FC<DialogButtonsProps> = props => {

View file

@ -32,8 +32,8 @@ interface AddressEditProps {
data: AddressTypeInput;
disabled?: boolean;
errors: Array<AccountErrorFragment | OrderErrorFragment>;
onChange(event: React.ChangeEvent<any>);
onCountryChange(event: React.ChangeEvent<any>);
onChange: (event: React.ChangeEvent<any>) => any;
onCountryChange: (event: React.ChangeEvent<any>) => any;
}
const PossibleFormFields = {

View file

@ -18,7 +18,7 @@ import { useStyles } from "./styles";
interface Option {
label: string;
disabled?: boolean;
onSelect(e: React.MouseEvent<HTMLLIElement, MouseEvent>): void;
onSelect: (e: React.MouseEvent<HTMLLIElement, MouseEvent>) => void;
}
export interface ButtonWithSelectProps

View file

@ -11,7 +11,7 @@ export interface ControlledCheckboxProps {
disabled?: boolean;
checkedIcon?: React.ReactNode;
testId?: string;
onChange(event: any);
onChange: (event: any) => any;
}
export const ControlledCheckbox: React.FC<ControlledCheckboxProps> = ({

View file

@ -20,7 +20,7 @@ interface ControlledSwitchProps {
name: string;
secondLabel?: string | React.ReactNode;
uncheckedLabel?: string | React.ReactNode;
onChange?(event: React.ChangeEvent<any>);
onChange?: (event: React.ChangeEvent<any>) => any;
}
export const ControlledSwitch: React.FC<ControlledSwitchProps> = props => {

View file

@ -50,7 +50,7 @@ interface EditableTableCellProps {
focused?: boolean;
InputProps?: TextFieldProps;
value: string;
onConfirm(value: string): any;
onConfirm: (value: string) => any;
}
export const EditableTableCell: React.FC<EditableTableCellProps> = props => {

View file

@ -6,7 +6,7 @@ import React from "react";
import { useIntl } from "react-intl";
export interface FilterCardProps {
handleClear();
handleClear: () => any;
}
const FilterCard: React.FC<FilterCardProps> = ({ children, handleClear }) => {

View file

@ -44,7 +44,7 @@ interface MultiSelectFieldProps {
name?: string;
selectProps?: SelectProps;
value?: string[];
onChange(event: any);
onChange: (event: any) => any;
}
export const MultiSelectField: React.FC<MultiSelectFieldProps> = props => {

View file

@ -21,7 +21,7 @@ interface PhoneFieldProps {
number: string;
prefixes: string[];
label?: string;
onChange(event: React.ChangeEvent<any>);
onChange: (event: React.ChangeEvent<any>) => any;
}
const PhoneField: React.FC<PhoneFieldProps> = props => {

View file

@ -43,7 +43,7 @@ export interface PriceFieldProps {
inputProps?: InputProps["inputProps"];
InputLabelProps?: InputLabelProps;
required?: boolean;
onChange(event: any);
onChange: (event: any) => any;
}
export const PriceField: React.FC<PriceFieldProps> = props => {

View file

@ -34,7 +34,7 @@ interface RowNumberSelectProps {
choices: number[];
className?: string;
rowNumber: number;
onChange(value: number);
onChange: (value: number) => any;
}
const RowNumberSelect: React.FC<RowNumberSelectProps> = ({

View file

@ -54,8 +54,8 @@ interface SeoFormProps {
slug: string;
slugPlaceholder?: string;
titlePlaceholder: string;
onChange(event: any);
onClick?();
onChange: (event: any) => any;
onClick?: () => any;
}
export const SeoForm: React.FC<SeoFormProps> = props => {

View file

@ -60,7 +60,7 @@ interface SingleSelectFieldProps {
placeholder?: string;
value?: string;
InputProps?: OutlinedInputProps;
onChange(event: any);
onChange: (event: any) => any;
}
export const SingleSelectField: React.FC<SingleSelectFieldProps> = props => {

View file

@ -58,8 +58,8 @@ export interface TablePaginationActionsProps {
hasNextPage: boolean;
hasPreviousPage: boolean;
nextIconButtonProps?: any;
onNextPage(event);
onPreviousPage(event);
onNextPage: (event) => any;
onPreviousPage: (event) => any;
}
export const TablePaginationActions: React.FC<

View file

@ -67,8 +67,8 @@ interface TimelineAddNoteProps {
disabled?: boolean;
message: string;
reset: () => void;
onChange(event: React.ChangeEvent<any>);
onSubmit(event: React.FormEvent<any>);
onChange: (event: React.ChangeEvent<any>) => any;
onSubmit: (event: React.FormEvent<any>) => any;
}
export const Timeline: React.FC<TimelineProps> = props => {

View file

@ -26,8 +26,8 @@ export interface CustomerCreateAddressProps {
data: AddressTypeInput;
disabled: boolean;
errors: AccountErrorFragment[];
onChange(event: React.ChangeEvent<any>);
onCountryChange(event: React.ChangeEvent<any>);
onChange: (event: React.ChangeEvent<any>) => any;
onCountryChange: (event: React.ChangeEvent<any>) => any;
}
const CustomerCreateAddress: React.FC<CustomerCreateAddressProps> = props => {

View file

@ -1,9 +1,9 @@
import { FlagList } from "./availableFlags";
export interface Strategy {
fetchAll(): Promise<FlagList>;
fetchAll: () => Promise<FlagList>;
}
export interface PersistableStrategy extends Strategy {
store?(flags: FlagList): Promise<void>;
store?: (flags: FlagList) => Promise<void>;
}

View file

@ -44,7 +44,7 @@ export interface OrderChangeWarehouseDialogProps {
line: OrderFulfillLineFragment;
currentWarehouseId: string;
onConfirm: (warehouse: WarehouseFragment) => void;
onClose();
onClose: () => any;
}
export const OrderChangeWarehouseDialog: React.FC<

View file

@ -64,10 +64,10 @@ export interface OrderCustomerAddressesEditDialogProps {
customerAddresses?: AddressFragment[];
defaultShippingAddress?: Node;
defaultBillingAddress?: Node;
onClose();
onConfirm(
onClose: () => any;
onConfirm: (
data: Partial<OrderCustomerAddressesEditDialogOutput>,
): SubmitPromise<any[]>;
) => SubmitPromise<any[]>;
}
const defaultSearchState: OrderCustomerSearchAddressState = {

View file

@ -35,7 +35,7 @@ export interface OrderCustomerAddressesSearchProps {
customerAddresses: AddressFragment[];
onChangeCustomerShippingAddress: (customerAddress: AddressFragment) => void;
onChangeCustomerBillingAddress: (customerAddress: AddressFragment) => void;
exitSearch();
exitSearch: () => any;
}
const OrderCustomerAddressesSearch: React.FC<

View file

@ -25,7 +25,7 @@ import { useStyles } from "./styles";
export interface OrderCustomerChangeDialogProps {
open: boolean;
onConfirm: (data: OrderCustomerChangeData) => void;
onClose();
onClose: () => any;
}
const OrderCustomerChangeDialog: React.FC<

View file

@ -64,27 +64,27 @@ export interface OrderDetailsPageProps {
) => void;
onOrderLineRemove?: (id: string) => void;
onShippingMethodEdit?: () => void;
onBillingAddressEdit();
onFulfillmentApprove(id: string);
onFulfillmentCancel(id: string);
onFulfillmentTrackingNumberUpdate(id: string);
onOrderFulfill();
onProductClick?(id: string);
onPaymentCapture();
onMarkAsPaid();
onPaymentRefund();
onPaymentVoid();
onShippingAddressEdit();
onOrderCancel();
onNoteAdd(data: HistoryFormData);
onProfileView();
onOrderReturn();
onInvoiceClick(invoiceId: string);
onInvoiceGenerate();
onInvoiceSend(invoiceId: string);
onTransactionAction(transactionId: string, actionType: TransactionActionEnum);
onAddManualTransaction();
onSubmit(data: MetadataIdSchema): SubmitPromise;
onBillingAddressEdit: () => any;
onFulfillmentApprove: (id: string) => any;
onFulfillmentCancel: (id: string) => any;
onFulfillmentTrackingNumberUpdate: (id: string) => any;
onOrderFulfill: () => any;
onProductClick?: (id: string) => any;
onPaymentCapture: () => any;
onMarkAsPaid: () => any;
onPaymentRefund: () => any;
onPaymentVoid: () => any;
onShippingAddressEdit: () => any;
onOrderCancel: () => any;
onNoteAdd: (data: HistoryFormData) => any;
onProfileView: () => any;
onOrderReturn: () => any;
onInvoiceClick: (invoiceId: string) => any;
onInvoiceGenerate: () => any;
onInvoiceSend: (invoiceId: string) => any;
onTransactionAction: (transactionId: string, actionType: TransactionActionEnum) => any;
onAddManualTransaction: () => any;
onSubmit: (data: MetadataIdSchema) => SubmitPromise;
}
const OrderDetailsPage: React.FC<OrderDetailsPageProps> = props => {

View file

@ -27,8 +27,8 @@ export interface OrderFulfillStockExceededDialogProps {
open: boolean;
formsetData: OrderFulfillStockFormsetData;
confirmButtonState: ConfirmButtonTransitionState;
onSubmit();
onClose();
onSubmit: () => any;
onClose: () => any;
}
const OrderFulfillStockExceededDialog: React.FC<

View file

@ -17,8 +17,8 @@ interface AcionButtonsProps {
orderIsPaid?: boolean;
fulfillmentAllowUnpaid: boolean;
hasTransactions: boolean;
onTrackingCodeAdd();
onApprove();
onTrackingCodeAdd: () => any;
onApprove: () => any;
}
const statusesToShow = [

View file

@ -29,8 +29,8 @@ export interface OrderFulfillmentAcceptDialogProps {
confirmButtonState: ConfirmButtonTransitionState;
errors: OrderErrorFragment[];
open: boolean;
onClose(): void;
onConfirm(data: OrderFulfillmentAcceptDialogFormData): void;
onClose: () => void;
onConfirm: (data: OrderFulfillmentAcceptDialogFormData) => void;
}
const OrderFulfillmentAcceptDialog: React.FC<

View file

@ -46,8 +46,8 @@ export interface OrderFulfillmentCancelDialogProps {
errors: OrderErrorFragment[];
open: boolean;
warehouses: WarehouseFragment[];
onClose();
onConfirm(data: OrderFulfillmentCancelDialogFormData);
onClose: () => any;
onConfirm: (data: OrderFulfillmentCancelDialogFormData) => any;
}
const OrderFulfillmentCancelDialog: React.FC<

View file

@ -31,8 +31,8 @@ export interface OrderFulfillmentTrackingDialogProps {
errors: OrderErrorFragment[];
open: boolean;
trackingNumber: string;
onClose();
onConfirm(data: FormData);
onClose: () => any;
onConfirm: (data: FormData) => any;
}
const OrderFulfillmentTrackingDialog: React.FC<

View file

@ -14,12 +14,12 @@ import { OrderTransactionsWrapper } from "./OrderTransactionsWrapper";
export interface OrderPaymentOrTransactionProps {
order: OrderDetailsFragment;
shop: OrderDetailsQuery["shop"];
onTransactionAction(transactionId: string, actionType: TransactionActionEnum);
onPaymentCapture();
onPaymentVoid();
onPaymentRefund();
onMarkAsPaid();
onAddManualTransaction();
onTransactionAction: (transactionId: string, actionType: TransactionActionEnum) => any;
onPaymentCapture: () => any;
onPaymentVoid: () => any;
onPaymentRefund: () => any;
onMarkAsPaid: () => any;
onAddManualTransaction: () => any;
}
export const OrderPaymentOrTransaction: React.FC<

View file

@ -20,11 +20,11 @@ import { getFilteredPayments } from "./utils";
interface OrderTransactionsWrapper {
order: OrderDetailsFragment;
shop: OrderDetailsQuery["shop"];
onTransactionAction(transactionId: string, actionType: TransactionActionEnum);
onPaymentCapture();
onMarkAsPaid();
onPaymentVoid();
onAddManualTransaction();
onTransactionAction: (transactionId: string, actionType: TransactionActionEnum) => any;
onPaymentCapture: () => any;
onMarkAsPaid: () => any;
onPaymentVoid: () => any;
onAddManualTransaction: () => any;
}
export const OrderTransactionsWrapper: React.FC<OrderTransactionsWrapper> = ({

View file

@ -22,8 +22,8 @@ export interface OrderPaymentVoidDialogProps {
confirmButtonState: ConfirmButtonTransitionState;
errors: OrderErrorFragment[];
open: boolean;
onClose?();
onConfirm?();
onClose?: () => any;
onConfirm?: () => any;
}
const OrderPaymentVoidDialog: React.FC<OrderPaymentVoidDialogProps> = ({

View file

@ -103,7 +103,7 @@ interface OrderReturnRefundLinesCardProps {
itemsSelections: FormsetReplacementData;
itemsQuantities: FormsetQuantityData;
onChangeSelected: FormsetChange<boolean>;
onSetMaxQuantity();
onSetMaxQuantity: () => any;
}
const ItemsCard: React.FC<OrderReturnRefundLinesCardProps> = ({

View file

@ -44,7 +44,7 @@ interface OrderReturnRefundLinesCardProps {
itemsSelections: FormsetReplacementData;
itemsQuantities: FormsetQuantityData;
onChangeSelected: FormsetChange<boolean>;
onSetMaxQuantity();
onSetMaxQuantity: () => any;
}
export const ItemsCard: React.FC<OrderReturnRefundLinesCardProps> = ({

View file

@ -66,8 +66,8 @@ export interface OrderShippingMethodEditDialogProps {
open: boolean;
shippingMethod: string;
shippingMethods?: OrderDetailsFragment["shippingMethods"];
onClose();
onSubmit?(data: FormData);
onClose: () => any;
onSubmit?: (data: FormData) => any;
}
const OrderShippingMethodEditDialog: React.FC<

View file

@ -95,7 +95,7 @@ interface ProductCreatePageProps {
onAttributeSelectBlur: () => void;
onCloseDialog: (currentParams?: ProductCreateUrlQueryParams) => void;
onSelectProductType: (productTypeId: string) => void;
onSubmit?(data: ProductCreateData);
onSubmit?: (data: ProductCreateData) => any;
}
export const ProductCreatePage: React.FC<ProductCreatePageProps> = ({

View file

@ -20,7 +20,7 @@ interface ProductDetailsFormProps {
disabled?: boolean;
errors: ProductErrorFragment[];
onChange(event: any);
onChange: (event: any) => any;
}
export const ProductDetailsForm: React.FC<ProductDetailsFormProps> = ({

View file

@ -71,8 +71,8 @@ interface ProductMediaProps {
getImageEditUrl: (id: string) => string;
onImageDelete: (id: string) => () => void;
onImageReorder?: ReorderAction;
onImageUpload(file: File);
openMediaUrlModal();
onImageUpload: (file: File) => any;
openMediaUrlModal: () => any;
}
const ProductMedia: React.FC<ProductMediaProps> = props => {

View file

@ -113,11 +113,11 @@ export interface ProductUpdatePageProps {
onSubmit: (data: ProductUpdateSubmitData) => SubmitPromise;
onVariantShow: (id: string) => void;
onAttributeSelectBlur: () => void;
onDelete();
onImageReorder?(event: { oldIndex: number; newIndex: number });
onImageUpload(file: File);
onMediaUrlUpload(mediaUrl: string);
onSeoClick?();
onDelete: () => any;
onImageReorder?: (event: { oldIndex: number; newIndex: number }) => any;
onImageUpload: (file: File) => any;
onMediaUrlUpload: (mediaUrl: string) => any;
onSeoClick?: () => any;
}
export const ProductUpdatePage: React.FC<ProductUpdatePageProps> = ({

View file

@ -32,8 +32,8 @@ export interface ProductVariantDeleteDialogProps {
confirmButtonState: ConfirmButtonTransitionState;
open: boolean;
name: string;
onClose?();
onConfirm?();
onClose?: () => any;
onConfirm?: () => any;
}
const ProductVariantDeleteDialog: React.FC<

View file

@ -62,7 +62,7 @@ interface ProductVariantMediaProps {
media?: ProductMediaFragment[];
placeholderImage?: string;
disabled: boolean;
onImageAdd();
onImageAdd: () => any;
}
export const ProductVariantMedia: React.FC<

View file

@ -118,10 +118,10 @@ interface ProductVariantPageProps {
variantDeactivatePreoderButtonState: ConfirmButtonTransitionState;
onVariantReorder: ReorderAction;
onAttributeSelectBlur: () => void;
onDelete();
onSubmit(data: ProductVariantUpdateSubmitData);
onSetDefaultVariant();
onWarehouseConfigure();
onDelete: () => any;
onSubmit: (data: ProductVariantUpdateSubmitData) => any;
onSetDefaultVariant: () => any;
onWarehouseConfigure: () => any;
}
const ProductVariantPage: React.FC<ProductVariantPageProps> = ({

View file

@ -59,7 +59,7 @@ export interface StaffDetailsPageProps extends SearchPageProps {
onDelete: () => void;
onImageDelete: () => void;
onSubmit: (data: StaffDetailsFormData) => SubmitPromise;
onImageUpload(file: File);
onImageUpload: (file: File) => any;
}
const StaffDetailsPage: React.FC<StaffDetailsPageProps> = ({