From 962b1f3563a8cb6ab706be93f842adb3dca8ce5c Mon Sep 17 00:00:00 2001 From: NV <2823112+nickvisut@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:14:11 -0700 Subject: [PATCH] [Closes #437] Attempt to fix intermittent prettier issues (#438) * add debugging statement to debug prettier issues * merge prettier config files * try to align prettier settings b/t 2.x and 3.x * install prettier 3.3.3, latest version * run prettier to catch discrepancies b/t v2 and v3 --- .github/workflows/pr.yml | 4 +- .prettierrc.json | 6 +- package-lock.json | 57 +++---------------- package.json | 3 +- src/backend/scripts/run-with-gcp-metadata.ts | 2 +- .../design_system/button/Button.module.css | 3 +- src/components/table/table.tsx | 2 +- src/components/taskCard/taskCard.tsx | 8 +-- src/pages/benchmarks/[benchmark_id]/index.tsx | 4 +- 9 files changed, 29 insertions(+), 60 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 9edf87c7..963d0f8a 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -31,7 +31,9 @@ jobs: - name: Install dependencies run: npm i --ci - name: Run format:check - run: npm run format:check + run: | + npm run format:version + npm run format:check - name: Run lint run: npm run lint diff --git a/.prettierrc.json b/.prettierrc.json index 0967ef42..a0eeb511 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1 +1,5 @@ -{} +{ + "tabWidth": 2, + "useTabs": false, + "trailingComma": "es5" +} diff --git a/package-lock.json b/package-lock.json index c9714521..4e367908 100644 --- a/package-lock.json +++ b/package-lock.json @@ -75,7 +75,7 @@ "lint-staged": "^13.1.0", "nextjs-server-modules": "^4.7.0", "nodemailer-mock": "^2.0.1", - "prettier": "^2.8.8", + "prettier": "^3.3.3", "rewiremock": "^3.14.5", "storybook": "^8.1.11", "testcontainers": "^9.8.0", @@ -6303,21 +6303,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@storybook/codemod/node_modules/prettier": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", - "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", - "dev": true, - "bin": { - "prettier": "bin/prettier.cjs" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/prettier/prettier?sponsor=1" - } - }, "node_modules/@storybook/codemod/node_modules/slash": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", @@ -19594,14 +19579,15 @@ } }, "node_modules/prettier": { - "version": "2.8.8", + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", + "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", "dev": true, - "license": "MIT", "bin": { - "prettier": "bin-prettier.js" + "prettier": "bin/prettier.cjs" }, "engines": { - "node": ">=10.13.0" + "node": ">=14" }, "funding": { "url": "https://github.com/prettier/prettier?sponsor=1" @@ -21799,21 +21785,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/storybook/node_modules/prettier": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", - "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", - "dev": true, - "bin": { - "prettier": "bin/prettier.cjs" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/prettier/prettier?sponsor=1" - } - }, "node_modules/storybook/node_modules/slash": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", @@ -29086,12 +29057,6 @@ "integrity": "sha512-5HviZNaZcfqP95rwpv+1HDgUamezbqdSYTyzjTvwtJSnIH+3vnbmWsItli8OFEndS984VT55M3jduxZbX351gg==", "dev": true }, - "prettier": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", - "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", - "dev": true - }, "slash": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", @@ -37760,7 +37725,9 @@ "dev": true }, "prettier": { - "version": "2.8.8", + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", + "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", "dev": true }, "prettier-fallback": { @@ -39250,12 +39217,6 @@ "integrity": "sha512-5HviZNaZcfqP95rwpv+1HDgUamezbqdSYTyzjTvwtJSnIH+3vnbmWsItli8OFEndS984VT55M3jduxZbX351gg==", "dev": true }, - "prettier": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", - "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", - "dev": true - }, "slash": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", diff --git a/package.json b/package.json index 72f92de6..cfe6c13f 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "postinstall": "next build --no-lint && nsm build --skip-build --only-api-files && npm run type-css", "format": "prettier --write --ignore-unknown .", "format:check": "prettier --check --ignore-unknown .", + "format:version": "prettier --version", "lint": "eslint .", "lint:fix": "eslint . --fix", "all:check": "npm run type:check && npm run type-css:check && npm run lint && npm run format:check && npm run test", @@ -93,7 +94,7 @@ "lint-staged": "^13.1.0", "nextjs-server-modules": "^4.7.0", "nodemailer-mock": "^2.0.1", - "prettier": "^2.8.8", + "prettier": "^3.3.3", "rewiremock": "^3.14.5", "storybook": "^8.1.11", "testcontainers": "^9.8.0", diff --git a/src/backend/scripts/run-with-gcp-metadata.ts b/src/backend/scripts/run-with-gcp-metadata.ts index 2be44ba5..2a81b364 100644 --- a/src/backend/scripts/run-with-gcp-metadata.ts +++ b/src/backend/scripts/run-with-gcp-metadata.ts @@ -18,7 +18,7 @@ const runWithGcpMetadata = async () => { const [projectId, regionPath, { access_token }]: [ string, string, - { access_token: string } + { access_token: string }, ] = await Promise.all([ gcpMetadata.project("project-id"), gcpMetadata.instance("region"), diff --git a/src/components/design_system/button/Button.module.css b/src/components/design_system/button/Button.module.css index f9950e62..80c0e252 100644 --- a/src/components/design_system/button/Button.module.css +++ b/src/components/design_system/button/Button.module.css @@ -18,7 +18,8 @@ } .default:hover { - box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.3), + box-shadow: + 0px 1px 2px 0px rgba(0, 0, 0, 0.3), 0px 1px 3px 1px rgba(0, 0, 0, 0.15); background-color: var(--primary-50); } diff --git a/src/components/table/table.tsx b/src/components/table/table.tsx index 563cd371..bbd0cb7b 100644 --- a/src/components/table/table.tsx +++ b/src/components/table/table.tsx @@ -264,7 +264,7 @@ interface EnhancedTableProps { */ export default function EnhancedTable< Person extends StudentWithIep | Para, - Column extends HeadCell + Column extends HeadCell, >({ people, onSubmit, headCells, type }: EnhancedTableProps) { const router = useRouter(); diff --git a/src/components/taskCard/taskCard.tsx b/src/components/taskCard/taskCard.tsx index 2d080217..0ac27a0e 100644 --- a/src/components/taskCard/taskCard.tsx +++ b/src/components/taskCard/taskCard.tsx @@ -56,10 +56,10 @@ const TaskCard = ({ task, isPara }: TaskCardProps) => { {!task.seen ? "NEW" : completionRate >= 100 - ? "DONE" - : `DUE: ${ - task.due_date ? format(task.due_date, "MM-dd-yyyy") : "N/A" - }`} + ? "DONE" + : `DUE: ${ + task.due_date ? format(task.due_date, "MM-dd-yyyy") : "N/A" + }`}
{task.first_name} {task.last_name} diff --git a/src/pages/benchmarks/[benchmark_id]/index.tsx b/src/pages/benchmarks/[benchmark_id]/index.tsx index 1b1bb83a..467de16e 100644 --- a/src/pages/benchmarks/[benchmark_id]/index.tsx +++ b/src/pages/benchmarks/[benchmark_id]/index.tsx @@ -270,8 +270,8 @@ const BenchmarkPage = () => { {hasInputChanged || updateTrialMutation.isLoading ? "Saving..." : updateTrialMutation.isError - ? "uh oh" - : "Saved to Cloud"} + ? "uh oh" + : "Saved to Cloud"}