Prettier 2.0 (#393)

This commit is contained in:
Steve Faulkner
2021-01-20 09:15:01 -06:00
committed by GitHub
parent c1937ca464
commit 4be53284b5
500 changed files with 41927 additions and 41838 deletions

View File

@@ -13,7 +13,7 @@ it("calls setAccount from parent component", () => {
const setDatabaseAccount = jest.fn();
const subscriptions = [
{ subscriptionId: "testSub1", displayName: "Test Sub 1" },
{ subscriptionId: "testSub2", displayName: "Test Sub 2" }
{ subscriptionId: "testSub2", displayName: "Test Sub 2" },
] as Subscription[];
(useSubscriptions as jest.Mock).mockReturnValue(subscriptions);
const accounts = [{ name: "testAccount1" }, { name: "testAccount2" }] as DatabaseAccount[];

View File

@@ -20,27 +20,27 @@ const buttonStyles: IButtonStyles = {
paddingLeft: 10,
marginRight: 5,
backgroundColor: StyleConstants.BaseDark,
color: StyleConstants.BaseLight
color: StyleConstants.BaseLight,
},
rootHovered: {
backgroundColor: StyleConstants.BaseHigh,
color: StyleConstants.BaseLight
color: StyleConstants.BaseLight,
},
rootFocused: {
backgroundColor: StyleConstants.BaseHigh,
color: StyleConstants.BaseLight
color: StyleConstants.BaseLight,
},
rootPressed: {
backgroundColor: StyleConstants.BaseHigh,
color: StyleConstants.BaseLight
color: StyleConstants.BaseLight,
},
rootExpanded: {
backgroundColor: StyleConstants.BaseHigh,
color: StyleConstants.BaseLight
color: StyleConstants.BaseLight,
},
textContainer: {
flexGrow: "initial"
}
flexGrow: "initial",
},
};
interface Props {
@@ -53,12 +53,12 @@ export const AccountSwitcher: FunctionComponent<Props> = ({ armToken, setDatabas
const [selectedSubscriptionId, setSelectedSubscriptionId] = useState<string>(() =>
localStorage.getItem("cachedSubscriptionId")
);
const selectedSubscription = subscriptions?.find(sub => sub.subscriptionId === selectedSubscriptionId);
const selectedSubscription = subscriptions?.find((sub) => sub.subscriptionId === selectedSubscriptionId);
const accounts = useDatabaseAccounts(selectedSubscription?.subscriptionId, armToken);
const [selectedAccountName, setSelectedAccountName] = useState<string>(() =>
localStorage.getItem("cachedDatabaseAccountName")
);
const selectedAccount = accounts?.find(account => account.name === selectedAccountName);
const selectedAccount = accounts?.find((account) => account.name === selectedAccountName);
useEffect(() => {
if (selectedAccountName) {
@@ -83,14 +83,14 @@ export const AccountSwitcher: FunctionComponent<Props> = ({ armToken, setDatabas
const items: IContextualMenuItem[] = [
{
key: "switchSubscription",
onRender: () => <SwitchSubscription {...{ subscriptions, setSelectedSubscriptionId, selectedSubscription }} />
onRender: () => <SwitchSubscription {...{ subscriptions, setSelectedSubscriptionId, selectedSubscription }} />,
},
{
key: "switchAccount",
onRender: (_, dismissMenu) => (
<SwitchAccount {...{ accounts, dismissMenu, selectedAccount, setSelectedAccountName }} />
)
}
),
},
];
return (
@@ -99,7 +99,7 @@ export const AccountSwitcher: FunctionComponent<Props> = ({ armToken, setDatabas
menuProps={{
directionalHintFixed: true,
className: "accountSwitchContextualMenu",
items
items,
}}
styles={buttonStyles}
className="accountSwitchButton"

View File

@@ -19,7 +19,7 @@ export const ConnectExplorer: React.FunctionComponent<Props> = ({
login,
setAuthType,
connectionString,
setConnectionString
setConnectionString,
}: Props) => {
const [isFormVisible, { setTrue: showForm }] = useBoolean(false);
@@ -34,7 +34,7 @@ export const ConnectExplorer: React.FunctionComponent<Props> = ({
{isFormVisible ? (
<form
id="connectWithConnectionString"
onSubmit={async event => {
onSubmit={async (event) => {
event.preventDefault();
if (isResourceTokenConnectionString(connectionString)) {
@@ -63,7 +63,7 @@ export const ConnectExplorer: React.FunctionComponent<Props> = ({
required
placeholder="Please enter a connection string"
value={connectionString}
onChange={event => {
onChange={(event) => {
setConnectionString(event.target.value);
}}
/>

View File

@@ -12,7 +12,7 @@ it("switches tenant for user", () => {
const dismissPanel = jest.fn();
const directories = [
{ displayName: "test1", tenantId: "test1-id" },
{ displayName: "test2", tenantId: "test2-id" }
{ displayName: "test2", tenantId: "test2-id" },
] as Tenant[];
(useDirectories as jest.Mock).mockReturnValue(directories);

View File

@@ -15,7 +15,7 @@ export const DirectoryPickerPanel: React.FunctionComponent<Props> = ({
dismissPanel,
armToken,
tenantId,
switchTenant
switchTenant,
}: Props) => {
const directories = useDirectories(armToken);
return (
@@ -27,7 +27,7 @@ export const DirectoryPickerPanel: React.FunctionComponent<Props> = ({
closeButtonAriaLabel="Close"
>
<ChoiceGroup
options={directories.map(dir => ({ key: dir.tenantId, text: `${dir.displayName} (${dir.tenantId})` }))}
options={directories.map((dir) => ({ key: dir.tenantId, text: `${dir.displayName} (${dir.tenantId})` }))}
selectedKey={tenantId}
onChange={(event, option) => {
switchTenant(option.key);

View File

@@ -4,7 +4,7 @@ import {
DirectionalHint,
Persona,
PersonaInitialsColor,
PersonaSize
PersonaSize,
} from "office-ui-fabric-react";
import * as React from "react";
import { Account } from "msal";
@@ -30,26 +30,26 @@ export const MeControl: React.FunctionComponent<Props> = ({ openPanel, logout, a
directionalHintFixed: true,
directionalHint: DirectionalHint.bottomRightEdge,
calloutProps: {
minPagePadding: 0
minPagePadding: 0,
},
items: [
{
key: "SwitchDirectory",
text: "Switch Directory",
onClick: openPanel
onClick: openPanel,
},
{
key: "SignOut",
text: "Sign Out",
onClick: logout
}
]
onClick: logout,
},
],
}}
styles={{
rootHovered: { backgroundColor: "#393939" },
rootFocused: { backgroundColor: "#393939" },
rootPressed: { backgroundColor: "#393939" },
rootExpanded: { backgroundColor: "#393939" }
rootExpanded: { backgroundColor: "#393939" },
}}
>
<Persona

View File

@@ -14,7 +14,7 @@ export const SignInButton: React.FunctionComponent<Props> = ({ login }: Props) =
styles={{
rootHovered: { backgroundColor: "#393939", color: "#fff" },
rootFocused: { backgroundColor: "#393939", color: "#fff" },
rootPressed: { backgroundColor: "#393939", color: "#fff" }
rootPressed: { backgroundColor: "#393939", color: "#fff" },
}}
/>
);

View File

@@ -14,16 +14,16 @@ export const SwitchAccount: FunctionComponent<Props> = ({
accounts,
setSelectedAccountName,
selectedAccount,
dismissMenu
dismissMenu,
}: Props) => {
return (
<Dropdown
label="Cosmos DB Account Name"
className="accountSwitchAccountDropdown"
options={accounts?.map(account => ({
options={accounts?.map((account) => ({
key: account.name,
text: account.name,
data: account
data: account,
}))}
onChange={(_, option) => {
setSelectedAccountName(String(option.key));
@@ -32,7 +32,7 @@ export const SwitchAccount: FunctionComponent<Props> = ({
defaultSelectedKey={selectedAccount?.name}
placeholder={accounts && accounts.length === 0 ? "No Accounts Found" : "Select an Account"}
styles={{
callout: "accountSwitchAccountDropdownMenu"
callout: "accountSwitchAccountDropdownMenu",
}}
/>
);

View File

@@ -12,17 +12,17 @@ interface Props {
export const SwitchSubscription: FunctionComponent<Props> = ({
subscriptions,
setSelectedSubscriptionId,
selectedSubscription
selectedSubscription,
}: Props) => {
return (
<Dropdown
label="Subscription"
className="accountSwitchSubscriptionDropdown"
options={subscriptions?.map(sub => {
options={subscriptions?.map((sub) => {
return {
key: sub.subscriptionId,
text: sub.displayName,
data: sub
data: sub,
};
})}
onChange={(_, option) => {
@@ -31,7 +31,7 @@ export const SwitchSubscription: FunctionComponent<Props> = ({
defaultSelectedKey={selectedSubscription?.subscriptionId}
placeholder={subscriptions && subscriptions.length === 0 ? "No Subscriptions Found" : "Select a Subscription"}
styles={{
callout: "accountSwitchSubscriptionDropdownMenu"
callout: "accountSwitchSubscriptionDropdownMenu",
}}
/>
);