Skip to content

Commit

Permalink
add eslint disable for existing callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
YuanboXue-Amber committed Jan 12, 2024
1 parent e0e2695 commit 97d74ec
Show file tree
Hide file tree
Showing 29 changed files with 44 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export type AccordionProps<Value = AccordionItemValue> = ComponentProps<Accordio
/**
* Callback to be called when the opened items change.
*/
// eslint-disable-next-line @fluentui/consistent-callback-type
onToggle?: AccordionToggleEventHandler<Value>;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export type CardProps = ComponentProps<CardSlots> & {
/**
* Callback to be called when the selected state value changes.
*/
// eslint-disable-next-line @fluentui/consistent-callback-type
onSelectionChange?: (event: CardOnSelectionChangeEvent, data: CardOnSelectData) => void;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export type CheckboxProps = Omit<
/**
* Callback to be called when the checked state value changes.
*/
// eslint-disable-next-line @fluentui/consistent-callback-type
onChange?: (ev: React.ChangeEvent<HTMLInputElement>, data: CheckboxOnChangeData) => void;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export type DatePickerProps = Omit<ComponentProps<Partial<DatePickerSlots>>, 'de
/**
* Callback issued when a date is selected
*/
// eslint-disable-next-line @fluentui/consistent-callback-type
onSelectDate?: (date: Date | null | undefined) => void;

/**
Expand Down Expand Up @@ -84,11 +85,13 @@ export type DatePickerProps = Omit<ComponentProps<Partial<DatePickerSlots>>, 'de
/**
* Callback to run when the DatePicker's open state changes
*/
// eslint-disable-next-line @fluentui/consistent-callback-type
onOpenChange?: (open: boolean) => void;

/**
* Callback to run after the DatePicker's input has been validated
*/
// eslint-disable-next-line @fluentui/consistent-callback-type
onValidationResult?: (data: DatePickerValidationResultData) => void;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export type DialogProps = ComponentProps<Partial<DialogSlots>> & {
* @param data - A data object with relevant information,
* such as open value and type of interaction that created the event
*/
// eslint-disable-next-line @fluentui/consistent-callback-type
onOpenChange?: DialogOpenChangeEventHandler;
/**
* Can contain two children including {@link DialogTrigger} and {@link DialogSurface}.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
import type { ComponentProps, ComponentState, EventData, EventHandler, Slot } from '@fluentui/react-utilities';

export type InputSlots = {
/**
Expand Down Expand Up @@ -27,6 +27,8 @@ export type InputSlots = {
contentAfter?: Slot<'span'>;
};

type OnOpenChangeData = EventData<'click', React.MouseEvent<HTMLInputElement>>;

export type InputProps = Omit<
ComponentProps<Partial<InputSlots>, 'input'>,
// `children` is unsupported. The rest of these native props have customized definitions.
Expand Down Expand Up @@ -77,8 +79,11 @@ export type InputProps = Omit<
/**
* Called when the user changes the input's value.
*/
// eslint-disable-next-line @fluentui/consistent-callback-type
onChange?: (ev: React.ChangeEvent<HTMLInputElement>, data: InputOnChangeData) => void;

onChange2?: EventHandler<OnOpenChangeData>;

/**
* An input can have different text-based [types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input#input_types)
* based on the type of value the user will enter.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export type MenuProps = ComponentProps<MenuSlots> &
* Call back when the component requests to change value
* The `open` value is used as a hint when directly controlling the component
*/
// eslint-disable-next-line @fluentui/consistent-callback-type
onOpenChange?: (e: MenuOpenEvent, data: MenuOpenChangeData) => void;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export type MenuListProps = ComponentProps<MenuListSlots> & {
* @param event - React's original SyntheticEvent
* @param data - A data object with relevant information
*/
// eslint-disable-next-line @fluentui/consistent-callback-type
onCheckedValueChange?: (e: MenuCheckedValueChangeEvent, data: MenuCheckedValueChangeData) => void;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@ export type MenuTriggerChildProps<Type extends ARIAButtonType = ARIAButtonType,
'aria-expanded'?: boolean;
id: string;
ref: React.Ref<never>;
// eslint-disable-next-line @fluentui/consistent-callback-type
onMouseEnter: React.MouseEventHandler<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>;
// eslint-disable-next-line @fluentui/consistent-callback-type
onMouseLeave: React.MouseEventHandler<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>;
// eslint-disable-next-line @fluentui/consistent-callback-type
onMouseMove: React.MouseEventHandler<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>;
// eslint-disable-next-line @fluentui/consistent-callback-type
onContextMenu: React.MouseEventHandler<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>;
}
>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export type ListProps = ComponentProps<ListSlots> & {
/**
* Callback for selection change events, used for both controlled and uncontrolled (as notification)
*/
// eslint-disable-next-line @fluentui/consistent-callback-type
onSelectionChange?: (event: React.SyntheticEvent, data: { selectedItems: SelectionItemId[] }) => void;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export type PopoverProps = Pick<PortalProps, 'mountNode'> & {
* Call back when the component requests to change value
* The `open` value is used as a hint when directly controlling the component
*/
// eslint-disable-next-line @fluentui/consistent-callback-type
onOpenChange?: (e: OpenPopoverEvents, data: OnOpenChangeData) => void;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ export type PopoverTriggerChildProps<Type extends ARIAButtonType = ARIAButtonTyp
Props & {
'aria-expanded'?: 'true' | 'false';
ref: React.Ref<unknown>;
// eslint-disable-next-line @fluentui/consistent-callback-type
onMouseEnter: React.MouseEventHandler<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>;
// eslint-disable-next-line @fluentui/consistent-callback-type
onMouseLeave: React.MouseEventHandler<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>;
// eslint-disable-next-line @fluentui/consistent-callback-type
onContextMenu: React.MouseEventHandler<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>;
}
>;
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export type RadioProps = Omit<ComponentProps<Partial<RadioSlots>, 'input'>, 'onC
* **Note:** `onChange` is NOT called when this Radio is deselected.
* Use RadioGroup's `onChange` event to determine when the selection in the group changes.
*/
// eslint-disable-next-line @fluentui/consistent-callback-type
onChange?: (ev: React.ChangeEvent<HTMLInputElement>, data: RadioOnChangeData) => void;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export type RadioGroupProps = Omit<ComponentProps<Partial<RadioGroupSlots>>, 'on
/**
* Callback when the selected Radio item changes.
*/
// eslint-disable-next-line @fluentui/consistent-callback-type
onChange?: (ev: React.FormEvent<HTMLDivElement>, data: RadioGroupOnChangeData) => void;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export type RatingProps = ComponentProps<RatingSlots> & {
/**
* Callback when the rating value is changed by the user.
*/
// eslint-disable-next-line @fluentui/consistent-callback-type
onChange?: (ev: React.SyntheticEvent | Event, data: RatingOnChangeData) => void;
/**
* Sets the precision to allow half-filled shapes in Rating
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export type SelectProps = Omit<ComponentProps<Partial<SelectSlots>, 'select'>, '
/**
* Called when the user changes the select element's value by selecting an option.
*/
// eslint-disable-next-line @fluentui/consistent-callback-type
onChange?: (ev: React.ChangeEvent<HTMLSelectElement>, data: SelectOnChangeData) => void;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export type SliderProps = Omit<
/**
* Triggers a callback when the value has been changed. This will be called on every individual step.
*/
// eslint-disable-next-line @fluentui/consistent-callback-type
onChange?: (ev: React.ChangeEvent<HTMLInputElement>, data: SliderOnChangeData) => void;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export type SpinButtonProps = Omit<
* - User *commits* edits to the input text by focusing away (blurring) or pressing enter.
* Note that this is NOT called for every key press while the user is editing.
*/
// eslint-disable-next-line @fluentui/consistent-callback-type
onChange?: (event: SpinButtonChangeEvent, data: SpinButtonOnChangeData) => void;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export type SwitchProps = Omit<
/**
* Callback to be called when the checked state value changes.
*/
// eslint-disable-next-line @fluentui/consistent-callback-type
onChange?: (ev: React.ChangeEvent<HTMLInputElement>, data: SwitchOnChangeData) => void;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ export type DataGridProps = TableProps &
Pick<Partial<DataGridContextValue>, 'focusMode' | 'subtleSelection' | 'selectionAppearance' | 'resizableColumns'> &
Pick<UseTableSortOptions, 'sortState' | 'defaultSortState'> &
Pick<SelectionHookParams, 'defaultSelectedItems' | 'selectedItems'> & {
// eslint-disable-next-line @fluentui/consistent-callback-type
onSortChange?: (e: React.MouseEvent, sortState: SortState) => void;
// eslint-disable-next-line @fluentui/consistent-callback-type
onSelectionChange?: (e: React.MouseEvent | React.KeyboardEvent, data: OnSelectionChangeData) => void;
/**
* Enables row selection and sets the selection mode
Expand All @@ -78,6 +80,7 @@ export type DataGridProps = TableProps &
/**
* A callback triggered when a column is resized.
*/
// eslint-disable-next-line @fluentui/consistent-callback-type
onColumnResize?: (
e: KeyboardEvent | TouchEvent | MouseEvent | undefined,
data: { columnId: TableColumnId; width: number },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export type TabListProps = ComponentProps<TabListSlots> & {
/**
* Raised when a tab is selected.
*/
// eslint-disable-next-line @fluentui/consistent-callback-type
onTabSelect?: SelectTabEventHandler;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export type TagGroupProps<Value = TagValue> = ComponentProps<TagGroupSlots> & {
/**
* Callback for when a tag is dismissed
*/
// eslint-disable-next-line @fluentui/consistent-callback-type
onDismiss?: TagDismissHandler<Value>;

size?: TagSize;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ export type TeachingPopoverProps = Omit<PopoverProps, 'appearance'> & {
/**
* Callback to notify a page change (can be used to update 'currentPage' externally).
*/
// eslint-disable-next-line @fluentui/consistent-callback-type
onPageChange?: (
event: React.MouseEvent<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>,
data: TeachingPopoverPageChangeData,
) => void;
/**
* Callback to notify when the final button step of a carousel has been activated.
*/
// eslint-disable-next-line @fluentui/consistent-callback-type
onFinish?: (event: React.MouseEvent<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>) => void;
/**
* The appearance property (extended from popover, but removed 'inverted').
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export type TextareaProps = Omit<
/**
* Callback for when the user changes the value.
*/
// eslint-disable-next-line @fluentui/consistent-callback-type
onChange?: (ev: React.ChangeEvent<HTMLTextAreaElement>, data: TextareaOnChangeData) => void;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ export type TimePickerProps = Omit<ComponentProps<Partial<ComboboxSlots>, 'input
/**
* Callback for when a time selection is made.
*/
// eslint-disable-next-line @fluentui/consistent-callback-type
onTimeChange?: (event: TimeSelectionEvents, data: TimeSelectionData) => void;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export type ToolbarProps = ComponentProps<ToolbarSlots> & {
* @param event - React's original SyntheticEvent
* @param data - A data object with relevant information
*/
// eslint-disable-next-line @fluentui/consistent-callback-type
onCheckedValueChange?: (e: ToolbarCheckedValueChangeEvent, data: ToolbarCheckedValueChangeData) => void;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export type TooltipProps = ComponentProps<TooltipSlots> &
* **Note**: for backwards compatibility, `event` will be undefined if this was triggered by a keyboard event on
* the document element. Use `data.documentKeyboardEvent` if the keyboard event object is needed.
*/
// eslint-disable-next-line @fluentui/consistent-callback-type
onVisibleChange?: (
event: React.PointerEvent<HTMLElement> | React.FocusEvent<HTMLElement> | undefined,
data: OnVisibleChangeData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export type TreeItemProps = ComponentProps<Partial<TreeItemSlots>> & {
* NOTE: controlling the open state of a tree item will not affect the open state of its children
*/
open?: boolean;
// eslint-disable-next-line @fluentui/consistent-callback-type
onOpenChange?: (e: TreeItemOpenChangeEvent, data: TreeItemOpenChangeData) => void;
/**
* This property is inferred through context on a nested tree, and required for a flat tree.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export type VirtualizerConfigProps = {
/**
* Callback for notifying when a flagged index has been rendered
*/
// eslint-disable-next-line @fluentui/consistent-callback-type
onRenderedFlaggedIndex?: (index: number) => void;

/*
Expand Down

0 comments on commit 97d74ec

Please sign in to comment.