Skip to content

Commit

Permalink
Internal: update eslint-config-airbnb to 19.0.4, fix/suppress new err…
Browse files Browse the repository at this point in the history
  • Loading branch information
dangerismycat authored Feb 10, 2022
1 parent 8979e1b commit 2a18ce5
Show file tree
Hide file tree
Showing 42 changed files with 378 additions and 324 deletions.
4 changes: 2 additions & 2 deletions docs/components/ColorPalette.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type Props = {|
tokenId: string,
|};

const ColorPalette = ({ name, tokenId }: Props): Node => {
function ColorPalette({ name, tokenId }: Props): Node {
const tokenNumbers = [0, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900];
const colorId = `${tokenId}-${name.toLowerCase()}`;
return (
Expand All @@ -27,5 +27,5 @@ const ColorPalette = ({ name, tokenId }: Props): Node => {
</Box>
</Box>
);
};
}
export default ColorPalette;
4 changes: 2 additions & 2 deletions docs/components/ColorTile.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type Props = {|
showName?: boolean,
|};

const ColorTile = ({ name, number, textColor, tokenId, showName = false }: Props): Node => {
function ColorTile({ name, number, textColor, tokenId, showName = false }: Props): Node {
const colorId = `${tokenId}-${name.toLowerCase()}`;
const colorVariableName = `color-${colorId}-${number}`;

Expand All @@ -35,5 +35,5 @@ const ColorTile = ({ name, number, textColor, tokenId, showName = false }: Props
<Text color={textColor}>{tokens[colorVariableName]?.toUpperCase()}</Text>
</Box>
);
};
}
export default ColorTile;
6 changes: 3 additions & 3 deletions docs/components/Example.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type Props = {|

const { Box, Text } = gestalt;

const Example = ({
function Example({
defaultCode,
description,
id,
Expand All @@ -31,7 +31,7 @@ const Example = ({
showHeading,
showCode = true,
skipContrastCheck = false,
}: Props): Node => {
}: Props): Node {
const code = defaultCode.trim();
const scope = { ...gestalt, DatePicker };

Expand Down Expand Up @@ -67,6 +67,6 @@ const Example = ({
</LiveProvider>
</Card>
);
};
}

export default Example;
12 changes: 7 additions & 5 deletions docs/components/MainSection.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ type Props = {|
showHeading?: boolean,
|};

const MainSection = ({ children, description, name, showHeading = true }: Props): Node => (
<Card name={name} showHeading={showHeading} description={description}>
{children}
</Card>
);
function MainSection({ children, description, name, showHeading = true }: Props): Node {
return (
<Card name={name} showHeading={showHeading} description={description}>
{children}
</Card>
);
}

MainSection.Card = MainSectionCard;

Expand Down
39 changes: 21 additions & 18 deletions docs/components/MainSectionCard.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// @flow strict
import { type Node, useCallback } from 'react';
import { Box, Text } from 'gestalt';
import * as gestalt from 'gestalt'; // eslint-disable-line import/no-namespace
import DatePicker from 'gestalt-datepicker';
import type { Node } from 'react';
import { LiveProvider, LiveError, LivePreview } from 'react-live';
import ExampleCode from './ExampleCode.js';
import theme from './atomDark.js';
Expand Down Expand Up @@ -43,7 +43,7 @@ const COLOR_TO_HEX = {
red: '#e60023',
};

const MainSectionCard = ({
function MainSectionCard({
cardSize = 'md',
children,
defaultCode,
Expand All @@ -53,7 +53,7 @@ const MainSectionCard = ({
showCode = true,
title,
type = 'info',
}: Props): Node => {
}: Props): Node {
const code = defaultCode?.trim();
const scope = { ...gestalt, DatePicker };
const borderStyle =
Expand All @@ -63,20 +63,23 @@ const MainSectionCard = ({
const shouldShowCode = showCode && cardSize !== 'sm' && type === 'info';
const showTitleAndDescriptionAboveExample = cardSize === 'lg' && type === 'info';

const PreviewCard = ({ children: cardChildren }: PreviewCardProps): Node => (
<Box
alignItems="center"
borderStyle="sm"
color={shaded ? 'lightGray' : 'white'}
display="flex"
height={CARD_SIZE_NAME_TO_PIXEL[cardSize]}
justifyContent="center"
padding={8}
position="relative"
rounding={2}
>
{cardChildren}
</Box>
const PreviewCard = useCallback(
({ children: cardChildren }: PreviewCardProps) => (
<Box
alignItems="center"
borderStyle="sm"
color={shaded ? 'lightGray' : 'white'}
display="flex"
height={CARD_SIZE_NAME_TO_PIXEL[cardSize]}
justifyContent="center"
padding={8}
position="relative"
rounding={2}
>
{cardChildren}
</Box>
),
[cardSize, shaded],
);

const TitleAndDescription = (
Expand Down Expand Up @@ -131,6 +134,6 @@ const MainSectionCard = ({
{!showTitleAndDescriptionAboveExample && TitleAndDescription}
</Box>
);
};
}

export default MainSectionCard;
10 changes: 2 additions & 8 deletions docs/components/MainSectionSubsection.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,7 @@ type Props = {|
title?: string,
|};

const MainSectionSubsection = ({
badge,
children,
columns = 1,
description,
title,
}: Props): Node => {
function MainSectionSubsection({ badge, children, columns = 1, description, title }: Props): Node {
const slugifiedId = slugify(title || '');
const arrayChildren = Children.toArray(children);

Expand Down Expand Up @@ -96,6 +90,6 @@ const MainSectionSubsection = ({
))}
</Box>
);
};
}

export default MainSectionSubsection;
74 changes: 40 additions & 34 deletions docs/components/PropTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,29 @@ type Props = {|

const unifyQuotes = (input) => input?.replace(/'/g, '"');

const Description = (lines: Array<string>): Node => (
<Flex alignItems="start" direction="column" gap={2}>
{lines.map((line, idx) => (
<Markdown key={idx} text={line} textColor="gray" />
))}
</Flex>
);
function Description(lines: Array<string>): Node {
return (
<Flex alignItems="start" direction="column" gap={2}>
{lines.map((line, idx) => (
<Markdown key={idx} text={line} textColor="gray" />
))}
</Flex>
);
}

const Th = ({ children }: {| children?: Node |}) => (
<th style={{ borderBottom: '2px solid #ddd' }}>
<Box padding={2}>
<Text size="200" overflow="normal" weight="bold">
{children}
</Text>
</Box>
</th>
);
function Th({ children }: {| children?: Node |}) {
return (
<th style={{ borderBottom: '2px solid #ddd' }}>
<Box padding={2}>
<Text size="200" overflow="normal" weight="bold">
{children}
</Text>
</Box>
</th>
);
}

const Td = ({
function Td({
border = true,
children,
colspan = 1,
Expand All @@ -54,23 +58,25 @@ const Td = ({
colspan?: number,
shrink?: boolean,
color?: 'darkGray' | 'gray',
|}) => (
<td
style={{
verticalAlign: 'top',
borderBottom: border && '1px solid #ddd',
padding: 0,
width: shrink ? '1px' : '',
}}
colSpan={colspan}
>
<Box paddingX={2} marginTop={2} marginBottom={border ? 2 : 0}>
<Text overflow="normal" color={color}>
{children}
</Text>
</Box>
</td>
);
|}) {
return (
<td
style={{
verticalAlign: 'top',
borderBottom: border && '1px solid #ddd',
padding: 0,
width: shrink ? '1px' : '',
}}
colSpan={colspan}
>
<Box paddingX={2} marginTop={2} marginBottom={border ? 2 : 0}>
<Text overflow="normal" color={color}>
{children}
</Text>
</Box>
</td>
);
}

function isNumeric(value) {
return /^-?\d+$/.test(value);
Expand Down
6 changes: 3 additions & 3 deletions docs/components/SearchContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ type Props = {|
children?: Node,
|};

const SearchContent = ({ children }: Props): Node => (
<div className="docSearch-content">{children}</div>
);
function SearchContent({ children }: Props): Node {
return <div className="docSearch-content">{children}</div>;
}

export default SearchContent;
78 changes: 41 additions & 37 deletions docs/components/TokenExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,43 +17,47 @@ type ExampleProps = {|
category: string,
|};

export const ColorBox = ({ token }: BaseProps): Node => (
<Box
dangerouslySetInlineStyle={{
__style: { backgroundColor: `var(--${token.name})` },
}}
height={50}
width={250}
display="flex"
alignItems="center"
justifyContent="between"
paddingX={2}
borderStyle={token.name.includes('inverse') ? 'sm' : 'none'}
/>
);
export function ColorBox({ token }: BaseProps): Node {
return (
<Box
dangerouslySetInlineStyle={{
__style: { backgroundColor: `var(--${token.name})` },
}}
height={50}
width={250}
display="flex"
alignItems="center"
justifyContent="between"
paddingX={2}
borderStyle={token.name.includes('inverse') ? 'sm' : 'none'}
/>
);
}

export const SpacingBox = ({ token }: BaseProps): Node => (
<Box color="eggplant" width={`${token.value}`} height={`${token.value}`} />
);
export function SpacingBox({ token }: BaseProps): Node {
return <Box color="eggplant" width={`${token.value}`} height={`${token.value}`} />;
}

export const TextColorBox = ({ token }: BaseProps): Node => (
<Box
dangerouslySetInlineStyle={{
__style: { color: `var(--${token.name})`, fontSize: '32px' },
}}
height={50}
width={150}
display="flex"
alignItems="center"
justifyContent="between"
paddingX={2}
color={token.name.includes('inverse') ? 'darkGray' : undefined}
>
Gestalt
</Box>
);
export function TextColorBox({ token }: BaseProps): Node {
return (
<Box
dangerouslySetInlineStyle={{
__style: { color: `var(--${token.name})`, fontSize: '32px' },
}}
height={50}
width={150}
display="flex"
alignItems="center"
justifyContent="between"
paddingX={2}
color={token.name.includes('inverse') ? 'darkGray' : undefined}
>
Gestalt
</Box>
);
}

export const FontBox = ({ token, type }: FontBoxProps): Node => {
export function FontBox({ token, type }: FontBoxProps): Node {
const fontWeightStyle = type === 'weight' ? `var(--${token.name})` : undefined;
const fontFamilyStyle = type === 'family' ? `var(--${token.name})` : undefined;
const fontSizeStyle = type === 'size' ? `var(--${token.name})` : `var(--font-size-600)`;
Expand All @@ -78,9 +82,9 @@ export const FontBox = ({ token, type }: FontBoxProps): Node => {
{token.name.includes('japanese') ? 'ゲシュタルト' : 'Gestalt'}
</Box>
);
};
}

export const TokenExample = ({ token, category }: ExampleProps): Node => {
export function TokenExample({ token, category }: ExampleProps): Node {
switch (category) {
case 'background-color':
return <ColorBox token={token} />;
Expand All @@ -97,4 +101,4 @@ export const TokenExample = ({ token, category }: ExampleProps): Node => {
default:
return <Box>{token.value}</Box>;
}
};
}
2 changes: 1 addition & 1 deletion docs/pages/_document.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ gtag('config', 'UA-12967896-44');
`,
}}
/>
<link rel="shortcut icon" href="/pinterest_favicon.png" />
<link rel="icon" href="/pinterest_favicon.png" />
</Head>
<body>
<Main />
Expand Down
Loading

0 comments on commit 2a18ce5

Please sign in to comment.