From 4c025416abeb360975a1cf0c29595518dde61845 Mon Sep 17 00:00:00 2001 From: Jordan Jensen Date: Wed, 20 Mar 2024 16:41:29 -0700 Subject: [PATCH 1/8] Install Prettier 3.2.5 --- web/package-lock.json | 16 ++++++++++++++++ web/package.json | 1 + 2 files changed, 17 insertions(+) diff --git a/web/package-lock.json b/web/package-lock.json index 93530ee1e..fbc801ed4 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -30,6 +30,7 @@ "eslint-plugin-cypress": "^2.14.0", "eslint-plugin-vue": "^9.17.0", "jsdom": "^24.0.0", + "prettier": "3.2.5", "sass": "^1.66.1", "typescript": "^5.0.2", "vite": "^5.0.12", @@ -3520,6 +3521,21 @@ "node": ">= 0.8.0" } }, + "node_modules/prettier": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/pretty-format": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", diff --git a/web/package.json b/web/package.json index b93a67e31..edded9e5a 100644 --- a/web/package.json +++ b/web/package.json @@ -36,6 +36,7 @@ "eslint-plugin-cypress": "^2.14.0", "eslint-plugin-vue": "^9.17.0", "jsdom": "^24.0.0", + "prettier": "3.2.5", "sass": "^1.66.1", "typescript": "^5.0.2", "vite": "^5.0.12", From e86a45b7c6d8c7d67b936154c031b477b1031aec Mon Sep 17 00:00:00 2001 From: Jordan Jensen Date: Wed, 20 Mar 2024 16:41:52 -0700 Subject: [PATCH 2/8] Create Prettier config file --- web/.prettierrc | 1 + 1 file changed, 1 insertion(+) create mode 100644 web/.prettierrc diff --git a/web/.prettierrc b/web/.prettierrc new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/web/.prettierrc @@ -0,0 +1 @@ +{} From 01987bad99ea8efc0531767cb5fe8b49d01ec6b7 Mon Sep 17 00:00:00 2001 From: Jordan Jensen Date: Wed, 20 Mar 2024 16:42:16 -0700 Subject: [PATCH 3/8] Install eslint-config-prettier --- web/package-lock.json | 13 +++++++++++++ web/package.json | 1 + 2 files changed, 14 insertions(+) diff --git a/web/package-lock.json b/web/package-lock.json index fbc801ed4..f0ccb39e6 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -27,6 +27,7 @@ "@vitejs/plugin-vue": "^5.0.3", "@vue/test-utils": "^2.4.1", "eslint": "^8.47.0", + "eslint-config-prettier": "^9.1.0", "eslint-plugin-cypress": "^2.14.0", "eslint-plugin-vue": "^9.17.0", "jsdom": "^24.0.0", @@ -2115,6 +2116,18 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/eslint-config-prettier": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", + "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", + "dev": true, + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, "node_modules/eslint-plugin-cypress": { "version": "2.15.1", "resolved": "https://registry.npmjs.org/eslint-plugin-cypress/-/eslint-plugin-cypress-2.15.1.tgz", diff --git a/web/package.json b/web/package.json index edded9e5a..877323439 100644 --- a/web/package.json +++ b/web/package.json @@ -33,6 +33,7 @@ "@vitejs/plugin-vue": "^5.0.3", "@vue/test-utils": "^2.4.1", "eslint": "^8.47.0", + "eslint-config-prettier": "^9.1.0", "eslint-plugin-cypress": "^2.14.0", "eslint-plugin-vue": "^9.17.0", "jsdom": "^24.0.0", From 92f3c1abac58dbe57e3de85198ad9d145f749af4 Mon Sep 17 00:00:00 2001 From: Jordan Jensen Date: Wed, 20 Mar 2024 16:45:21 -0700 Subject: [PATCH 4/8] Extend eslintrc with prettier --- web/.eslintrc.cjs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/web/.eslintrc.cjs b/web/.eslintrc.cjs index 9deec555a..ad8bae026 100644 --- a/web/.eslintrc.cjs +++ b/web/.eslintrc.cjs @@ -17,7 +17,10 @@ module.exports = { // Includes vue3-essential and vue3-strongly-recommended // https://eslint.vuejs.org/user-guide/#bundle-configurations - 'plugin:vue/vue3-recommended' + 'plugin:vue/vue3-recommended', + + // Avoid conflicts with the Prettier formatting + 'prettier' ], overrides: [ From 0b2352528a9037d189ac301caa6ef226d588a54c Mon Sep 17 00:00:00 2001 From: Jordan Jensen Date: Wed, 20 Mar 2024 16:48:32 -0700 Subject: [PATCH 5/8] Add npm format script --- web/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/web/package.json b/web/package.json index 877323439..ef505ef87 100644 --- a/web/package.json +++ b/web/package.json @@ -10,6 +10,7 @@ "preview": "vite preview", "lint": "eslint --ext .js,.ts,.vue,.cjs .", "fix": "eslint --ext .js,.ts,.vue,.cjs . --fix", + "format": "prettier . --write", "test": "vitest run", "watch": "vitest" }, From 877bbbf6e4287603aa9e3f5c1e8d2655dfa6fea0 Mon Sep 17 00:00:00 2001 From: Jordan Jensen Date: Wed, 20 Mar 2024 16:48:55 -0700 Subject: [PATCH 6/8] Add check-format npm script --- web/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/web/package.json b/web/package.json index ef505ef87..7c2a328f4 100644 --- a/web/package.json +++ b/web/package.json @@ -11,6 +11,7 @@ "lint": "eslint --ext .js,.ts,.vue,.cjs .", "fix": "eslint --ext .js,.ts,.vue,.cjs . --fix", "format": "prettier . --write", + "check-format": "prettier . --check", "test": "vitest run", "watch": "vitest" }, From 4d7d2f9b27289d5c29fabbb6568854bad309e092 Mon Sep 17 00:00:00 2001 From: Jordan Jensen Date: Wed, 20 Mar 2024 16:54:31 -0700 Subject: [PATCH 7/8] Add format just commands --- web/justfile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/web/justfile b/web/justfile index 7a2ef5900..1be55a9f0 100644 --- a/web/justfile +++ b/web/justfile @@ -83,6 +83,20 @@ lint: npm run lint +format: + #!/usr/bin/env bash + set -eou pipefail + {{ _with_debug }} + + npm run format + +check-format: + #!/usr/bin/env bash + set -eou pipefail + {{ _with_debug }} + + npm run check-format + # Launch a local web server instance in production mode. preview: #!/usr/bin/env bash From 65e1baacc639a5bbb85edb218b728721dcd403f3 Mon Sep 17 00:00:00 2001 From: Jordan Jensen Date: Wed, 20 Mar 2024 16:56:51 -0700 Subject: [PATCH 8/8] Add web lint and check-format to lint workflow --- .github/workflows/lint.yaml | 4 ++++ .github/workflows/web.yaml | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 8df235a1b..43fdfbbe6 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -16,3 +16,7 @@ jobs: - run: just vscode deps - run: just vscode lint - run: just vscode check-format + + - run: just web install + - run: just web lint + - run: just web check-format diff --git a/.github/workflows/web.yaml b/.github/workflows/web.yaml index 1fc733265..429c4ebde 100644 --- a/.github/workflows/web.yaml +++ b/.github/workflows/web.yaml @@ -10,5 +10,4 @@ jobs: fetch-depth: 0 - uses: ./.github/actions/setup - run: just web install - - run: just web lint - run: just web test