Skip to content

Commit

Permalink
style: ran prettier aftering upgrading to v2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mlaursen committed May 18, 2021
1 parent c02bfcf commit 3ce236a
Show file tree
Hide file tree
Showing 57 changed files with 400 additions and 547 deletions.
3 changes: 2 additions & 1 deletion changelog.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ const parserOpts = {
headerPattern: /^(\w*)(?:\((.*)\))?: (.*)$/,
headerCorrespondence: ['type', 'scope', 'subject'],
noteKeywords: ['BREAKING CHANGE'],
revertPattern: /^(?:Revert|revert:)\s"?([\s\S]+?)"?\s*This reverts commit (\w*)\./i,
revertPattern:
/^(?:Revert|revert:)\s"?([\s\S]+?)"?\s*This reverts commit (\w*)\./i,
revertCorrespondence: ['header', 'hash'],
};

Expand Down
11 changes: 6 additions & 5 deletions packages/alert/src/SnackbarQueue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,9 @@ function SnackbarQueueT<M extends ToastMessage = ToastMessage>(
);
}

export const SnackbarQueue = forwardRef<
HTMLDivElement,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
SnackbarQueueProps<any>
>(SnackbarQueueT);
export const SnackbarQueue =
forwardRef<
HTMLDivElement,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
SnackbarQueueProps<any>
>(SnackbarQueueT);
18 changes: 9 additions & 9 deletions packages/alert/src/__tests__/useMessageQueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,21 +109,21 @@ describe("handleAddMessage", () => {
message1,
message1,
]);
expect(
handleAddMessage([message1, message2], message1, "allow")
).toEqual([message1, message2, message1]);
expect(handleAddMessage([message1, message2], message1, "allow")).toEqual(
[message1, message2, message1]
);
});

