From 2b026b7e5f24b571b11d8947b61d5aa12ecb0ff7 Mon Sep 17 00:00:00 2001 From: Aaron William Po Date: Sun, 28 May 2023 20:05:49 -0400 Subject: [PATCH] format: format codebase to prettier schema --- package-lock.json | 26 +++++++++++++------ package.json | 1 - src/components/Account/Security.tsx | 2 +- .../BeerById/BeerPostCommentsSection.tsx | 4 +-- .../BeerById/BeerRecommendations.tsx | 13 +++++----- .../BreweryById/BreweryBeerSection.tsx | 13 +++++----- src/components/ui/CommentsComponent.tsx | 14 +++++----- src/hooks/utilities/useMediaQuery.ts | 9 +++---- 8 files changed, 43 insertions(+), 39 deletions(-) diff --git a/package-lock.json b/package-lock.json index 567b219..c5e2f87 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,7 +31,6 @@ "multer-storage-cloudinary": "^4.0.0", "next": "^13.3.4", "next-connect": "^1.0.0-next.3", - "onchange": "^7.1.0", "passport": "^0.6.0", "passport-local": "^1.0.0", "pino": "^8.12.0", @@ -74,6 +73,7 @@ "eslint-config-next": "^13.3.4", "eslint-config-prettier": "^8.8.0", "eslint-plugin-react": "^7.32.2", + "onchange": "^7.1.0", "postcss": "^8.4.23", "prettier": "^2.8.8", "prettier-plugin-jsdoc": "^0.4.2", @@ -206,12 +206,14 @@ "node_modules/@blakeembrey/deque": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/@blakeembrey/deque/-/deque-1.0.5.tgz", - "integrity": "sha512-6xnwtvp9DY1EINIKdTfvfeAtCYw4OqBZJhtiqkT3ivjnEfa25VQ3TsKvaFfKm8MyGIEfE95qLe+bNEt3nB0Ylg==" + "integrity": "sha512-6xnwtvp9DY1EINIKdTfvfeAtCYw4OqBZJhtiqkT3ivjnEfa25VQ3TsKvaFfKm8MyGIEfE95qLe+bNEt3nB0Ylg==", + "dev": true }, "node_modules/@blakeembrey/template": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@blakeembrey/template/-/template-1.1.0.tgz", - "integrity": "sha512-iZf+UWfL+DogJVpd/xMQyP6X6McYd6ArdYoPMiv/zlOTzeXXfQbYxBNJJBF6tThvsjLMbA8tLjkCdm9RWMFCCw==" + "integrity": "sha512-iZf+UWfL+DogJVpd/xMQyP6X6McYd6ArdYoPMiv/zlOTzeXXfQbYxBNJJBF6tThvsjLMbA8tLjkCdm9RWMFCCw==", + "dev": true }, "node_modules/@cspotcode/source-map-support": { "version": "0.8.1", @@ -8303,6 +8305,7 @@ "version": "7.1.0", "resolved": "https://registry.npmjs.org/onchange/-/onchange-7.1.0.tgz", "integrity": "sha512-ZJcqsPiWUAUpvmnJri5TPBooqJOPmC0ttN65juhN15Q8xA+Nbg3BaxBHXQ45EistKKlKElb0edmbPWnKSBkvMg==", + "dev": true, "dependencies": { "@blakeembrey/deque": "^1.0.5", "@blakeembrey/template": "^1.0.0", @@ -8319,7 +8322,8 @@ "node_modules/onchange/node_modules/arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true }, "node_modules/onetime": { "version": "5.1.2", @@ -10778,6 +10782,7 @@ "version": "1.2.2", "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", + "dev": true, "bin": { "tree-kill": "cli.js" } @@ -11713,12 +11718,14 @@ "@blakeembrey/deque": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/@blakeembrey/deque/-/deque-1.0.5.tgz", - "integrity": "sha512-6xnwtvp9DY1EINIKdTfvfeAtCYw4OqBZJhtiqkT3ivjnEfa25VQ3TsKvaFfKm8MyGIEfE95qLe+bNEt3nB0Ylg==" + "integrity": "sha512-6xnwtvp9DY1EINIKdTfvfeAtCYw4OqBZJhtiqkT3ivjnEfa25VQ3TsKvaFfKm8MyGIEfE95qLe+bNEt3nB0Ylg==", + "dev": true }, "@blakeembrey/template": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@blakeembrey/template/-/template-1.1.0.tgz", - "integrity": "sha512-iZf+UWfL+DogJVpd/xMQyP6X6McYd6ArdYoPMiv/zlOTzeXXfQbYxBNJJBF6tThvsjLMbA8tLjkCdm9RWMFCCw==" + "integrity": "sha512-iZf+UWfL+DogJVpd/xMQyP6X6McYd6ArdYoPMiv/zlOTzeXXfQbYxBNJJBF6tThvsjLMbA8tLjkCdm9RWMFCCw==", + "dev": true }, "@cspotcode/source-map-support": { "version": "0.8.1", @@ -17510,6 +17517,7 @@ "version": "7.1.0", "resolved": "https://registry.npmjs.org/onchange/-/onchange-7.1.0.tgz", "integrity": "sha512-ZJcqsPiWUAUpvmnJri5TPBooqJOPmC0ttN65juhN15Q8xA+Nbg3BaxBHXQ45EistKKlKElb0edmbPWnKSBkvMg==", + "dev": true, "requires": { "@blakeembrey/deque": "^1.0.5", "@blakeembrey/template": "^1.0.0", @@ -17523,7 +17531,8 @@ "arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true } } }, @@ -19256,7 +19265,8 @@ "tree-kill": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", - "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==" + "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", + "dev": true }, "tree-node-cli": { "version": "1.6.0", diff --git a/package.json b/package.json index a5bade0..91d1918 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,6 @@ "devDependencies": { "@faker-js/faker": "^7.6.0", "@types/cookie": "^0.5.1", - "@types/ejs": "^3.1.2", "@types/jsonwebtoken": "^9.0.2", "@types/lodash": "^4.14.194", "@types/mapbox__mapbox-sdk": "^0.13.4", diff --git a/src/components/Account/Security.tsx b/src/components/Account/Security.tsx index 283b95a..1fc4991 100644 --- a/src/components/Account/Security.tsx +++ b/src/components/Account/Security.tsx @@ -19,7 +19,7 @@ const Security: FunctionComponent = () => { }); const onSubmit: SubmitHandler> = async (data) => { - await sendUpdatePasswordRequest(data) + await sendUpdatePasswordRequest(data); reset(); }; diff --git a/src/components/BeerById/BeerPostCommentsSection.tsx b/src/components/BeerById/BeerPostCommentsSection.tsx index f0831e8..1329d5b 100644 --- a/src/components/BeerById/BeerPostCommentsSection.tsx +++ b/src/components/BeerById/BeerPostCommentsSection.tsx @@ -67,8 +67,8 @@ const BeerPostCommentsSection: FC = ({ beerPost }) { /** - * If the comments are loading, show a loading component. Otherwise, show - * the comments. + * If the comments are loading, show a loading component. Otherwise, show the + * comments. */ isLoading ? (
diff --git a/src/components/BeerById/BeerRecommendations.tsx b/src/components/BeerById/BeerRecommendations.tsx index 3f053b9..5be84b4 100644 --- a/src/components/BeerById/BeerRecommendations.tsx +++ b/src/components/BeerById/BeerRecommendations.tsx @@ -19,8 +19,8 @@ const BeerRecommendationsSection: FC<{ const { ref: penultimateBeerPostRef } = useInView({ /** - * When the last beer post comes into view, call setSize from - * useBeerPostsByBrewery to load more beer posts. + * When the last beer post comes into view, call setSize from useBeerPostsByBrewery to + * load more beer posts. */ onChange: (visible) => { if (!visible || isAtEnd) return; @@ -46,9 +46,8 @@ const BeerRecommendationsSection: FC<{ const isPenultimateBeerPost = index === beerPosts.length - 2; /** - * Attach a ref to the second last beer post in the list. - * When it comes into view, the component will call - * setSize to load more beer posts. + * Attach a ref to the second last beer post in the list. When it comes + * into view, the component will call setSize to load more beer posts. */ return ( @@ -86,8 +85,8 @@ const BeerRecommendationsSection: FC<{ { /** - * If there are more beer posts to load, show a loading component - * with a skeleton loader and a loading spinner. + * If there are more beer posts to load, show a loading component with a + * skeleton loader and a loading spinner. */ !!isLoadingMore && !isAtEnd && ( diff --git a/src/components/BreweryById/BreweryBeerSection.tsx b/src/components/BreweryById/BreweryBeerSection.tsx index 9416383..5400277 100644 --- a/src/components/BreweryById/BreweryBeerSection.tsx +++ b/src/components/BreweryById/BreweryBeerSection.tsx @@ -22,8 +22,8 @@ const BreweryBeersSection: FC = ({ breweryPost }) = }); const { ref: penultimateBeerPostRef } = useInView({ /** - * When the last beer post comes into view, call setSize from - * useBeerPostsByBrewery to load more beer posts. + * When the last beer post comes into view, call setSize from useBeerPostsByBrewery to + * load more beer posts. */ onChange: (visible) => { if (!visible || isAtEnd) return; @@ -60,9 +60,8 @@ const BreweryBeersSection: FC = ({ breweryPost }) = const isPenultimateBeerPost = index === beerPosts.length - 2; /** - * Attach a ref to the second last beer post in the list. - * When it comes into view, the component will call - * setSize to load more beer posts. + * Attach a ref to the second last beer post in the list. When it comes + * into view, the component will call setSize to load more beer posts. */ return ( @@ -91,8 +90,8 @@ const BreweryBeersSection: FC = ({ breweryPost }) = { /** - * If there are more beer posts to load, show a loading component - * with a skeleton loader and a loading spinner. + * If there are more beer posts to load, show a loading component with a + * skeleton loader and a loading spinner. */ !!isLoadingMore && !isAtEnd && ( diff --git a/src/components/ui/CommentsComponent.tsx b/src/components/ui/CommentsComponent.tsx index 9a1d3be..fb08e56 100644 --- a/src/components/ui/CommentsComponent.tsx +++ b/src/components/ui/CommentsComponent.tsx @@ -68,9 +68,8 @@ const CommentsComponent: FC = ({ const isLastComment = index === comments.length - 1; /** - * Attach a ref to the last comment in the list. When it comes - * into view, the component will call setSize to load more - * comments. + * Attach a ref to the last comment in the list. When it comes into view, the + * component will call setSize to load more comments. */ return (
= ({ { /** - * If there are more comments to load, show a loading component - * with a skeleton loader and a loading spinner. + * If there are more comments to load, show a loading component with a + * skeleton loader and a loading spinner. */ !!isLoadingMore && } { /** - * If the user has scrolled to the end of the comments, show a - * button that will scroll them back to the top of the comments - * section. + * If the user has scrolled to the end of the comments, show a button that + * will scroll them back to the top of the comments section. */ !!isAtEnd && (
diff --git a/src/hooks/utilities/useMediaQuery.ts b/src/hooks/utilities/useMediaQuery.ts index f27af5a..60e8413 100644 --- a/src/hooks/utilities/useMediaQuery.ts +++ b/src/hooks/utilities/useMediaQuery.ts @@ -18,9 +18,8 @@ import { useState, useEffect } from 'react'; */ const useMediaQuery = (query: `(${string})`) => { /** - * Initialize the matches state variable to false. This is updated whenever the - * viewport size changes (i.e. when the component is mounted and when the window is - * resized) + * Initialize the matches state variable to false. This is updated whenever the viewport + * size changes (i.e. when the component is mounted and when the window is resized) */ const [matches, setMatches] = useState(false); @@ -35,8 +34,8 @@ const useMediaQuery = (query: `(${string})`) => { } /** - * Add a resize event listener to the window object, and update the `matches` - * state variable whenever the viewport size changes. + * Add a resize event listener to the window object, and update the `matches` state + * variable whenever the viewport size changes. */ const listener = () => setMatches(media.matches); window.addEventListener('resize', listener);