Skip to content

Commit bcc71fd

Browse files
committed
Add prettier to pre-commit & sane default config
1 parent 7dd98f8 commit bcc71fd

File tree

4 files changed

+50
-34
lines changed

4 files changed

+50
-34
lines changed

.gitpod.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ ports:
1414
onOpen: ignore
1515
- port: 9229
1616
onOpen: ignore
17-
# Go proxy
17+
# Go proxy
1818
- port: 9999
1919
onOpen: ignore
2020
- port: 13001
2121
onOpen: ignore
22-
# Werft
22+
# Werft
2323
- port: 7777
2424
onOpen: ignore
25-
# Dev Theia
25+
# Dev Theia
2626
- port: 13444
2727
tasks:
2828
- name: Add Harvester kubeconfig
@@ -40,6 +40,9 @@ tasks:
4040
- name: Go
4141
init: leeway exec --filter-type go -v -- go mod verify
4242
openMode: split-right
43+
- name: pre-commit
44+
# install pre-commit hooks into git
45+
before: pre-commit install
4346
vscode:
4447
extensions:
4548
- bradlc.vscode-tailwindcss

.pre-commit-config.yaml

+36-30
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,40 @@
11
repos:
2-
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.0.1
4-
hooks:
5-
#- id: check-yaml
6-
# args: [--allow-multiple-documents]
7-
# - id: end-of-file-fixer
8-
- id: trailing-whitespace
9-
exclude: .*/src/main/java/io/gitpod/supervisor/api/.*
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.1.0
4+
hooks:
5+
#- id: check-yaml
6+
# args: [--allow-multiple-documents]
7+
# - id: end-of-file-fixer
8+
- id: trailing-whitespace
9+
exclude: .*/src/main/java/io/gitpod/supervisor/api/.*
1010

11-
- id: check-symlinks
12-
- id: mixed-line-ending
13-
- id: check-case-conflict
14-
- id: check-executables-have-shebangs
15-
- id: check-shebang-scripts-are-executable
16-
- id: check-merge-conflict
11+
- id: check-symlinks
12+
- id: mixed-line-ending
13+
- id: check-case-conflict
14+
- id: check-executables-have-shebangs
15+
- id: check-shebang-scripts-are-executable
16+
- id: check-merge-conflict
1717

18+
# keep fork in sync!
19+
- repo: https://github.com/gitpod-io/pre-commit-hooks
20+
rev: "2.1.5"
21+
hooks:
22+
- id: forbid-binary
23+
exclude: |
24+
(?x)^(
25+
.*example-layer.tar.gz|
26+
.*\.(png|svg|ico|gpg)|
27+
dev/version-manifest/version-manifest|
28+
.*gradle-wrapper\.jar
29+
)$
30+
- id: script-must-have-extension
31+
- id: shellcheck
32+
args: [-e, "SC1090,SC1091"]
33+
exclude: .*/gradlew$
1834

19-
# keep fork in sync!
20-
- repo: https://github.com/gitpod-io/pre-commit-hooks
21-
rev: "2.1.5"
22-
hooks:
23-
- id: forbid-binary
24-
exclude: |
25-
(?x)^(
26-
.*example-layer.tar.gz|
27-
.*\.(png|svg|ico|gpg)|
28-
dev/version-manifest/version-manifest|
29-
.*gradle-wrapper\.jar
30-
)$
31-
- id: script-must-have-extension
32-
- id: shellcheck
33-
args: [-e, "SC1090,SC1091"]
34-
exclude: .*/gradlew$
35+
- repo: https://github.com/pre-commit/mirrors-prettier
36+
rev: "v2.5.1"
37+
hooks:
38+
- id: prettier
39+
# Only enabled for WebApp components initially, to build consensus and incrementally onboard others
40+
files: ^components\/(server|gitpod-protocol|gitpod-db|dashboard)\/.*\.ts(x?)$

.prettierrc.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"singleQuote": true,
3+
"printWidth": 120,
4+
"tabWidth": 4,
5+
"endOfLine": "auto",
6+
"trailingComma": "all"
7+
}

.werft/jobs/build/validate-changes.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ async function branchNameCheck(werft: Werft, config: JobConfig) {
2929

3030
async function preCommitCheck(werft: Werft) {
3131
werft.log("pre-commit checks", "Running pre-commit hooks.")
32-
const preCommitCmd = exec(`pre-commit run --all-files --show-diff-on-failure`, { slice: "pre-commit checks" });
32+
const preCommitCmd = exec(`pre-commit run --show-diff-on-failure`, { slice: "pre-commit checks" });
3333

3434
if (preCommitCmd.code != 0) {
3535
throw new Error(preCommitCmd.stderr.toString().trim())

0 commit comments

Comments
 (0)