chore: update prettier tab width for consistency (#175)

This commit is contained in:
41666 2021-03-13 22:54:34 -05:00 committed by GitHub
parent a931f8c69c
commit f24d2fcc99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
247 changed files with 7224 additions and 7375 deletions

View file

@ -1,17 +1,9 @@
module.exports = {
printWidth: 90,
useTabs: false,
tabWidth: 4,
tabWidth: 2,
singleQuote: true,
trailingComma: 'es5',
bracketSpacing: true,
semi: true,
overrides: [
{
files: '*.md',
options: {
tabWidth: 2,
},
},
],
};

View file

@ -33,11 +33,7 @@ export const CreateRoleypolyData = onlyRootUsers(
type: CategoryType.Single,
hidden: false,
position: 1,
roles: [
'394060232893923349',
'394060145799331851',
'394060192846839809',
],
roles: ['394060232893923349', '394060145799331851', '394060192846839809'],
},
{
id: KSUID.randomSync().string,
@ -45,11 +41,7 @@ export const CreateRoleypolyData = onlyRootUsers(
type: CategoryType.Multi,
hidden: false,
position: 5,
roles: [
'558104828216213505',
'558103534453653514',
'558297233582194728',
],
roles: ['558104828216213505', '558103534453653514', '558297233582194728'],
},
{
id: KSUID.randomSync().string,
@ -78,11 +70,7 @@ export const CreateRoleypolyData = onlyRootUsers(
type: CategoryType.Multi,
hidden: false,
position: 2,
roles: [
'485916566790340608',
'485916566941335583',
'485916566311927808',
],
roles: ['485916566790340608', '485916566941335583', '485916566311927808'],
},
],
};

View file

@ -30,10 +30,7 @@ export const UpdateRoles = withSession(
}
if (updateRequest.transactions.length === 0) {
return respond(
{ error: 'must have as least one transaction' },
{ status: 400 }
);
return respond({ error: 'must have as least one transaction' }, { status: 400 });
}
const guildCheck = guilds.find((guild) => guild.id === guildID);
@ -84,10 +81,7 @@ export const UpdateRoles = withSession(
roles: patchMemberRoles.roles,
};
await updateGuildMemberRoles(
{ serverID: guildID, userID },
patchMemberRoles.roles
);
await updateGuildMemberRoles({ serverID: guildID, userID }, patchMemberRoles.roles);
return respond(updatedMember);
}

View file

@ -35,9 +35,7 @@ export const resolveFailures = (
return handler(request);
} catch (e) {
console.error(e);
return (
handleWith() || respond({ error: 'internal server error' }, { status: 500 })
);
return handleWith() || respond({ error: 'internal server error' }, { status: 500 });
}
};
@ -208,8 +206,7 @@ export const isAllowedCallbackHost = (host: string): boolean => {
allowedCallbackHosts.includes(host) ||
allowedCallbackHosts
.filter((callbackHost) => callbackHost.includes('*'))
.find((wildcard) =>
new RegExp(wildcard.replace('*', '[a-z0-9-]+')).test(host)
) !== null
.find((wildcard) => new RegExp(wildcard.replace('*', '[a-z0-9-]+')).test(host)) !==
null
);
};

View file

