From 7861486724c4d15ecff595afb707a7dd5fbb46c6 Mon Sep 17 00:00:00 2001 From: Arkadiusz Bachorski <60391032+arkadiuszbachorski@users.noreply.github.com> Date: Wed, 29 May 2024 22:55:46 +0200 Subject: [PATCH 1/3] Add .idea to Git ignore (#17) # Add .idea to Git ignore ## :recycle: Current situation & Problem `.idea` is directory that stores per-project configuration of JetBrains IDEs. It shouldn't be versioned. ## :gear: Release Notes * Add .idea to Git ignore ### Code of Conduct & Contributing Guidelines By submitting creating this pull request, you agree to follow our [Code of Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md): - [x] I agree to follow the [Code of Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md). --- .gitignore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index a976600..5ab1665 100644 --- a/.gitignore +++ b/.gitignore @@ -47,4 +47,7 @@ next-env.d.ts eslint_report.json # docs -docs \ No newline at end of file +docs + +# editors +.idea/ From f4f7ba59b8b35f14282c245b603d56ac62eb9384 Mon Sep 17 00:00:00 2001 From: Arkadiusz Bachorski <60391032+arkadiuszbachorski@users.noreply.github.com> Date: Wed, 29 May 2024 22:56:11 +0200 Subject: [PATCH 2/3] Opt-in to `experimentalTernaries` Prettier option (#18) # Opt-in to `experimentalTernaries` Prettier option ## :recycle: Current situation & Problem Prettier 3.1 introduced two ternary changes: 1. They added `experimentalTernaries` flag 2. They brought back indentation to nested ternaries by default Community of Prettier has always been pretty opinionated about nested ternaries. Prettier dev team made `experimentalTernaries` an option mostly because of that. It's not a beta feature by any means. I've been using `experimentalTernaries` flag since released in 3.1 and this indeed makes ternaries easier to read. ### Example ```javascript const isLoading = Math.random() > 0.1 const isError = Math.random() > 0.1 const hasData = Math.random() > 0.1 // Current const foo = isLoading ? 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.' : isError ? 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.' : hasData ? 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.' : 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.' // Experimental ternaries const foo = isLoading ? 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.' : isError ? 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.' : hasData ? 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.' : 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.' ``` It requires a minute or two to get used to, but then it's extremely readable. Especially useful in the world of JSX where ternary is commonly used. More info: * [Prettier 3.1 release notes](https://prettier.io/blog/2023/11/13/3.1.0#add-indentation-back-to-nested-ternaries-9559httpsgithubcomprettierprettierpull9559-by-rattrayalexhttpsgithubcomrattrayalex) * [Blog post describing experimental ternaries option](https://prettier.io/blog/2023/11/13/curious-ternaries) ## :gear: Release Notes * Opt-in to `experimentalTernaries` Prettier option ### Code of Conduct & Contributing Guidelines By submitting creating this pull request, you agree to follow our [Code of Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md): - [x] I agree to follow the [Code of Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md). Co-authored-by: Paul Schmiedmayer --- .prettierrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.prettierrc b/.prettierrc index b2095be..5ed933a 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,4 +1,5 @@ { "semi": false, - "singleQuote": true + "singleQuote": true, + "experimentalTernaries": true } From 77fec26532dfc58d2558ca1223596370a3c0dfb5 Mon Sep 17 00:00:00 2001 From: Arkadiusz Bachorski <60391032+arkadiuszbachorski@users.noreply.github.com> Date: Wed, 29 May 2024 22:56:33 +0200 Subject: [PATCH 3/3] Remove global React usage (#19) # Remove global React usage ## :recycle: Current situation & Problem `React` shouldn't be used as global module ## :gear: Release Notes * Remove global React usage ### Code of Conduct & Contributing Guidelines By submitting creating this pull request, you agree to follow our [Code of Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md): - [x] I agree to follow the [Code of Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md). Co-authored-by: Paul Schmiedmayer --- app/layout.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/layout.tsx b/app/layout.tsx index 0498213..4045408 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -19,11 +19,7 @@ interface RootLayoutProps { children: ReactNode } -export default function RootLayout({ - children, -}: { - children: React.ReactNode -}) { +export default function RootLayout({ children }: RootLayoutProps) { return ( {children}