Skip to content

Commit

Permalink
Added set Prettier objectWrap to collapse
Browse files Browse the repository at this point in the history
  • Loading branch information
jwngr committed Mar 1, 2025
1 parent 030aa02 commit 41f8f93
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 48 deletions.
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"bracketSpacing": false,
"printWidth": 100,
"singleQuote": true,
"objectWrap": "collapse",
"trailingComma": "es5",
"plugins": ["@ianvs/prettier-plugin-sort-imports"],
"importOrder": ["<BUILT_IN_MODULES>", "", "<THIRD_PARTY_MODULES>", "", "^[.]"]
Expand Down
9 changes: 2 additions & 7 deletions website/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,8 @@ export async function fetchShortestPaths({
}): Promise<FetchShortestPathsResponse> {
const response = await fetch(`${SDOW_API_URL}/paths`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
source: sourcePageTitle,
target: targetPageTitle,
}),
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({source: sourcePageTitle, target: targetPageTitle}),
});

if (!response.ok) {
Expand Down
4 changes: 1 addition & 3 deletions website/src/components/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,7 @@ const ErrorMessageWrapper = styled.p`
}
`;

const ErrorMessage: React.FC<{
readonly text: string;
}> = ({text}) => {
const ErrorMessage: React.FC<{readonly text: string}> = ({text}) => {
const tokens = text.split('"');

return (
Expand Down
4 changes: 1 addition & 3 deletions website/src/components/NavLinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ const TextLinkInternal = styled(Link)`
${linkStyles}
`;

export const NavLinks: React.FC<{
readonly handleOpenModal: () => void;
}> = ({handleOpenModal}) => {
export const NavLinks: React.FC<{readonly handleOpenModal: () => void}> = ({handleOpenModal}) => {
return (
<Wrapper>
<TextLink href="#" onClick={() => handleOpenModal()}>
Expand Down
11 changes: 2 additions & 9 deletions website/src/components/PageInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,7 @@ export const PageInput: React.FC<{
try {
const response = await fetch(url, {
method: 'GET',
headers: {
'Api-User-Agent': SDOW_USER_AGENT,
},
headers: {'Api-User-Agent': SDOW_USER_AGENT},
});

const data = await response.json();
Expand All @@ -153,12 +151,7 @@ export const PageInput: React.FC<{
if (ns === 0) {
let description = get(terms, 'description.0', '');
description = description.charAt(0).toUpperCase() + description.slice(1);
newSuggestions.push({
id,
title,
description,
thumbnailUrl: get(thumbnail, 'source'),
});
newSuggestions.push({id, title, description, thumbnailUrl: get(thumbnail, 'source')});
}
});
setSuggestions(filter(newSuggestions));
Expand Down
12 changes: 5 additions & 7 deletions website/src/components/Results.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ const TwitterBirdSvg = styled.svg`
* Adds some character to the results by rendering a snarky comment for certain degress of
* separation.
*/
const SnarkyContent: React.FC<{
readonly degreesOfSeparation: number;
}> = ({degreesOfSeparation}) => {
const SnarkyContent: React.FC<{readonly degreesOfSeparation: number}> = ({degreesOfSeparation}) => {
if (degreesOfSeparation >= 2 && degreesOfSeparation <= 4) {
return null;
}
Expand Down Expand Up @@ -101,10 +99,10 @@ const SnarkyContent: React.FC<{
/**
* Adds a warning if the source and/or target page(s) were redirects.
*/
const RedirectWarning: React.FC<{
isSourceRedirected: boolean;
isTargetRedirected: boolean;
}> = ({isSourceRedirected, isTargetRedirected}) => {
const RedirectWarning: React.FC<{isSourceRedirected: boolean; isTargetRedirected: boolean}> = ({
isSourceRedirected,
isTargetRedirected,
}) => {
let redirectContent;
if (isSourceRedirected && isTargetRedirected) {
redirectContent = (
Expand Down
11 changes: 2 additions & 9 deletions website/src/components/ResultsGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,7 @@ export const ResultsGraph: React.FC<{
}

if (!seenNodes.has(currentPageId)) {
nodesData.push({
id: currentPageId,
title: currentPage.title,
degree: i,
});
nodesData.push({id: currentPageId, title: currentPage.title, degree: i});
seenNodes.add(currentPageId);
}

Expand All @@ -210,10 +206,7 @@ export const ResultsGraph: React.FC<{
console.error('Failed to find source or target node');
return;
}
linksData.push({
source: sourceNode,
target: targetNode,
});
linksData.push({source: sourceNode, target: targetNode});
}

previousPageId = currentPageId;
Expand Down
4 changes: 1 addition & 3 deletions website/src/components/charts/BarChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ const BarChartSvg = styled.svg`
}
`;

export const BarChart: React.FC<{
readonly data: number[];
}> = ({data}) => {
export const BarChart: React.FC<{readonly data: number[]}> = ({data}) => {
const barChartRef = useRef<SVGSVGElement>(null);
const barChartWrapperRef = useRef<HTMLDivElement>(null);
const barChartSvgRef = useRef<d3.Selection<SVGSVGElement, unknown, null, undefined> | null>(null);
Expand Down
8 changes: 4 additions & 4 deletions website/src/components/charts/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ const TableWrapper = styled.div`
}
`;

export const Table: React.FC<{
readonly headers: string[];
readonly rows: React.ReactNode[][];
}> = ({headers, rows}) => {
export const Table: React.FC<{readonly headers: string[]; readonly rows: React.ReactNode[][]}> = ({
headers,
rows,
}) => {
const headerRow = (
<tr key="table-header-row">
{headers.map((header, i) => (
Expand Down
4 changes: 1 addition & 3 deletions website/src/components/common/Logo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ const LogoImg = styled.img`
}
`;

export const Logo: React.FC<{
readonly onClick?: () => void;
}> = ({onClick}) => (
export const Logo: React.FC<{readonly onClick?: () => void}> = ({onClick}) => (
<Link to="/" onClick={onClick}>
<LogoImg
srcSet={`${logo} 462w, ${logo2x} 924w`}
Expand Down

0 comments on commit 41f8f93

Please sign in to comment.