@ -82,9 +82,7 @@ const server = http.createServer((req, res) => {
try {
const response = await value;
if (!response) {
throw new Error(
`response was invalid, got ${JSON.stringify(response)}`
);
throw new Error(`response was invalid, got ${JSON.stringify(response)}`);
}
res.statusCode = response.status;
loggedStatus = String(response.status);

View file

@ -140,12 +140,8 @@ export const Bi: Variant = {
stripes: ['#0038A8', '#0038A8', '#9B4F96', '#D60270', '#D60270'],
},
tooltip: 'Being bi is a lot like a riding a bicycle since they can go both ways.',
Logomark: (props: DynamicLogoProps) => (
<LogomarkFlag {...props} {...Bi.sharedProps} />
),
Logotype: (props: DynamicLogoProps) => (
<LogotypeFlag {...props} {...Bi.sharedProps} />
),
Logomark: (props: DynamicLogoProps) => <LogomarkFlag {...props} {...Bi.sharedProps} />,
Logotype: (props: DynamicLogoProps) => <LogotypeFlag {...props} {...Bi.sharedProps} />,
};
export const Lesbian: Variant = {
@ -180,12 +176,8 @@ export const Ace: Variant = {
stripes: ['#84067C', palette.grey600, '#CCCCCC', palette.grey100],
},
tooltip: "Sexualn't",
Logomark: (props: DynamicLogoProps) => (
<LogomarkFlag {...props} {...Ace.sharedProps} />
),
Logotype: (props: DynamicLogoProps) => (
<LogotypeFlag {...props} {...Ace.sharedProps} />
),
Logomark: (props: DynamicLogoProps) => <LogomarkFlag {...props} {...Ace.sharedProps} />,
Logotype: (props: DynamicLogoProps) => <LogotypeFlag {...props} {...Ace.sharedProps} />,
};
export const Birthday: Variant = {
@ -228,9 +220,7 @@ export const Birthday: Variant = {
>
<path
d="M115.711 25L186.421 95.7107L115.711 166.421L45 95.7107L115.711 25Z"
fill={
props.circleOuterFill || Birthday.sharedProps?.circleOuterFill
}
fill={props.circleOuterFill || Birthday.sharedProps?.circleOuterFill}
/>
</mask>
<g mask="url(#mask0)">
@ -238,9 +228,7 @@ export const Birthday: Variant = {
fillRule="evenodd"
clipRule="evenodd"
d="M79.9998 102C103.196 102 122 83.196 122 60C122 36.804 103.196 18 79.9998 18C56.8039 18 37.9998 36.804 37.9998 60C37.9998 83.196 56.8039 102 79.9998 102ZM79.9998 110C107.614 110 130 87.6142 130 60C130 32.3858 107.614 10 79.9998 10C52.3856 10 29.9998 32.3858 29.9998 60C29.9998 87.6142 52.3856 110 79.9998 110Z"
fill={
props.circleOuterFill || Birthday.sharedProps?.circleOuterFill
}
fill={props.circleOuterFill || Birthday.sharedProps?.circleOuterFill}
/>
</g>
</g>
@ -348,9 +336,7 @@ export const NewYear: Variant = {
typeFill: '#aaa',
},
tooltip: 'Fuck 2020. 🎆🎇🎆🎇',
Logomark: (props: DynamicLogoProps) => (
<Logomark {...props} {...NewYear.sharedProps} />
),
Logomark: (props: DynamicLogoProps) => <Logomark {...props} {...NewYear.sharedProps} />,
Logotype: (props: DynamicLogoProps) => (
<div style={{ display: 'inline-block', maxWidth: props.width }}>
<SparkleOverlay>

View file

@ -18,9 +18,7 @@ export class BreakpointsProvider extends React.Component<{}, ScreenSize> {
onSmallScreen: window.matchMedia(
mediaQueryDefs.onSmallScreen.replace('@media screen and', '')
),
onTablet: window.matchMedia(
mediaQueryDefs.onTablet.replace('@media screen and', '')
),
onTablet: window.matchMedia(mediaQueryDefs.onTablet.replace('@media screen and', '')),
onDesktop: window.matchMedia(
mediaQueryDefs.onDesktop.replace('@media screen and', '')
),

View file

@ -65,11 +65,11 @@ export const ContrastRatios = () => {
<p>
<b>WCAG Contrast Calculations.</b>
<br />
Marked in <span style={getWCAGStyle(7.1)}>Green</span> is 7.0+ or AAA.
Acceptable for Text.
Marked in <span style={getWCAGStyle(7.1)}>Green</span> is 7.0+ or AAA. Acceptable
for Text.
<br />
Marked in <span style={getWCAGStyle(4.6)}>Orange</span> is 4.5+ or AA.
Acceptable for UI.
Marked in <span style={getWCAGStyle(4.6)}>Orange</span> is 4.5+ or AA. Acceptable
for UI.
<br />
All below 4.5 is unacceptable.
<br />

View file

@ -14,9 +14,7 @@ const FaderOpacityStyled = styled.div<Pick<FaderProps, 'isVisible'>>`
export const FaderOpacity = (props: FaderProps) => {
return (
<FaderOpacityStyled isVisible={props.isVisible}>
{props.children}
</FaderOpacityStyled>
<FaderOpacityStyled isVisible={props.isVisible}>{props.children}</FaderOpacityStyled>
);
};

View file

@ -26,9 +26,9 @@ const CorrectlyFontedH2 = (props: { children: React.ReactNode }) => (
const Text = () => (
<>
<p>
Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et facilis alias
placeat cumque sapiente ad delectus omnis quae. Reiciendis quibusdam deserunt
repellat. Exercitationem modi incidunt autem nemo tempore eaque soluta.
Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et facilis alias placeat
cumque sapiente ad delectus omnis quae. Reiciendis quibusdam deserunt repellat.
Exercitationem modi incidunt autem nemo tempore eaque soluta.
</p>
<p>
4312.
@ -51,9 +51,7 @@ export const Fonts = () => (
<Text />
</section>
<section>
<CorrectlyFontedH2>
Main (Source Han Sans Japanese, Source Sans)
</CorrectlyFontedH2>
<CorrectlyFontedH2>Main (Source Han Sans Japanese, Source Sans)</CorrectlyFontedH2>
<UseFontStyled>
<Text />
</UseFontStyled>

View file

@ -15,11 +15,7 @@ export const HorizontalSwitch = (props: SwitchProps) => {
return (
<Wrapper>
{props.items.map((item, idx) => (
<Item
key={idx}
selected={item === props.value}
onClick={handleClick(item)}
>
<Item key={idx} selected={item === props.value} onClick={handleClick(item)}>
{item}
</Item>
))}

View file

@ -33,10 +33,7 @@ export const Popover = (props: PopoverProps) => {
<PopoverContent>{props.children()}</PopoverContent>
</PopoverBase>
{props.canDefocus && (
<DefocusHandler
active={props.active}
onClick={() => props.onExit?.('defocus')}
/>
<DefocusHandler active={props.active} onClick={() => props.onExit?.('defocus')} />
)}
</>
);

View file

@ -55,12 +55,7 @@ export const Unselected = () => (
export const DisabledByPosition = () => (
<Demo>
{roleCategory.map((c, idx) => (
<RoleComponent
key={idx}
role={{ ...c, safety: 1 }}
selected={false}
disabled
/>
<RoleComponent key={idx} role={{ ...c, safety: 1 }} selected={false} disabled />
))}
</Demo>
);
@ -68,12 +63,7 @@ export const DisabledByPosition = () => (
export const DisabledByDanger = () => (
<Demo>
{roleCategory.map((c, idx) => (
<RoleComponent
key={idx}
role={{ ...c, safety: 2 }}
selected={false}
disabled
/>
<RoleComponent key={idx} role={{ ...c, safety: 2 }} selected={false} disabled />
))}
</Demo>
);

View file

@ -9,9 +9,9 @@ export default {
const Text = () => (
<>
<p>
Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et facilis alias
placeat cumque sapiente ad delectus omnis quae. Reiciendis quibusdam deserunt
repellat. Exercitationem modi incidunt autem nemo tempore eaque soluta.
Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et facilis alias placeat
cumque sapiente ad delectus omnis quae. Reiciendis quibusdam deserunt repellat.
Exercitationem modi incidunt autem nemo tempore eaque soluta.
</p>
<p>
4312.
@ -63,9 +63,7 @@ export const Sizes = () => (
return (
<Section key={i}>
<div>
<Component>
The quick brown fox jumped over the lazy dog.
</Component>
<Component>The quick brown fox jumped over the lazy dog.</Component>
</div>
<div>
<Usage>

View file

@ -38,10 +38,9 @@ export const EditorCategory = (props: Props) => {
const [roleSearchPopoverActive, setRoleSearchPopoverActive] = React.useState(false);
const [roleSearchTerm, updateSearchTerm] = React.useState('');
const onUpdate = (
key: keyof typeof props.category,
pred?: (newValue: any) => any
) => (newValue: any) => {
const onUpdate = (key: keyof typeof props.category, pred?: (newValue: any) => any) => (
newValue: any
) => {
props.onChange({
...props.category,
[key]: pred ? pred(newValue) : newValue,

View file

@ -45,34 +45,10 @@ export const Flags = (props: FlagsProps) => (
<g id="Rectangle-5"></g>
<g id="Geyy" mask="url(#mask-4)">
<g transform="translate(1772.000000, 0.000000)" id="Rectangle-4">
<rect
fill="#F9238B"
x="0"
y="0"
width="1600"
height="151.006711"
></rect>
<rect
fill="#FB7B04"
x="0"
y="150"
width="1600"
height="151.006711"
></rect>
<rect
fill="#FFCA66"
x="0"
y="300"
width="1600"
height="151.006711"
></rect>
<rect
fill="#00B289"
x="0"
y="450"
width="1600"
height="151.006711"
></rect>
<rect fill="#F9238B" x="0" y="0" width="1600" height="151.006711"></rect>
<rect fill="#FB7B04" x="0" y="150" width="1600" height="151.006711"></rect>
<rect fill="#FFCA66" x="0" y="300" width="1600" height="151.006711"></rect>
<rect fill="#00B289" x="0" y="450" width="1600" height="151.006711"></rect>
<rect
fill="#5A38B5"
x="0"

View file

@ -12,11 +12,7 @@ export const NavSlug = (props: Props) => (
<SlugContainer>
<Avatar
hash={props.guild ? props.guild.icon : undefined}
src={
props.guild
? utils.avatarHash(props.guild.id, props.guild.icon)
: undefined
}
src={props.guild ? utils.avatarHash(props.guild.id, props.guild.icon) : undefined}
deliberatelyEmpty={!props.guild}
size={35}
>

View file

@ -21,19 +21,13 @@ export const PreauthGreeting = (props: GreetingProps) => (
<Center>
<Avatar
size={64}
src={avatarUtils.avatarHash(
props.guildSlug.id,
props.guildSlug.icon,
'icons',
512
)}
src={avatarUtils.avatarHash(props.guildSlug.id, props.guildSlug.icon, 'icons', 512)}
hash={props.guildSlug.icon}
>
{avatarUtils.initialsFromName(props.guildSlug.name)}
</Avatar>
<AccentTitle>
Hi there. <b>{props.guildSlug.name}</b> uses Roleypoly to help assign you
roles.
Hi there. <b>{props.guildSlug.name}</b> uses Roleypoly to help assign you roles.
</AccentTitle>
<Space />
<Space />

View file

@ -34,6 +34,5 @@ export const DiscordRole = styled.div<{
}
${(props) =>
props.isRoleypoly &&
hover(numberToChroma(props.discordRole.color).alpha(0.5).css())}
props.isRoleypoly && hover(numberToChroma(props.discordRole.color).alpha(0.5).css())}
`;

View file

@ -47,9 +47,7 @@ export const Authed = (props: Props) => {
>
<NavSlug
guild={
props.guilds.find(
(guild) => guild.id === props.activeGuildId
) || null
props.guilds.find((guild) => guild.id === props.activeGuildId) || null
}
/>
</InteractionBase>
@ -67,10 +65,7 @@ export const Authed = (props: Props) => {
onExit={() => setServerPopoverState(false)}
>
{() => (
<GuildNav
guilds={props.guilds}
recentGuilds={props.recentGuilds || []}
/>
<GuildNav guilds={props.guilds} recentGuilds={props.recentGuilds || []} />
)}
</Popover>
</MastheadLeft>
@ -82,9 +77,7 @@ export const Authed = (props: Props) => {
}}
hide={!userPopoverState}
>
{props.user !== undefined && (
<UserAvatarGroup user={props.user} />
)}
{props.user !== undefined && <UserAvatarGroup user={props.user} />}
</InteractionBase>
<Popover
headContent={<></>}

View file

@ -21,11 +21,7 @@ export const Guest = () => (
<MastheadRight>
<MastheadA to="/auth/login">
<Button size="small">
Login{' '}
<FaSignInAlt
size="1em"
style={{ transform: 'translateY(1px)' }}
/>
Login <FaSignInAlt size="1em" style={{ transform: 'translateY(1px)' }} />
</Button>
</MastheadA>
</MastheadRight>

View file

@ -1,4 +1,5 @@
jest.unmock('@roleypoly/design-system/atoms/role')
jest
.unmock('@roleypoly/design-system/atoms/role')
.unmock('@roleypoly/design-system/atoms/button')
.unmock('@roleypoly/design-system/molecules/picker-category')
.unmock('@roleypoly/design-system/organisms/role-picker');

View file

@ -49,10 +49,7 @@ export const RolePicker = (props: RolePickerProps) => {
if (category.type === CategoryType.Single) {
updateSelectedRoles(
newState === true
? [
...selectedRoles.filter((x) => !category.roles.includes(x)),
role.id,
]
? [...selectedRoles.filter((x) => !category.roles.includes(x)), role.id]
: selectedRoles.filter((x) => x !== role.id)
);
} else {
@ -82,9 +79,7 @@ export const RolePicker = (props: RolePickerProps) => {
<>
<div>
{sortBy(
props.guildData.categories.filter(
(category) => !category.hidden
),
props.guildData.categories.filter((category) => !category.hidden),
'position'
).map((category, idx) => (
<CategoryContainer key={idx}>
@ -97,28 +92,18 @@ export const RolePicker = (props: RolePickerProps) => {
)}
roles={
category.roles
.map((role) =>
props.roles.find((r) => r.id === role)
)
.map((role) => props.roles.find((r) => r.id === role))
.filter((r) => r !== undefined) as Role[]
}
onChange={handleChange(category)}
wikiMode={false}
type={
category.type === CategoryType.Single
? 'single'
: 'multi'
}
type={category.type === CategoryType.Single ? 'single' : 'multi'}
/>
</CategoryContainer>
))}
</div>
<div>
<FaderOpacity
isVisible={
xor(selectedRoles, props.member.roles).length !== 0
}
>
<FaderOpacity isVisible={xor(selectedRoles, props.member.roles).length !== 0}>
<ResetSubmit
onSubmit={() => props.onSubmit(selectedRoles)}
onReset={() => {

View file

@ -27,19 +27,13 @@ export const ServerSetup = (props: ServerSetupProps) => (
<div>
<Avatar
hash={props.guildSlug.icon}
src={utils.avatarHash(
props.guildSlug.id,
props.guildSlug.icon,
'icons'
)}
src={utils.avatarHash(props.guildSlug.id, props.guildSlug.icon, 'icons')}
>
{utils.initialsFromName(props.guildSlug.name)}
</Avatar>
</div>
<div>
<SmallTitle>
&nbsp;&nbsp;Roleypoly isn't in {props.guildSlug.name}
</SmallTitle>
<SmallTitle>&nbsp;&nbsp;Roleypoly isn't in {props.guildSlug.name}</SmallTitle>
</div>
</FlexLine>
{renderMessage(props.guildSlug)}
@ -80,9 +74,7 @@ const adminMessage = (id: string) => (
const managerMessage = (id: string) => (
<>
<FlexLine>
<AccentTitle>
You might have the permissions to add it to the server.
</AccentTitle>
<AccentTitle>You might have the permissions to add it to the server.</AccentTitle>
</FlexLine>
<FlexLine>
<div>

View file

@ -8,10 +8,7 @@ module.exports = {
alias: {},
plugins: [],
configure: (webpackConfig, { env, paths }) => {
const { isFound, match } = getLoader(
webpackConfig,
loaderByName('babel-loader')
);
const { isFound, match } = getLoader(webpackConfig, loaderByName('babel-loader'));
if (isFound) {
const include = Array.isArray(match.loader.include)
? match.loader.include

View file

@ -32,10 +32,7 @@ export const AppRouter = () => {
<RouteWrapper component={AuthLogin} path="/auth/login" />
<RouteWrapper component={DevToolsSetApi} path="/x/dev-tools/set-api" />
<RouteWrapper
component={DevToolsSessionDebug}
path="/x/dev-tools/session-debug"
/>
<RouteWrapper component={DevToolsSessionDebug} path="/x/dev-tools/session-debug" />
</Router>
);
};

View file

@ -18,9 +18,7 @@ export const ApiContext = React.createContext<ApiContextData>({
export const useApiContext = () => React.useContext(ApiContext);
export const ApiContextProvider = (props: { children: React.ReactNode }) => {
const [apiUrl, setApiUrl] = React.useState(
getDefaultApiUrl(window.location.hostname)
);
const [apiUrl, setApiUrl] = React.useState(getDefaultApiUrl(window.location.hostname));
const apiContextData: ApiContextData = {
apiUrl,

View file

@ -70,13 +70,9 @@ export const SessionContextProvider = (props: { children: React.ReactNode }) =>
// If a session is set and it's not stored, set it now.
if (
localStorage.getItem('rp_session_key') !==
sessionContextValue.session.sessionID
localStorage.getItem('rp_session_key') !== sessionContextValue.session.sessionID
) {
localStorage.setItem(
'rp_session_key',
sessionContextValue.session.sessionID || ''
);
localStorage.setItem('rp_session_key', sessionContextValue.session.sessionID || '');
}
// Session is set, but we don't have data. Server sup?