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 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: [ diff --git a/web/.prettierrc b/web/.prettierrc new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/web/.prettierrc @@ -0,0 +1 @@ +{} 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 diff --git a/web/package-lock.json b/web/package-lock.json index 93530ee1e..f0ccb39e6 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -27,9 +27,11 @@ "@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", + "prettier": "3.2.5", "sass": "^1.66.1", "typescript": "^5.0.2", "vite": "^5.0.12", @@ -2114,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", @@ -3520,6 +3534,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..7c2a328f4 100644 --- a/web/package.json +++ b/web/package.json @@ -10,6 +10,8 @@ "preview": "vite preview", "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" }, @@ -33,9 +35,11 @@ "@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", + "prettier": "3.2.5", "sass": "^1.66.1", "typescript": "^5.0.2", "vite": "^5.0.12",