Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
syoung212 committed Nov 29, 2023
1 parent 5eafb2d commit 2325336
Show file tree
Hide file tree
Showing 43 changed files with 96 additions and 92 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@types/react-helmet": "^6.1.4",
"@types/react-router-dom": "^5.3.1",
"file-loader": "^6.2.0",
"prettier": "2.4.1",
"prettier": "3.1.0",
"typescript": "^4.4.4",
"url-loader": "^4.1.1"
},
Expand Down
2 changes: 1 addition & 1 deletion src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default () => {
<Link
className={clsx(
'button button--primary button--lg',
styles.getStarted
styles.getStarted,
)}
to={useBaseUrl('docs/introduction')}
>
Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-2020fa/assignment3.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Starter code:
```typescript
export const partition = (
array: number[],
belongToGroup1: (element: number) => boolean
belongToGroup1: (element: number) => boolean,
): { group1: number[]; group2: number[] } => {
/* TODO: add your code */
};
Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-2020fa/lecture10.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ const ProductTable = ({ products, filterText, inStockOnly }: Props) => {
<ProductCategoryRow
category={product.category}
key={product.category}
/>
/>,
);
}
rows.push(<ProductRow key={product.name} {...product} />);
Expand Down
4 changes: 2 additions & 2 deletions versioned_docs/version-2020fa/lecture3.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ app.get('/self-check', async (_, resp) => {
console.log('Trying to obtain doc in DB.');
const docSnapshot = await docRef.get();
console.log(
`We obtained a doc with id ${docSnapshot.id}. It's content is logged below:`
`We obtained a doc with id ${docSnapshot.id}. It's content is logged below:`,
);
console.log(docSnapshot.data());
console.log('Now we will try to remove it.');
await docRef.delete();
console.log('The document is deleted.');
console.log(
'After all these operations, the db should be empty. We check that.'
'After all these operations, the db should be empty. We check that.',
);
db.collection('test')
.get()
Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-2020fa/lecture5.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ import MyComponent from './MyComponent';
const link = 'https://github.com/cornell-dti';
ReactDOM.render(
<MyComponent name="Cornell DTI" githubLink={link} />,
document.getElementById('root')
document.getElementById('root'),
);
```

Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-2020fa/lecture7.md
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ const ProductTable = ({ products, filterText, inStockOnly }: Props) => {
<ProductCategoryRow
category={product.category}
key={product.category}
/>
/>,
);
}
rows.push(<ProductRow key={product.name} {...product} />);
Expand Down
8 changes: 4 additions & 4 deletions versioned_docs/version-2020fa/lecture8.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ p.then(
},
(reason) => {
// rejection
}
},
);
```

Expand Down Expand Up @@ -388,7 +388,7 @@ app.get('/getSongs', async (req, res) => {
songs.docs.map((doc): SongWithID => {
const song = doc.data() as Song;
return { ...song, id: doc.id };
})
}),
);
});

Expand Down Expand Up @@ -468,8 +468,8 @@ export const SongList = () => {
method: 'POST',
}).then((res) =>
setSongs(
songs.map((song) => (song.id === id ? { ...song, rating } : song))
)
songs.map((song) => (song.id === id ? { ...song, rating } : song)),
),
);
};

