diff --git a/.github/workflows/vscode.yaml b/.github/workflows/vscode.yaml index a17a5b916..e9f9eb399 100644 --- a/.github/workflows/vscode.yaml +++ b/.github/workflows/vscode.yaml @@ -30,6 +30,7 @@ jobs: key: ${{ matrix.runner }}-vscode-${{ env.VSCODE_VERSION }}-${{ steps.get-date.outputs.date }} - run: just vscode configure - run: just vscode lint + - run: just vscode check-format - run: just vscode test - uses: actions/cache/save@v3 if: steps.cache.outputs.cache-hit != 'true' @@ -53,6 +54,7 @@ jobs: key: docker-vscode-${{ env.VSCODE_VERSION }}-${{ steps.get-date.outputs.date }} - run: just vscode configure - run: just vscode lint + - run: just vscode check-format - run: just vscode test - uses: actions/cache/save@v3 if: steps.cache.outputs.cache-hit != 'true' diff --git a/extensions/vscode/.eslintrc.json b/extensions/vscode/.eslintrc.json index fb68d7ca3..0f3821a73 100644 --- a/extensions/vscode/.eslintrc.json +++ b/extensions/vscode/.eslintrc.json @@ -8,6 +8,9 @@ "plugins": [ "@typescript-eslint" ], + "extends": [ + "prettier" + ], "rules": { "@typescript-eslint/naming-convention": "warn", "@typescript-eslint/semi": "warn", @@ -22,4 +25,4 @@ "**/*.d.ts", "api" ] -} \ No newline at end of file +} diff --git a/extensions/vscode/.prettierrc b/extensions/vscode/.prettierrc new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/extensions/vscode/.prettierrc @@ -0,0 +1 @@ +{} diff --git a/extensions/vscode/justfile b/extensions/vscode/justfile index 0aa0836d4..d0c9a1b86 100644 --- a/extensions/vscode/justfile +++ b/extensions/vscode/justfile @@ -104,6 +104,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 + # Packages the extension. package os="$(just ../../os)" arch="$(just ../../arch)": #!/usr/bin/env bash diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index c480c29bd..203ef6331 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -26,8 +26,10 @@ "@typescript-eslint/parser": "^6.7.3", "@vscode/test-electron": "^2.3.8", "eslint": "^8.50.0", + "eslint-config-prettier": "^9.1.0", "glob": "^10.3.3", "mocha": "^10.2.0", + "prettier": "3.2.5", "typescript": "^5.2.2" }, "engines": { @@ -1008,6 +1010,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-scope": { "version": "7.2.2", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", @@ -2109,6 +2123,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/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 9ffe38650..295db474d 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -246,7 +246,7 @@ "when": "viewItem == posit.publisher.deployments.tree.item.deployment", "group": "inline" }, - { + { "command": "posit.publisher.files.addExclusion", "when": "viewItem == posit.publisher.files.isIncludedFile", "group": "inline" @@ -444,6 +444,8 @@ "watch": "tsc -watch -p ./", "pretest": "npm run compile", "lint": "eslint src --ext ts", + "format": "prettier . --write", + "check-format": "prettier . --check", "test": "node ./out/test/runTest.js" }, "devDependencies": { @@ -458,8 +460,10 @@ "@typescript-eslint/parser": "^6.7.3", "@vscode/test-electron": "^2.3.8", "eslint": "^8.50.0", + "eslint-config-prettier": "^9.1.0", "glob": "^10.3.3", "mocha": "^10.2.0", + "prettier": "3.2.5", "typescript": "^5.2.2" }, "dependencies": { @@ -469,4 +473,4 @@ "mutexify": "^1.4.0", "retry": "^0.13.1" } -} \ No newline at end of file +}