it("should add all new messages to the end of the queue when duplicates are allowed", () => {
const message1: Message = {};
const message2: Message = { messageId: "message-2" };
const message3: Message = { messageId: "message-3" };
expect(
handleAddMessage([message1, message2], message3, "allow")
).toEqual([message1, message2, message3]);
expect(
handleAddMessage([message1, message2], message1, "allow")
).toEqual([message1, message2, message1]);
expect(handleAddMessage([message1, message2], message3, "allow")).toEqual(
[message1, message2, message3]
);
expect(handleAddMessage([message1, message2], message1, "allow")).toEqual(
[message1, message2, message1]
);
expect(handleAddMessage([message1], message1, "allow")).toEqual([
message1,
message1,
Expand Down
46 changes: 20 additions & 26 deletions packages/autocomplete/src/useAutoComplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,32 +418,26 @@ export function useAutoComplete({
onOutsideClick: hide,
});

const {
style,
onEnter,
onEntering,
onEntered,
onExited,
updateStyle,
} = useFixedPositioning({
fixedTo: () => ref.current,
anchor,
onScroll(_event, { visible }) {
if (closeOnScroll || !visible) {
hide();
}
},
onResize: closeOnResize ? hide : undefined,
width: listboxWidth,
xMargin,
yMargin,
vwMargin,
vhMargin,
transformOrigin,
preventOverlap,
disableSwapping,
disableVHBounds,
});
const { style, onEnter, onEntering, onEntered, onExited, updateStyle } =
useFixedPositioning({
fixedTo: () => ref.current,
anchor,
onScroll(_event, { visible }) {
if (closeOnScroll || !visible) {
hide();
}
},
onResize: closeOnResize ? hide : undefined,
width: listboxWidth,
xMargin,
yMargin,
vwMargin,
vhMargin,
transformOrigin,
preventOverlap,
disableSwapping,
disableVHBounds,
});

useEffect(() => {
if (!focused.current || autocompleted.current) {
Expand Down
6 changes: 4 additions & 2 deletions packages/dev-utils/src/indexer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,17 @@ export async function indexer(): Promise<void> {
const { tocs, metadata } = await generate(routes);
const meta = join(documentationRoot, src, "constants", "meta");
const tocsPath = join(meta, "tocs.ts");
const tocsContents = format(`${COPY_BANNER}import { TOCRecord } from "./types";
const tocsContents =
format(`${COPY_BANNER}import { TOCRecord } from "./types";
const tocs: TOCRecord = ${JSON.stringify(tocs, null, 2)};
export default tocs`);
await writeFile(tocsPath, tocsContents);

const searchPath = join(meta, "search.ts");
const searchContents = format(`${COPY_BANNER}import { RouteMetadata } from "./types";
const searchContents =
format(`${COPY_BANNER}import { RouteMetadata } from "./types";
const metadata: readonly RouteMetadata[] = ${JSON.stringify(metadata, null, 2)};
Expand Down
33 changes: 14 additions & 19 deletions packages/dialog/src/FixedDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,25 +70,20 @@ export const FixedDialog = forwardRef<HTMLDivElement, FixedDialogProps>(
) {
const { onRequestClose } = props;

const {
style,
onEnter,
onEntering,
onEntered,
onExited,
} = useFixedPositioning({
style: propStyle,
transformOrigin: true,
...options,
onScroll: (_event, { visible }) => {
if (!visible) {
onRequestClose();
}
},
fixedTo,
anchor,
getOptions,
});
const { style, onEnter, onEntering, onEntered, onExited } =
useFixedPositioning({
style: propStyle,
transformOrigin: true,
...options,
onScroll: (_event, { visible }) => {
if (!visible) {
onRequestClose();
}
},
fixedTo,
anchor,
getOptions,
});

return (
<Dialog
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,14 @@ export default function ThemeConfiguration({
primaryColor,
secondaryColor,
}: ThemeConfigurationProps): ReactElement {
const {
setPrimary,
setSecondary,
setAccent,
toggleTheme,
reset,
} = useThemeActions();
const { setPrimary, setSecondary, setAccent, toggleTheme, reset } =
useThemeActions();

// eslint-disable-next-line react-hooks/exhaustive-deps
useEffect(() => () => reset(), []);
const variables = useThemeVariables(primaryColor, secondaryColor);
const [compliance, setCompliance] = useState<ContrastRatioCompliance>(
"large"
);
const [compliance, setCompliance] =
useState<ContrastRatioCompliance>("large");
const handleComplianceChange = useCallback(
(compliance: string) =>
setCompliance(compliance as ContrastRatioCompliance),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ describe("DemoSandbox", () => {
...router,
query: {
...router.query,
from:
"http://im-a-bad-website.com/packages/tree/demos#single-select-tree-demo-title",
from: "http://im-a-bad-website.com/packages/tree/demos#single-select-tree-demo-title",
},
};
rerender(<DemoSandbox sandbox={sandbox} />, { router: badRouter });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,8 @@ export default function DessertTable({
return null;
}

const {
name,
type,
calories,
fat,
carbs,
protein,
sodium,
calcium,
iron,
} = dessert;
const { name, type, calories, fat, carbs, protein, sodium, calcium, iron } =
dessert;

return (
<CrossFade key={name}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,8 @@ export default function TextFieldThemeConfig({
const [readOnly, handleReadOnlyChange, setReadOnly] = useChecked(false);
const [error, handleErrorChange, setError] = useChecked(false);
const [disabled, handleDisabledChange] = useChecked(false);
const [
underlineDirection,
setUnderlineDirection,
] = useSelectState<FormUnderlineDirection>("left");
const [underlineDirection, setUnderlineDirection] =
useSelectState<FormUnderlineDirection>("left");
const [currentTheme, handleThemeChange] = useChoice<FormTheme>(
"outline",
(event) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ interface State {
data: ExampleFormData | null;
}

const EMAIL_PATTERN = /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
const EMAIL_PATTERN =
/^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
const titles = ["Mr", "Mrs", "Miss", "Dr", "Other"];

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,23 +81,18 @@ const navItems: LayoutNavigationTree = {
};

export default function ConfigurableLayout(): ReactElement {
const [phoneLayout, setPhoneLayout] = useState<SupportedPhoneLayout>(
DEFAULT_PHONE_LAYOUT
);
const [phoneLayout, setPhoneLayout] =
useState<SupportedPhoneLayout>(DEFAULT_PHONE_LAYOUT);
const [tabletLayout, setTabletLayout] = useState<SupportedTabletLayout>(
DEFAULT_TABLET_LAYOUT
);
const [
landscapeTabletLayout,
setLandscapeTabletLayout,
] = useState<SupportedTabletLayout>(DEFAULT_LANDSCAPE_TABLET_LAYOUT);
const [landscapeTabletLayout, setLandscapeTabletLayout] =
useState<SupportedTabletLayout>(DEFAULT_LANDSCAPE_TABLET_LAYOUT);
const [desktopLayout, setDesktopLayout] = useState<SupportedWideLayout>(
DEFAULT_DESKTOP_LAYOUT
);
const [
largeDesktopLayout,
setLargeDesktopLayout,
] = useState<SupportedWideLayout>(DEFAULT_DESKTOP_LAYOUT);
const [largeDesktopLayout, setLargeDesktopLayout] =
useState<SupportedWideLayout>(DEFAULT_DESKTOP_LAYOUT);

const [selectedId, setSelectedId] = useState("/");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ const options: SupportedWideLayout[] = [

export default function ControllingTheLayout(): ReactElement {
const [defaultVisible, setDefaultVisible] = useState(false);
const [desktopLayout, setDesktopLayout] = useState<SupportedWideLayout>(
"full-height"
);
const [desktopLayout, setDesktopLayout] =
useState<SupportedWideLayout>("full-height");

return (
<Layout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,10 @@ export default function ConfigurableExample(): ReactElement | null {
const [disabled, setDisabled] = useState(false);
const [disabledOpacity, setDisabledOpacity] = useState(false);
const [leftAddon, setLeftAddon] = useState<AddonType>("none");
const [
leftAddonPosition,
setLeftAddonPosition,
] = useState<ListItemAddonPosition>("middle");
const [
rightAddonPosition,
setRightAddonPosition,
] = useState<ListItemAddonPosition>("middle");
const [leftAddonPosition, setLeftAddonPosition] =
useState<ListItemAddonPosition>("middle");
const [rightAddonPosition, setRightAddonPosition] =
useState<ListItemAddonPosition>("middle");
const [rightAddon, setRightAddon] = useState<AddonType>("none");
const [primaryText, setPrimaryText] = useState("Hello, world!");
const [secondaryText, setSecondaryText] = useState("");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,10 @@ const verticalSizes: SheetVerticalSize[] = ["none", "touch", "recommended"];
export default function SheetSizing(): ReactElement {
const [visible, show, hide] = useToggle(false);
const [position, setPosition] = useSelectState<SheetPosition>("left");
const [
horizontalSize,
setHorizontalSize,
] = useSelectState<SheetHorizontalSize>("media");
const [verticalSize, setVerticalSize] = useSelectState<SheetVerticalSize>(
"recommended"
);
const [horizontalSize, setHorizontalSize] =
useSelectState<SheetHorizontalSize>("media");
const [verticalSize, setVerticalSize] =
useSelectState<SheetVerticalSize>("recommended");

const isHorizontal = position === "left" || position === "right";
const [emulate, setEmulate] = useState(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,8 @@ export default function useConfiguration(): TabConfiguration {

// TabPanel config
const [persistent, handlePersistentChange] = useChecked(false);
const [
transition,
handleTransitionChange,
setTransition,
] = useChoice<TransitionBehavior>("enabled");
const [transition, handleTransitionChange, setTransition] =
useChoice<TransitionBehavior>("enabled");
const disableTransition = transition === "disabled";
const customTransition = transition === "custom";
if (customTransition && persistent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,8 @@ import useSwipeableIndexes from "./useSwipeableIndexes";
const tabs = ["Tab One", "Tab Two", "Tab Three", "Tab Four"];

export default function SwipeableTabs(): ReactElement {
const {
activeIndex,
distance,
handlers,
swiping,
onActiveIndexChange,
} = useSwipeableIndexes(tabs.length - 1);
const { activeIndex, distance, handlers, swiping, onActiveIndexChange } =
useSwipeableIndexes(tabs.length - 1);

return (
<TabsManager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,13 @@ export default function ConfigurableCollapseExample(): ReactElement {
defaultValue: 0,
}
);
const [
minPaddingTop,
minPaddingTopProps,
{ reset: resetMinPaddingTop },
] = useNumberField({
id: "collapse-min-padding-top",
min: 0,
max: 80,
defaultValue: 0,
});
const [minPaddingTop, minPaddingTopProps, { reset: resetMinPaddingTop }] =
useNumberField({
id: "collapse-min-padding-top",
min: 0,
max: 80,
defaultValue: 0,
});
const [
minPaddingBottom,
minPaddingBottomProps,
Expand Down
Loading

0 comments on commit 3ce236a

Please sign in to comment.