Expand Down
6 changes: 3 additions & 3 deletions versioned_docs/version-2020fa/lecture9.md
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,9 @@ const updateRating = (id: string, rating: number) => {
songs.map((song) =>
song.id === id
? { name: song.name, artist: song.artist, rating, id }
: song
)
)
: song,
),
),
);
})
.catch(() => {
Expand Down
4 changes: 2 additions & 2 deletions versioned_docs/version-2020sp/lecture3.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@ app.get('/self-check', async (_, resp) => {
console.log('Trying to obtain doc in DB.');
const docSnapshot = await docRef.get();
console.log(
`We obtained a doc with id ${docSnapshot.id}. It's content is logged below:`
`We obtained a doc with id ${docSnapshot.id}. It's content is logged below:`,
);
console.log(docSnapshot.data());
console.log('Now we will try to remove it.');
await docRef.delete();
console.log('The document is deleted.');
console.log(
'After all these operations, the db should be empty. We check that.'
'After all these operations, the db should be empty. We check that.',
);
db.collection('test')
.get()
Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-2020sp/lecture5.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ import MyComponent from './MyComponent';
const link = 'https://github.com/cornell-dti';
ReactDOM.render(
<MyComponent name="Cornell DTI" githubLink={link} />,
document.getElementById('root')
document.getElementById('root'),
);
```

Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-2020sp/lecture7.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ const ProductTable = ({ products, filterText, inStockOnly }) => {
<ProductCategoryRow
category={product.category}
key={product.category}
/>
/>,
);
}
rows.push(<ProductRow product={product} key={product.name} />);
Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-2020sp/lecture8.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ p.then(
},
(reason) => {
// rejection
}
},
);
```

Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-2021fa/assignment3.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ type Apartment = {

export const affordableHousing = (
listings: Apartment[],
budget: number
budget: number,
): string[] => {
/* TODO: add your code */
};
Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-2021fa/lecture10.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default function App() {
getBatteryLevelAsync().then(setBattery);
// subscribe to battery level to keep it in sync
const listener = addBatteryLevelListener((event) =>
setBattery(event.batteryLevel)
setBattery(event.batteryLevel),
);
// remove the subscription after unmounting
return listener.remove;
Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-2021fa/lecture5.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
document.getElementById('root'),
);

// If you want to start measuring performance in your app, pass a function
Expand Down
4 changes: 2 additions & 2 deletions versioned_docs/version-2021fa/lecture8.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ p.then(
},
(reason) => {
// rejection
}
},
);
```

Expand Down Expand Up @@ -418,7 +418,7 @@ app.get('/getProducts', async (_, res) => {
products.docs.map((doc): ProductWithID => {
const product = doc.data() as Product;
return { ...product, id: doc.id };
})
}),
);
});

Expand Down
8 changes: 4 additions & 4 deletions versioned_docs/version-2021fa/lecture9.md
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ const createProduct = async () => {
authorization: idToken,
},
body: JSON.stringify(newProduct),
})
}),
)
.then((res) => res.text())
.then((data) => {
Expand Down Expand Up @@ -442,7 +442,7 @@ app.get('/getProducts', async (_, res) => {
products.docs.map((doc): ProductWithID => {
const product = doc.data() as Product;
return { ...product, id: doc.id };
})
}),
);
});

Expand Down Expand Up @@ -514,10 +514,10 @@ config();
const serviceAccountPath = './firebase-adminsdk.json';

const hydrateServiceAccount = (
serviceAccountPath: string
serviceAccountPath: string,
): admin.ServiceAccount => {
const serviceAccount = JSON.parse(
readFileSync(serviceAccountPath).toString()
readFileSync(serviceAccountPath).toString(),
);
const privateKey = process.env.FIREBASE_PRIVATE_KEY?.replace(/\\n/g, '\n');
return { ...serviceAccount, privateKey };
Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-2021sp/assignment3.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Starter code:
```typescript
export const partition = (
array: number[],
belongToGroup1: (element: number) => boolean
belongToGroup1: (element: number) => boolean,
): { group1: number[]; group2: number[] } => {
/* TODO: add your code */
};
Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-2021sp/lecture7.md
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ const ProductTable = ({ products, filterText, inStockOnly }: Props) => {
<ProductCategoryRow
category={product.category}
key={product.category}
/>
/>,
);
}
rows.push(<ProductRow key={product.name} {...product} />);
Expand Down
8 changes: 4 additions & 4 deletions versioned_docs/version-2021sp/lecture8.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ p.then(
},
(reason) => {
// rejection
}
},
);
```

Expand Down Expand Up @@ -415,7 +415,7 @@ app.get('/getProducts', async (_, res) => {
products.docs.map((doc): ProductWithID => {
const product = doc.data() as Product;
return { ...product, id: doc.id };
})
}),
);
});

Expand Down Expand Up @@ -518,11 +518,11 @@ const ProductTable = ({ products, filterText, inStockOnly }: Props) => {
<ProductCategoryRow
category={product.category}
key={product.category}
/>
/>,
);
}
rows.push(
<ProductRow key={product.name} product={product} products={products} />
<ProductRow key={product.name} product={product} products={products} />,
);
lastCategory = product.category;
});
Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-2021sp/lecture9.md
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ app.get('/getProducts', async (_, res) => {
products.docs.map((doc): ProductWithID => {
const product = doc.data() as Product;
return { ...product, id: doc.id };
})
}),
);
});

Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-2022fa/assignment1.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ type Apartment = {

export const affordableHousing = (
listings: Apartment[],
budget: number
budget: number,
): string[] => {
/* TODO: add your code */
};
Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-2022fa/lecture5.md
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ p.then(
},
(reason) => {
// rejection
}
},
);
```

