Skip to content

Commit

Permalink
run prettier on all files
Browse files Browse the repository at this point in the history
  • Loading branch information
jkaster committed Aug 26, 2024
1 parent 5a50660 commit b1361d6
Show file tree
Hide file tree
Showing 159 changed files with 523 additions and 594 deletions.
32 changes: 16 additions & 16 deletions packages/api-explorer/e2e/diffScene.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe.skip('Diff Scene', () => {
const baseInputElement = await page.$(baseInputSelector);
expect(baseInputElement).not.toBeNull();
const baseInputValue = await page.evaluate(
(e) => e.value,
e => e.value,
baseInputElement
);
expect(baseInputValue).toMatch('3.1');
Expand All @@ -84,7 +84,7 @@ describe.skip('Diff Scene', () => {
const compInputElement = await page.$(compInputSelector);
expect(compInputElement).not.toBeNull();
const compInputValue = await page.evaluate(
(e) => e.value,
e => e.value,
compInputElement
);
expect(compInputValue).toEqual('');
Expand All @@ -106,7 +106,7 @@ describe.skip('Diff Scene', () => {
const switchButtonElement = await page.$(switchButtonSelector);
expect(switchButtonElement).not.toBeNull();
const switchButtonDisabled = await page.evaluate(
(e) => e.disabled,
e => e.disabled,
switchButtonElement
);
expect(switchButtonDisabled).toEqual(true);
Expand All @@ -120,7 +120,7 @@ describe.skip('Diff Scene', () => {
const baseInputElement = await page.$(baseInputSelector);
expect(baseInputElement).not.toBeNull();
const baseInputValue = await page.evaluate(
(e) => e.value,
e => e.value,
baseInputElement
);
expect(baseInputValue).toMatch('3.1');
Expand All @@ -131,7 +131,7 @@ describe.skip('Diff Scene', () => {
const compInputElement = await page.$(compInputSelector);
expect(compInputElement).not.toBeNull();
const compInputValue = await page.evaluate(
(e) => e.value,
e => e.value,
compInputElement
);
expect(compInputValue).toMatch('4.0');
Expand All @@ -142,7 +142,7 @@ describe.skip('Diff Scene', () => {
const switchButtonElement = await page.$(switchButtonSelector);
expect(switchButtonElement).not.toBeNull();
const switchButtonDisabled = await page.evaluate(
(e) => e.disabled,
e => e.disabled,
switchButtonElement
);
expect(switchButtonDisabled).toEqual(false);
Expand All @@ -153,8 +153,8 @@ describe.skip('Diff Scene', () => {
const diffResultCards = await page.$$(resultCardsSelector);
expect(diffResultCards).not.toHaveLength(0);
const page1Methods = await Promise.all(
diffResultCards.map((resultCard) =>
page.evaluate((el) => el.innerText.match(/^[a-z_]*/)[0], resultCard)
diffResultCards.map(resultCard =>
page.evaluate(el => el.innerText.match(/^[a-z_]*/)[0], resultCard)
)
);
expect(page1Methods).toHaveLength(15);
Expand All @@ -181,7 +181,7 @@ describe.skip('Diff Scene', () => {
// Find and validate method link
const methodLink = await page.$(`${resultCardsSelector} a[role=link]`);
expect(methodLink).not.toBeNull();
const methodText = await page.evaluate((e) => e.innerText, methodLink);
const methodText = await page.evaluate(e => e.innerText, methodLink);
expect(methodText).toMatch(`delete_alert for 4.0`);

// Click and validate destination
Expand Down Expand Up @@ -212,8 +212,8 @@ describe.skip('Diff Scene', () => {
expect(compOptionsOnClick).not.toHaveLength(1);

// Find an option containing the text 4.0
const option40Index = await page.$$eval(globalOptionsSelector, (els) =>
els.findIndex((el) => el?.textContent?.match(/4\.0/))
const option40Index = await page.$$eval(globalOptionsSelector, els =>
els.findIndex(el => el?.textContent?.match(/4\.0/))
);
const option40 = compOptionsOnClick[option40Index];
expect(option40).not.toBeUndefined();
Expand All @@ -231,8 +231,8 @@ describe.skip('Diff Scene', () => {
const diffResultCards = await page.$$(resultCardsSelector);
expect(diffResultCards).not.toHaveLength(0);
const diff31to40Page1Methods = await Promise.all(
diffResultCards.map((resultCard) =>
page.evaluate((el) => el.innerText.match(/^[a-z_]*/)[0], resultCard)
diffResultCards.map(resultCard =>
page.evaluate(el => el.innerText.match(/^[a-z_]*/)[0], resultCard)
)
);

Expand All @@ -243,7 +243,7 @@ describe.skip('Diff Scene', () => {
const switchButtonElement = await page.$(switchButtonSelector);
expect(switchButtonElement).not.toBeNull();
const switchButtonDisabled = await page.evaluate(
(e) => e.disabled,
e => e.disabled,
switchButtonElement
);
expect(switchButtonDisabled).toEqual(false);
Expand All @@ -257,8 +257,8 @@ describe.skip('Diff Scene', () => {

// Check the results again, even though they should be the same
const diff40to31Page1Methods = await Promise.all(
diffResultCards.map((resultCard) =>
page.evaluate((el) => el.innerText.match(/^[a-z_]*/)[0], resultCard)
diffResultCards.map(resultCard =>
page.evaluate(el => el.innerText.match(/^[a-z_]*/)[0], resultCard)
)
);

Expand Down
8 changes: 4 additions & 4 deletions packages/api-explorer/e2e/e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ describe('API Explorer', () => {
const docLinks = await page.$$('.doc-link');
expect(docLinks.length).toBeGreaterThan(0);
await docLinks[0].click();
const typeName = await page.evaluate((e) => e.innerText, docLinks[0]);
const typeName = await page.evaluate(e => e.innerText, docLinks[0]);
await expect(page).toMatchElement('h2', { text: typeName });
await page.goBack();

Expand Down Expand Up @@ -152,7 +152,7 @@ describe('API Explorer', () => {
const selector = 'input[aria-label="sdk language selector"]';
let languageHandle = await page.$(`${selector}[value="Python"]`);
expect(languageHandle).not.toBeNull();
expect(await page.evaluate((x) => x.value, languageHandle)).toEqual(
expect(await page.evaluate(x => x.value, languageHandle)).toEqual(
'Python'
);
await expect(page).toClick('h4', { text: 'Dashboard' });
Expand All @@ -164,7 +164,7 @@ describe('API Explorer', () => {
await pageReload();
languageHandle = await page.$(`${selector}[value="Kotlin"]`);
expect(languageHandle).not.toBeNull();
expect(await page.evaluate((x) => x.value, languageHandle)).toEqual(
expect(await page.evaluate(x => x.value, languageHandle)).toEqual(
'Kotlin'
);
await expect(page).toMatchElement('h3', { text: 'Kotlin Declaration' });
Expand Down Expand Up @@ -261,7 +261,7 @@ describe('API Explorer', () => {

const body = await page.$('body');
const codeMatch = await page.evaluate(
(e) => e.innerText.match('all_dashboards\\('),
e => e.innerText.match('all_dashboards\\('),
body
);
expect(codeMatch).not.toBeNull();
Expand Down
2 changes: 1 addition & 1 deletion packages/api-explorer/e2e/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ export const goToPage = async (url: string): Promise<void> => {
*/
export const getSpecKey = async (): Promise<string> => {
const specSelectorHandle = await page.$('input[aria-label="spec selector"]');
const specKey = await page.evaluate((e) => e.value, specSelectorHandle);
const specKey = await page.evaluate(e => e.value, specSelectorHandle);
return specKey;
};
2 changes: 1 addition & 1 deletion packages/api-explorer/src/ApiExplorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export const ApiExplorer: FC<ApiExplorerProps> = ({

const hasNavigationToggle = useCallback((e: MessageEvent<any>) => {
if (e.origin === window.origin && e.data.action === 'toggle_sidebar') {
setHasNavigation((currentHasNavigation) => !currentHasNavigation);
setHasNavigation(currentHasNavigation => !currentHasNavigation);
}
}, []);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ describe('DocMarkdown utils', () => {
describe('hashbang url remapping', () => {
test.each(['#!/methodTag', '#!/4.0/methodTag'])(
'it correctly maps %s tag urls',
(url) => {
url => {
const result = remapHashURL('4.0', url);
expect(result).toEqual('/4.0/methods/methodTag');
}
);

test.each(['#!/4.0/methodTag/methodName', '#!/methodTag/methodName'])(
'it correctly maps %s method urls ',
(hashbangUrl) => {
hashbangUrl => {
const result = remapHashURL('4.0', hashbangUrl);
expect(result).toEqual('/4.0/methods/methodTag/methodName');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import { DocParam } from './DocParam';

describe('DocParam', () => {
const allParams = api.methods.run_look.allParams;
const optionalParam = allParams.filter((val) => !val.required)[0];
const requiredParam = allParams.filter((val) => val.required)[0];
const optionalParam = allParams.filter(val => !val.required)[0];
const requiredParam = allParams.filter(val => val.required)[0];

test('it renders', () => {
renderWithTheme(<DocParam parameter={requiredParam} />);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ describe('DocParams', () => {

test('it works when method has both required and optional params', () => {
const params = api.methods.user.allParams;
const requiredParams = params.filter((param) => param.required);
const optionalParams = params.filter((param) => !param.required);
const requiredParams = params.filter(param => param.required);
const optionalParams = params.filter(param => !param.required);
expect(requiredParams).toHaveLength(1);
expect(optionalParams).toHaveLength(1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('DocPseudo', () => {
renderWithTheme(<DocPseudo method={method} />);
expect(screen.getByText(method.name, { exact: false })).toBeInTheDocument();

method.params.forEach((param) => {
method.params.forEach(param => {
expect(
screen.getByText(param.name, { exact: false })
).toBeInTheDocument();
Expand Down
4 changes: 2 additions & 2 deletions packages/api-explorer/src/components/DocSDKs/DocSDKs.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import { DocSDKs } from './DocSDKs';

describe('DocSDKs', () => {
let store: Store<RootState>;
const supportedLanguages = codeGenerators.map((g) => g.language);
const supportedLanguages = codeGenerators.map(g => g.language);
const pattern = new RegExp(`${supportedLanguages.join('|')}`);

beforeAll(() => {
Expand Down Expand Up @@ -64,7 +64,7 @@ describe('DocSDKs', () => {

test.each(supportedLanguages)(
'it can render a %s method declaration',
(sdkLanguage) => {
sdkLanguage => {
store = createTestStore({
settings: {
initialized: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { DataTableCell, Span } from '@looker/components';

import { getTableItemBottomBorder } from './utils';

export const DocSdkExampleCell: FC<PropsWithChildren<any>> = (props) => (
export const DocSdkExampleCell: FC<PropsWithChildren<any>> = props => (
<DataTableCell
style={{ borderBottom: getTableItemBottomBorder(props.hideBorderBottom) }}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export const DocSdkUsage: FC<DocSdkUsageProps> = ({ method }) => {
<Pagination
current={page}
pages={pageLimit}
onChange={(nextPage) => {
onChange={nextPage => {
setPage(nextPage);
}}
/>
Expand Down
5 changes: 3 additions & 2 deletions packages/api-explorer/src/components/DocSdkUsage/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export function prepareExampleDataTable(
const languageExamples = findExamples(examples, language, operationId);
return [
...result,
...languageExamples.map((exampleLink) => {
...languageExamples.map(exampleLink => {
return {
filename: getFileNameFromPath(exampleLink.tooltip),
line: exampleLink.lineNumber,
Expand All @@ -120,7 +120,8 @@ export function prepareExampleDataTable(
};
}),
];
}, []);
},
[]);

const pageExamples = tableExamples.filter(
(example, index) =>
Expand Down
2 changes: 1 addition & 1 deletion packages/api-explorer/src/components/DocTitle/DocTitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ import type { FC } from 'react';
import React from 'react';
import { RunItHeading } from '@looker/run-it';

export const DocTitle: FC = (props) => (
export const DocTitle: FC = props => (
<RunItHeading fontSize="xxxlarge" {...props} />
);
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,26 @@ export const SomethingWentWrong: React.FC<SomethingWentWrongProps> = ({

const OuterFlex = styled(Flex)`
width: 100%;
margin-top: ${(props) => props.theme.space.xxxxlarge};
margin-top: ${props => props.theme.space.xxxxlarge};
justify-content: center;
flex-direction: column;
align-items: center;
`;

const HeaderText = styled.h1`
margin-top: ${(props) => props.theme.space.large};
margin-top: ${props => props.theme.space.large};
text-align: center;
font-family: ${(props) => props.theme.fonts.brand};
font-weight: ${(props) => props.theme.fontWeights.normal};
font-size: ${(props) => props.theme.fontSizes.xxxxlarge};
color: ${(props) => props.theme.colors.text5};
font-family: ${props => props.theme.fonts.brand};
font-weight: ${props => props.theme.fontWeights.normal};
font-size: ${props => props.theme.fontSizes.xxxxlarge};
color: ${props => props.theme.colors.text5};
`;

const ActionMessage = styled.h3`
margin-top: ${(props) => props.theme.space.small};
margin-top: ${props => props.theme.space.small};
text-align: center;
font-family: ${(props) => props.theme.fonts.brand};
font-weight: ${(props) => props.theme.fontWeights.normal};
font-size: ${(props) => props.theme.fontSizes.large};
color: ${(props) => props.theme.colors.text3};
font-family: ${props => props.theme.fonts.brand};
font-weight: ${props => props.theme.fontWeights.normal};
font-size: ${props => props.theme.fontSizes.large};
color: ${props => props.theme.colors.text3};
`;
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export const ExplorePropertyReadOnly: FC<ExplorePropertyProps> = ({
* @param property to describe
* @constructor
*/
const DescriptionParagraph: FC = (props) => (
const DescriptionParagraph: FC = props => (
<Paragraph fontSize="small" m="none" {...props} />
);

Expand Down Expand Up @@ -270,7 +270,7 @@ export const ExplorePropertyType: FC<ExplorePropertyTypeProps> = ({
density={-3}
detail={<ExplorePropertyDetail api={api} property={property} />}
>
{Object.values(props).map((property) => (
{Object.values(props).map(property => (
<ExploreProperty
api={api}
key={property.fullName}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export const ExploreType: FC<ExploreTypeProps> = ({
}
>
{nest &&
Object.values(props).map((property) => (
Object.values(props).map(property => (
<ExploreProperty
api={api}
key={property.fullName}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,17 @@ describe('SdkLanguageSelector', () => {
expect(screen.getAllByRole('option')).toHaveLength(
codeGenerators.length + 1
);
languages.forEach((language) => {
languages.forEach(language => {
expect(
screen.getByRole('option', { name: language })
).toBeInTheDocument();
});
});
});

test.each(languages.filter((l) => l !== 'All'))(
test.each(languages.filter(l => l !== 'All'))(
'choosing `%s` pushes its alias to url',
async (language) => {
async language => {
renderWithRouterAndReduxProvider(
<SdkLanguageSelector />,
undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ interface TagsProps {
export const SideNavMethodTags = styled(
({ tags, specKey, className, defaultOpen }: TagsProps) => (
<div className={className}>
{Object.keys(tags).map((tag) => (
{Object.keys(tags).map(tag => (
<SideNavMethods
key={tag}
defaultOpen={defaultOpen}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ describe('SideNavMethods', () => {
await userEvent.click(screen.getByText('Dash'));
const matches = screen.getAllByText(/dash/i);
expect(matches).toHaveLength(2);
matches.forEach((match) => {
matches.forEach(match => {
expect(match).toContainHTML('<span class="hi">Dash</span>');
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const SideNavMethods = styled(
}
>
<ul>
{Object.values(methods).map((method) => (
{Object.values(methods).map(method => (
<li key={method.name}>
<Link
to={buildPathWithGlobalParams(
Expand Down
Loading

0 comments on commit b1361d6

Please sign in to comment.