diff --git a/package.json b/package.json index c86cf97c8..065755ee5 100644 --- a/package.json +++ b/package.json @@ -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" }, diff --git a/src/pages/index.tsx b/src/pages/index.tsx index ac3796270..f2db3b984 100755 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -60,7 +60,7 @@ export default () => { diff --git a/versioned_docs/version-2020fa/assignment3.md b/versioned_docs/version-2020fa/assignment3.md index f282ee06d..ac859c6cd 100644 --- a/versioned_docs/version-2020fa/assignment3.md +++ b/versioned_docs/version-2020fa/assignment3.md @@ -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 */ }; diff --git a/versioned_docs/version-2020fa/lecture10.md b/versioned_docs/version-2020fa/lecture10.md index b74382d77..5314e48ba 100644 --- a/versioned_docs/version-2020fa/lecture10.md +++ b/versioned_docs/version-2020fa/lecture10.md @@ -204,7 +204,7 @@ const ProductTable = ({ products, filterText, inStockOnly }: Props) => { + />, ); } rows.push(); diff --git a/versioned_docs/version-2020fa/lecture3.md b/versioned_docs/version-2020fa/lecture3.md index 67b888fdf..e837b5954 100644 --- a/versioned_docs/version-2020fa/lecture3.md +++ b/versioned_docs/version-2020fa/lecture3.md @@ -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() diff --git a/versioned_docs/version-2020fa/lecture5.md b/versioned_docs/version-2020fa/lecture5.md index 85a0a3255..474062341 100644 --- a/versioned_docs/version-2020fa/lecture5.md +++ b/versioned_docs/version-2020fa/lecture5.md @@ -102,7 +102,7 @@ import MyComponent from './MyComponent'; const link = 'https://github.com/cornell-dti'; ReactDOM.render( , - document.getElementById('root') + document.getElementById('root'), ); ``` diff --git a/versioned_docs/version-2020fa/lecture7.md b/versioned_docs/version-2020fa/lecture7.md index e2a8505e6..fc3d3a899 100644 --- a/versioned_docs/version-2020fa/lecture7.md +++ b/versioned_docs/version-2020fa/lecture7.md @@ -394,7 +394,7 @@ const ProductTable = ({ products, filterText, inStockOnly }: Props) => { + />, ); } rows.push(); diff --git a/versioned_docs/version-2020fa/lecture8.md b/versioned_docs/version-2020fa/lecture8.md index e44419047..416949fc2 100644 --- a/versioned_docs/version-2020fa/lecture8.md +++ b/versioned_docs/version-2020fa/lecture8.md @@ -148,7 +148,7 @@ p.then( }, (reason) => { // rejection - } + }, ); ``` @@ -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 }; - }) + }), ); }); @@ -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)), + ), ); }; diff --git a/versioned_docs/version-2020fa/lecture9.md b/versioned_docs/version-2020fa/lecture9.md index e5bd7857a..108c01abb 100644 --- a/versioned_docs/version-2020fa/lecture9.md +++ b/versioned_docs/version-2020fa/lecture9.md @@ -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(() => { diff --git a/versioned_docs/version-2020sp/lecture3.md b/versioned_docs/version-2020sp/lecture3.md index 6a0e6c628..0b8456b79 100644 --- a/versioned_docs/version-2020sp/lecture3.md +++ b/versioned_docs/version-2020sp/lecture3.md @@ -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() diff --git a/versioned_docs/version-2020sp/lecture5.md b/versioned_docs/version-2020sp/lecture5.md index 1fdc79857..e31a330fd 100644 --- a/versioned_docs/version-2020sp/lecture5.md +++ b/versioned_docs/version-2020sp/lecture5.md @@ -96,7 +96,7 @@ import MyComponent from './MyComponent'; const link = 'https://github.com/cornell-dti'; ReactDOM.render( , - document.getElementById('root') + document.getElementById('root'), ); ``` diff --git a/versioned_docs/version-2020sp/lecture7.md b/versioned_docs/version-2020sp/lecture7.md index 7347bd770..26381f1a6 100644 --- a/versioned_docs/version-2020sp/lecture7.md +++ b/versioned_docs/version-2020sp/lecture7.md @@ -321,7 +321,7 @@ const ProductTable = ({ products, filterText, inStockOnly }) => { + />, ); } rows.push(); diff --git a/versioned_docs/version-2020sp/lecture8.md b/versioned_docs/version-2020sp/lecture8.md index 06b357135..e4b64f71c 100644 --- a/versioned_docs/version-2020sp/lecture8.md +++ b/versioned_docs/version-2020sp/lecture8.md @@ -141,7 +141,7 @@ p.then( }, (reason) => { // rejection - } + }, ); ``` diff --git a/versioned_docs/version-2021fa/assignment3.md b/versioned_docs/version-2021fa/assignment3.md index ad37811c8..47f1d0d00 100644 --- a/versioned_docs/version-2021fa/assignment3.md +++ b/versioned_docs/version-2021fa/assignment3.md @@ -55,7 +55,7 @@ type Apartment = { export const affordableHousing = ( listings: Apartment[], - budget: number + budget: number, ): string[] => { /* TODO: add your code */ }; diff --git a/versioned_docs/version-2021fa/lecture10.md b/versioned_docs/version-2021fa/lecture10.md index ea95c84d5..b66b132d5 100644 --- a/versioned_docs/version-2021fa/lecture10.md +++ b/versioned_docs/version-2021fa/lecture10.md @@ -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; diff --git a/versioned_docs/version-2021fa/lecture5.md b/versioned_docs/version-2021fa/lecture5.md index 7e119936c..47dea9779 100644 --- a/versioned_docs/version-2021fa/lecture5.md +++ b/versioned_docs/version-2021fa/lecture5.md @@ -142,7 +142,7 @@ ReactDOM.render( , - document.getElementById('root') + document.getElementById('root'), ); // If you want to start measuring performance in your app, pass a function diff --git a/versioned_docs/version-2021fa/lecture8.md b/versioned_docs/version-2021fa/lecture8.md index 036030073..58974df4b 100644 --- a/versioned_docs/version-2021fa/lecture8.md +++ b/versioned_docs/version-2021fa/lecture8.md @@ -179,7 +179,7 @@ p.then( }, (reason) => { // rejection - } + }, ); ``` @@ -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 }; - }) + }), ); }); diff --git a/versioned_docs/version-2021fa/lecture9.md b/versioned_docs/version-2021fa/lecture9.md index 7364f658e..8cf59e23d 100644 --- a/versioned_docs/version-2021fa/lecture9.md +++ b/versioned_docs/version-2021fa/lecture9.md @@ -367,7 +367,7 @@ const createProduct = async () => { authorization: idToken, }, body: JSON.stringify(newProduct), - }) + }), ) .then((res) => res.text()) .then((data) => { @@ -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 }; - }) + }), ); }); @@ -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 }; diff --git a/versioned_docs/version-2021sp/assignment3.md b/versioned_docs/version-2021sp/assignment3.md index b8b713c38..4e989825a 100644 --- a/versioned_docs/version-2021sp/assignment3.md +++ b/versioned_docs/version-2021sp/assignment3.md @@ -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 */ }; diff --git a/versioned_docs/version-2021sp/lecture7.md b/versioned_docs/version-2021sp/lecture7.md index f16fc1904..6074c9dd9 100644 --- a/versioned_docs/version-2021sp/lecture7.md +++ b/versioned_docs/version-2021sp/lecture7.md @@ -415,7 +415,7 @@ const ProductTable = ({ products, filterText, inStockOnly }: Props) => { + />, ); } rows.push(); diff --git a/versioned_docs/version-2021sp/lecture8.md b/versioned_docs/version-2021sp/lecture8.md index 5a1c203f2..e2aaf7285 100644 --- a/versioned_docs/version-2021sp/lecture8.md +++ b/versioned_docs/version-2021sp/lecture8.md @@ -175,7 +175,7 @@ p.then( }, (reason) => { // rejection - } + }, ); ``` @@ -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 }; - }) + }), ); }); @@ -518,11 +518,11 @@ const ProductTable = ({ products, filterText, inStockOnly }: Props) => { + />, ); } rows.push( - + , ); lastCategory = product.category; }); diff --git a/versioned_docs/version-2021sp/lecture9.md b/versioned_docs/version-2021sp/lecture9.md index 701a0dd4d..7a83fd23e 100644 --- a/versioned_docs/version-2021sp/lecture9.md +++ b/versioned_docs/version-2021sp/lecture9.md @@ -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 }; - }) + }), ); }); diff --git a/versioned_docs/version-2022fa/assignment1.md b/versioned_docs/version-2022fa/assignment1.md index ca8859b8b..7b821588e 100644 --- a/versioned_docs/version-2022fa/assignment1.md +++ b/versioned_docs/version-2022fa/assignment1.md @@ -55,7 +55,7 @@ type Apartment = { export const affordableHousing = ( listings: Apartment[], - budget: number + budget: number, ): string[] => { /* TODO: add your code */ }; diff --git a/versioned_docs/version-2022fa/lecture5.md b/versioned_docs/version-2022fa/lecture5.md index b858fb48f..ed78d1555 100644 --- a/versioned_docs/version-2022fa/lecture5.md +++ b/versioned_docs/version-2022fa/lecture5.md @@ -627,7 +627,7 @@ p.then( }, (reason) => { // rejection - } + }, ); ``` diff --git a/versioned_docs/version-2022fa/lecture7.md b/versioned_docs/version-2022fa/lecture7.md index 46f7baf1f..97112ca5d 100644 --- a/versioned_docs/version-2022fa/lecture7.md +++ b/versioned_docs/version-2022fa/lecture7.md @@ -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(); const collectionRef = collection(db, collectionId); @@ -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(); const collectionRef = collection(db, collectionId); @@ -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 @@ -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, ); ``` @@ -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 ( @@ -472,7 +472,7 @@ 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); @@ -480,7 +480,7 @@ export const paginateReviews = ( return reviews.filter( (value, i) => i > pageSanitized * resultsPerPage && - i < Math.min(pageSanitized + 1, lastPage) + i < Math.min(pageSanitized + 1, lastPage), ); }; ``` diff --git a/versioned_docs/version-2022fa/lecture8.md b/versioned_docs/version-2022fa/lecture8.md index 073f4a994..223f997ba 100644 --- a/versioned_docs/version-2022fa/lecture8.md +++ b/versioned_docs/version-2022fa/lecture8.md @@ -287,7 +287,7 @@ const { user } = useAuth(); const taskQuery = query( collection(db, 'tasks'), - where('owner', '==', user!.uid) + where('owner', '==', user!.uid), ); ``` diff --git a/versioned_docs/version-2022sp/assignment1.md b/versioned_docs/version-2022sp/assignment1.md index ca8859b8b..7b821588e 100644 --- a/versioned_docs/version-2022sp/assignment1.md +++ b/versioned_docs/version-2022sp/assignment1.md @@ -55,7 +55,7 @@ type Apartment = { export const affordableHousing = ( listings: Apartment[], - budget: number + budget: number, ): string[] => { /* TODO: add your code */ }; diff --git a/versioned_docs/version-2022sp/lecture6.md b/versioned_docs/version-2022sp/lecture6.md index 50e5a6132..f2ada0fd2 100644 --- a/versioned_docs/version-2022sp/lecture6.md +++ b/versioned_docs/version-2022sp/lecture6.md @@ -326,7 +326,7 @@ p.then( }, (reason) => { // rejection - } + }, ); ``` diff --git a/versioned_docs/version-2022sp/lecture8.md b/versioned_docs/version-2022sp/lecture8.md index c93b83dca..52c808fe6 100644 --- a/versioned_docs/version-2022sp/lecture8.md +++ b/versioned_docs/version-2022sp/lecture8.md @@ -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(); const collectionRef = collection(db, collectionId); @@ -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(); const collectionRef = collection(db, collectionId); @@ -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 @@ -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, ); ``` @@ -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 ( @@ -472,7 +472,7 @@ 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); @@ -480,7 +480,7 @@ export const paginateReviews = ( return reviews.filter( (value, i) => i > pageSanitized * resultsPerPage && - i < Math.min(pageSanitized + 1, lastPage) + i < Math.min(pageSanitized + 1, lastPage), ); }; ``` diff --git a/versioned_docs/version-2022sp/lecture9.md b/versioned_docs/version-2022sp/lecture9.md index b619b24e3..aef3c0506 100644 --- a/versioned_docs/version-2022sp/lecture9.md +++ b/versioned_docs/version-2022sp/lecture9.md @@ -289,7 +289,7 @@ const { user } = useAuth(); const taskQuery = query( collection(db, 'tasks'), - where('owner', '==', user!.uid) + where('owner', '==', user!.uid), ); ``` diff --git a/versioned_docs/version-2023fa/finalproject.md b/versioned_docs/version-2023fa/finalproject.md index 8c12f7c45..339ca0549 100644 --- a/versioned_docs/version-2023fa/finalproject.md +++ b/versioned_docs/version-2023fa/finalproject.md @@ -35,6 +35,7 @@ Your remaining slip days are still valid for this. The group's allotted slip day This milestone is primarily focused to allow you to ideate ideas with your team (check out project suggestions for inspiration!). You will meet with your assigned TA for idea approval and roadmapping. Your assigned TA will be your primary point of contact for any trouble you face while working on the project. All our TAs are incredibly kind and supportive so don't feel intimidated! **Requirements** + - Text document detailing project idea and road map (make sure this has been approved by your TA) ### Milestone 2 @@ -43,6 +44,7 @@ This milestone is primarily focused to allow you to ideate ideas with your team For this milestone, we expect a skeleton of a website. So, by this checkpoint, you should have established your frontend pages and outlined the API routes you plan on implementing in Express. Your frontend and backend should be properly connected and can communicate with one another locally. Again, make sure your TA approves and has checked in with you. **Requirements** + - Frontend UI (at least 3 pages) - Express API & server that supports HTTP requests - at least one of each HTTP request type (`GET`, `POST`, `PUT`, `DELETE`) @@ -54,6 +56,7 @@ For this milestone, we expect a skeleton of a website. So, by this checkpoint, y For this milestone, you should have fully functioning prototype with maybe some minor bugs and getting your web application ready to be deployed. This is your final TA check in. **Requirements** + - Frontend UI (at least 3 pages) - Express API & server that supports HTTP requests - at least one of each HTTP request type (`GET`, `POST`, `PUT`, `DELETE`) @@ -67,9 +70,11 @@ Submit your final work! Great job and we're all excited for demo day!! **Make sure to fill out [this peer review](https://forms.gle/tRxrAPtmcmrBoUvd8) form for all members on your team** #### FINAL PRESENTATION DAY: December 5th, 2023 1-2PM Upson 222 + **Requirements** Please prepare to present a demo that is approximately **5 minutes**. Please also include information regarding + - A feature you are really proud of - Something you learned in creating this project - Something you would like to improve upon if you were to continue working on the project @@ -77,7 +82,6 @@ Please prepare to present a demo that is approximately **5 minutes**. Please als Completing your first full-stack web development project is something worth celebrating! If you are in a group, please try to have all members present. We are excited to see all of your presentations! If there are any questions or concerns, reach out to Michelle, Daniel, and Sarah. - :::tip Need help? Come to [office hours](/docs/2023sp/introduction) and we can help you debug. Also feel free to post questions on Ed! ::: @@ -128,12 +132,14 @@ This is subject to change. - Code style and file structure (5%) - Effort (10%) + - This may seem like an arbitrary measure, but we expect most people to get most of the points here; the only way to lose points is if it is clear that not a lot of effort has been put in or you are consistently missing milestones. - Milestones (15%) + - Each milestone is worth 5% of your grade. - Peer Review (5%) diff --git a/versioned_docs/version-2023fa/lecture5.md b/versioned_docs/version-2023fa/lecture5.md index 7b68a72fa..b6706b865 100644 --- a/versioned_docs/version-2023fa/lecture5.md +++ b/versioned_docs/version-2023fa/lecture5.md @@ -125,7 +125,7 @@ fetch( // Request body (remember to stringify!) body: JSON.stringify(requestBody), // ... other settings - } + }, ); ``` @@ -171,7 +171,7 @@ p.then( (reason) => { // rejection handler console.log('Rejected'); - } + }, ); ``` diff --git a/versioned_docs/version-2023fa/lecture7.md b/versioned_docs/version-2023fa/lecture7.md index 41434a026..4bf72e965 100644 --- a/versioned_docs/version-2023fa/lecture7.md +++ b/versioned_docs/version-2023fa/lecture7.md @@ -5,7 +5,6 @@ title: Lecture 7 [Lecture Slides](https://docs.google.com/presentation/d/1D_WsOfPfHNKNirbX5L2KtbdP5kANpshhXtGGUlZRtMQ/edit?usp=sharing) - ## Intro to Databases and Firebase A lot of the apps we have been making work and maintain states throughout the diff --git a/versioned_docs/version-2023fa/lecture8.md b/versioned_docs/version-2023fa/lecture8.md index f733fc273..ffb1ee5ae 100644 --- a/versioned_docs/version-2023fa/lecture8.md +++ b/versioned_docs/version-2023fa/lecture8.md @@ -5,7 +5,6 @@ title: Lecture 8 [Lecture Slides](https://docs.google.com/presentation/d/1enuaGBnQWxxcU59_qi49vIR1zWhsHd1YsAZV9s2ruT4/edit?usp=sharing) - [Final Project](finalproject) ## Authentication @@ -282,7 +281,7 @@ const { user } = useAuth(); const taskQuery = query( collection(db, 'tasks'), - where('owner', '==', user!.uid) + where('owner', '==', user!.uid), ); ``` diff --git a/versioned_docs/version-2023fa/unit1.md b/versioned_docs/version-2023fa/unit1.md index d14dce33e..e314a664e 100644 --- a/versioned_docs/version-2023fa/unit1.md +++ b/versioned_docs/version-2023fa/unit1.md @@ -781,10 +781,10 @@ With nested ternary operators, we can take care of many possible cases with surp condition1 ? trueValue1 : condition2 - ? trueValue2 - : condition3 - ? trueValue3 - : falseValue; + ? trueValue2 + : condition3 + ? trueValue3 + : falseValue; ``` Some syntactic sugar operators include `??` (nullish coalescing), which provides a "fallback" value if the value on the left is `null` or `undefined`: diff --git a/versioned_docs/version-2023fa/unit2.md b/versioned_docs/version-2023fa/unit2.md index 2c7ae9854..6ee46d8eb 100644 --- a/versioned_docs/version-2023fa/unit2.md +++ b/versioned_docs/version-2023fa/unit2.md @@ -659,7 +659,7 @@ function Parent({ data }) { (index) => { console.log(data[index]); }, - [data] + [data], ); return ; diff --git a/versioned_docs/version-2023sp/assignment1.md b/versioned_docs/version-2023sp/assignment1.md index e771e1d42..c50c80a73 100644 --- a/versioned_docs/version-2023sp/assignment1.md +++ b/versioned_docs/version-2023sp/assignment1.md @@ -66,7 +66,7 @@ type Apartment = { export const affordableHousing = ( listings: Apartment[], - budget: number + budget: number, ): string[] => { /* TODO: add your code */ }; diff --git a/versioned_docs/version-2023sp/lecture1.md b/versioned_docs/version-2023sp/lecture1.md index 34557ad59..a9e8a44fc 100644 --- a/versioned_docs/version-2023sp/lecture1.md +++ b/versioned_docs/version-2023sp/lecture1.md @@ -847,10 +847,10 @@ With nested ternary operators, we can take care of many possible cases with surp condition1 ? trueValue1 : condition2 - ? trueValue2 - : condition3 - ? trueValue3 - : falseValue; + ? trueValue2 + : condition3 + ? trueValue3 + : falseValue; ``` Some syntactic sugar operators include `??` (nullish coalescing) and `||` (logical OR). These operators are used to assign a value to a variable if the variable is nullish or falsy, respectively. For example: diff --git a/versioned_docs/version-2023sp/lecture4.md b/versioned_docs/version-2023sp/lecture4.md index 8ae97d257..7d4f9652e 100644 --- a/versioned_docs/version-2023sp/lecture4.md +++ b/versioned_docs/version-2023sp/lecture4.md @@ -568,7 +568,7 @@ function Parent({ data }) { (index) => { console.log(data[index]); }, - [data] + [data], ); return ; diff --git a/versioned_docs/version-2023sp/lecture6.md b/versioned_docs/version-2023sp/lecture6.md index ee536f305..00d5291dc 100644 --- a/versioned_docs/version-2023sp/lecture6.md +++ b/versioned_docs/version-2023sp/lecture6.md @@ -127,7 +127,7 @@ fetch( // Request body (remember to stringify!) body: JSON.stringify(requestBody), // ... other settings - } + }, ); ``` @@ -173,7 +173,7 @@ p.then( (reason) => { // rejection handler console.log('Rejected'); - } + }, ); ``` diff --git a/versioned_docs/version-2023sp/lecture8.md b/versioned_docs/version-2023sp/lecture8.md index 4f1bebb28..d69a30646 100644 --- a/versioned_docs/version-2023sp/lecture8.md +++ b/versioned_docs/version-2023sp/lecture8.md @@ -220,7 +220,7 @@ We can start this a file `fireHooks.ts`: ```ts const useCollectionWithCallback = ( collectionId: string, - callback: () => void + callback: () => void, ) => { const [coll, setColl] = useState(); const collectionRef = collection(db, collectionId); @@ -248,7 +248,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(); const collectionRef = collection(db, collectionId); @@ -259,7 +259,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 @@ -375,10 +375,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, ); ``` @@ -388,7 +388,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 ( @@ -400,7 +400,7 @@ 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); @@ -408,7 +408,7 @@ export const paginateReviews = ( return reviews.filter( (value, i) => i > pageSanitized * resultsPerPage && - i < Math.min(pageSanitized + 1, lastPage) + i < Math.min(pageSanitized + 1, lastPage), ); }; ``` diff --git a/versioned_docs/version-2023sp/lecture9.md b/versioned_docs/version-2023sp/lecture9.md index 094d9680f..7c3a5f348 100644 --- a/versioned_docs/version-2023sp/lecture9.md +++ b/versioned_docs/version-2023sp/lecture9.md @@ -285,7 +285,7 @@ const { user } = useAuth(); const taskQuery = query( collection(db, 'tasks'), - where('owner', '==', user!.uid) + where('owner', '==', user!.uid), ); ``` diff --git a/yarn.lock b/yarn.lock index 3a63e4dab..6a38537a2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9442,12 +9442,12 @@ __metadata: languageName: node linkType: hard -"prettier@npm:2.4.1": - version: 2.4.1 - resolution: "prettier@npm:2.4.1" +"prettier@npm:3.1.0": + version: 3.1.0 + resolution: "prettier@npm:3.1.0" bin: - prettier: bin-prettier.js - checksum: cc6830588b401b0d742862fe9c46bc9118204fb307c3abe0e49e95b35ed23629573807ffdf9cdd65289c252a0bb51fc0171437f6626ee36378dea80f0ee80b91 + prettier: bin/prettier.cjs + checksum: 44b556bd56f74d7410974fbb2418bb4e53a894d3e7b42f6f87779f69f27a6c272fa7fc27cec0118cd11730ef3246478052e002cbd87e9a253f9cd04a56aa7d9b languageName: node linkType: hard @@ -11583,7 +11583,7 @@ __metadata: "@types/webpack": ^5.28.0 clsx: ^1.1.1 file-loader: ^6.2.0 - prettier: 2.4.1 + prettier: 3.1.0 prism-react-renderer: ^1.2.1 react: ^17.0.2 react-dom: ^17.0.2