Expand Down
16 changes: 8 additions & 8 deletions versioned_docs/version-2022fa/lecture7.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ We can start this a file `fireHooks.ts`:
```ts
const useCollectionWithCallback = (
collectionId: string,
callback: () => void
callback: () => void,
) => {
const [coll, setColl] = useState<DocumentData[] | undefined>();
const collectionRef = collection(db, collectionId);
Expand Down Expand Up @@ -320,7 +320,7 @@ Alternatively, in a slightly nicer (more functional, more Observable-y way), we
```ts
const useCollectionWithCallback2 = (
collectionId: string,
callback: () => void
callback: () => void,
) => {
const [coll, setColl] = useState<DocumentData[] | undefined>();
const collectionRef = collection(db, collectionId);
Expand All @@ -331,7 +331,7 @@ const useCollectionWithCallback2 = (
// in the effect, set the collection data. This triggers an update in any component using 'coll' (using this collection hook).
setColl(c);
callback();
}
},
);
return () => {
// run any any cleanup code
Expand Down Expand Up @@ -447,10 +447,10 @@ export const filterByReviewer = (reviews: FireReview[], reviewer: string) =>
export const filterByBook = (
reviews: FireReview[],
title: string,
author: string
author: string,
) =>
reviews.filter(
(review) => review.title === title && review.author === author
(review) => review.title === title && review.author === author,
);
```

Expand All @@ -460,7 +460,7 @@ Now how can we use the above functions to implement the main feature of our book
export const getAvgRatingForBook = (
reviews: FireReview[],
title: string,
author: string
author: string,
) => {
const filteredList = filterByBook(reviews, title, author);
return (
Expand All @@ -472,15 +472,15 @@ export const getAvgRatingForBook = (
export const paginateReviews = (
reviews: FireReview[],
resultsPerPage: number,
page: number
page: number,
) => {
const lastPage = Math.ceil((reviews.length + 1) / page);
const pageSanitized = Math.min(Math.max(0, page), lastPage);

return reviews.filter(
(value, i) =>
i > pageSanitized * resultsPerPage &&
i < Math.min(pageSanitized + 1, lastPage)
i < Math.min(pageSanitized + 1, lastPage),
);
};
```
2 changes: 1 addition & 1 deletion versioned_docs/version-2022fa/lecture8.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ const { user } = useAuth();

const taskQuery = query(
collection(db, 'tasks'),
where('owner', '==', user!.uid)
where('owner', '==', user!.uid),
);
```

Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-2022sp/assignment1.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ type Apartment = {

export const affordableHousing = (
listings: Apartment[],
budget: number
budget: number,
): string[] => {
/* TODO: add your code */
};
Expand Down
Loading

0 comments on commit 2325336

Please sign in to comment.