Skip to content

Commit 79e8f6f

Browse files
committed
chore: swap to biome to speed up formatting
1 parent d3790bb commit 79e8f6f

File tree

37 files changed

+1209
-1255
lines changed

37 files changed

+1209
-1255
lines changed

.prettierignore

Lines changed: 0 additions & 94 deletions
This file was deleted.

.prettierignore.include

Lines changed: 0 additions & 20 deletions
This file was deleted.

.prettierrc.yaml

Lines changed: 0 additions & 18 deletions
This file was deleted.

.vscode/extensions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"github.vscode-codeql",
44
"golang.go",
55
"hashicorp.terraform",
6-
"esbenp.prettier-vscode",
6+
"biomejs.biome",
77
"foxundermoon.shell-format",
88
"emeraldwalk.runonsave",
99
"zxh404.vscode-proto3",

.vscode/settings.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
{
2+
"[html]": {
3+
"editor.defaultFormatter": "biomejs.biome"
4+
},
5+
"[json]": {
6+
"editor.defaultFormatter": "biomejs.biome"
7+
},
8+
"[typescript]": {
9+
"editor.defaultFormatter": "biomejs.biome"
10+
},
11+
"[typescriptreact]": {
12+
"editor.defaultFormatter": "biomejs.biome"
13+
},
214
"cSpell.words": [
315
"afero",
416
"agentsdk",

Makefile

Lines changed: 10 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ BOLD := $(shell tput bold 2>/dev/null)
386386
GREEN := $(shell tput setaf 2 2>/dev/null)
387387
RESET := $(shell tput sgr0 2>/dev/null)
388388

389-
fmt: fmt/eslint fmt/prettier fmt/terraform fmt/shfmt fmt/go
389+
fmt: fmt/eslint fmt/biome fmt/terraform fmt/shfmt fmt/go
390390
.PHONY: fmt
391391

392392
fmt/go:
@@ -402,16 +402,16 @@ fmt/eslint:
402402
pnpm run lint:fix
403403
.PHONY: fmt/eslint
404404

405-
fmt/prettier:
406-
echo "$(GREEN)==>$(RESET) $(BOLD)fmt/prettier$(RESET)"
405+
fmt/biome:
406+
echo "$(GREEN)==>$(RESET) $(BOLD)fmt/biome$(RESET)"
407407
cd site
408408
# Avoid writing files in CI to reduce file write activity
409409
ifdef CI
410410
pnpm run format:check
411411
else
412412
pnpm run format
413413
endif
414-
.PHONY: fmt/prettier
414+
.PHONY: fmt/biome
415415

416416
fmt/terraform: $(wildcard *.tf)
417417
echo "$(GREEN)==>$(RESET) $(BOLD)fmt/terraform$(RESET)"
@@ -486,10 +486,6 @@ gen: \
486486
docs/cli.md \
487487
docs/admin/audit-logs.md \
488488
coderd/apidoc/swagger.json \
489-
.prettierignore.include \
490-
.prettierignore \
491-
site/.prettierrc.yaml \
492-
site/.prettierignore \
493489
site/.eslintignore \
494490
site/e2e/provisionerGenerated.ts \
495491
site/src/theme/icons.json \
@@ -515,10 +511,6 @@ gen/mark-fresh:
515511
docs/cli.md \
516512
docs/admin/audit-logs.md \
517513
coderd/apidoc/swagger.json \
518-
.prettierignore.include \
519-
.prettierignore \
520-
site/.prettierrc.yaml \
521-
site/.prettierignore \
522514
site/.eslintignore \
523515
site/e2e/provisionerGenerated.ts \
524516
site/src/theme/icons.json \
@@ -591,7 +583,7 @@ provisionerd/proto/provisionerd.pb.go: provisionerd/proto/provisionerd.proto
591583
site/src/api/typesGenerated.ts: $(wildcard scripts/apitypings/*) $(shell find ./codersdk $(FIND_EXCLUSIONS) -type f -name '*.go')
592584
go run ./scripts/apitypings/ > $@
593585
./scripts/pnpm_install.sh
594-
pnpm exec prettier --write "$@"
586+
pnpm exec biome format --write "$@"
595587

596588
site/e2e/provisionerGenerated.ts: provisionerd/proto/provisionerd.pb.go provisionersdk/proto/provisioner.pb.go
597589
cd site
@@ -601,7 +593,7 @@ site/e2e/provisionerGenerated.ts: provisionerd/proto/provisionerd.pb.go provisio
601593
site/src/theme/icons.json: $(wildcard scripts/gensite/*) $(wildcard site/static/icon/*)
602594
go run ./scripts/gensite/ -icons "$@"
603595
./scripts/pnpm_install.sh
604-
pnpm exec prettier --write "$@"
596+
pnpm exec biome format --write "$@"
605597

606598
examples/examples.gen.json: scripts/examplegen/main.go examples/examples.go $(shell find ./examples/templates)
607599
go run ./scripts/examplegen/main.go > examples/examples.gen.json
@@ -612,22 +604,22 @@ coderd/rbac/object_gen.go: scripts/rbacgen/main.go coderd/rbac/object.go
612604
docs/admin/prometheus.md: scripts/metricsdocgen/main.go scripts/metricsdocgen/metrics
613605
go run scripts/metricsdocgen/main.go
614606
./scripts/pnpm_install.sh
615-
pnpm exec prettier --write ./docs/admin/prometheus.md
607+
pnpm exec biome format --write ./docs/admin/prometheus.md
616608

617609
docs/cli.md: scripts/clidocgen/main.go examples/examples.gen.json $(GO_SRC_FILES)
618610
CI=true BASE_PATH="." go run ./scripts/clidocgen
619611
./scripts/pnpm_install.sh
620-
pnpm exec prettier --write ./docs/cli.md ./docs/cli/*.md ./docs/manifest.json
612+
pnpm exec biome format --write ./docs/cli.md ./docs/cli/*.md ./docs/manifest.json
621613

622614
docs/admin/audit-logs.md: coderd/database/querier.go scripts/auditdocgen/main.go enterprise/audit/table.go coderd/rbac/object_gen.go
623615
go run scripts/auditdocgen/main.go
624616
./scripts/pnpm_install.sh
625-
pnpm exec prettier --write ./docs/admin/audit-logs.md
617+
pnpm exec biome format --write ./docs/admin/audit-logs.md
626618

627619
coderd/apidoc/swagger.json: $(shell find ./scripts/apidocgen $(FIND_EXCLUSIONS) -type f) $(wildcard coderd/*.go) $(wildcard enterprise/coderd/*.go) $(wildcard codersdk/*.go) $(wildcard enterprise/wsproxy/wsproxysdk/*.go) $(DB_GEN_FILES) .swaggo docs/manifest.json coderd/rbac/object_gen.go
628620
./scripts/apidocgen/generate.sh
629621
./scripts/pnpm_install.sh
630-
pnpm exec prettier --write ./docs/api ./docs/manifest.json ./coderd/apidoc/swagger.json
622+
pnpm exec biome format --write ./docs/api ./docs/manifest.json ./coderd/apidoc/swagger.json
631623

632624
update-golden-files: \
633625
cli/testdata/.gen-golden \
@@ -677,66 +669,6 @@ scripts/ci-report/testdata/.gen-golden: $(wildcard scripts/ci-report/testdata/*)
677669
go test ./scripts/ci-report -run=TestOutputMatchesGoldenFile -update
678670
touch "$@"
679671

680-
# Generate a prettierrc for the site package that uses relative paths for
681-
# overrides. This allows us to share the same prettier config between the
682-
# site and the root of the repo.
683-
site/.prettierrc.yaml: .prettierrc.yaml
684-
. ./scripts/lib.sh
685-
dependencies yq
686-
687-
echo "# Code generated by Makefile (../$<). DO NOT EDIT." > "$@"
688-
echo "" >> "$@"
689-
690-
# Replace all listed override files with relative paths inside site/.
691-
# - ./ -> ../
692-
# - ./site -> ./
693-
yq \
694-
'.overrides[].files |= map(. | sub("^./"; "") | sub("^"; "../") | sub("../site/"; "./") | sub("../!"; "!../"))' \
695-
"$<" >> "$@"
696-
697-
# Combine .gitignore with .prettierignore.include to generate .prettierignore.
698-
.prettierignore: .gitignore .prettierignore.include
699-
echo "# Code generated by Makefile ($^). DO NOT EDIT." > "$@"
700-
echo "" >> "$@"
701-
for f in $^; do
702-
echo "# $${f}:" >> "$@"
703-
cat "$$f" >> "$@"
704-
done
705-
706-
# Generate ignore files based on gitignore into the site directory. We turn all
707-
# rules into relative paths for the `site/` directory (where applicable),
708-
# following the pattern format defined by git:
709-
# https://git-scm.com/docs/gitignore#_pattern_format
710-
#
711-
# This is done for compatibility reasons, see:
712-
# https://github.com/prettier/prettier/issues/8048
713-
# https://github.com/prettier/prettier/issues/8506
714-
# https://github.com/prettier/prettier/issues/8679
715-
site/.eslintignore site/.prettierignore: .prettierignore Makefile
716-
rm -f "$@"
717-
touch "$@"
718-
# Skip generated by header, inherit `.prettierignore` header as-is.
719-
while read -r rule; do
720-
# Remove leading ! if present to simplify rule, added back at the end.
721-
tmp="$${rule#!}"
722-
ignore="$${rule%"$$tmp"}"
723-
rule="$$tmp"
724-
case "$$rule" in
725-
# Comments or empty lines (include).
726-
\#*|'') ;;
727-
# Generic rules (include).
728-
\*\**) ;;
729-
# Site prefixed rules (include).
730-
site/*) rule="$${rule#site/}";;
731-
./site/*) rule="$${rule#./site/}";;
732-
# Rules that are non-generic and don't start with site (rewrite).
733-
/*) rule=.."$$rule";;
734-
*/?*) rule=../"$$rule";;
735-
*) ;;
736-
esac
737-
echo "$${ignore}$${rule}" >> "$@"
738-
done < "$<"
739-
740672
test:
741673
gotestsum --format standard-quiet -- -v -short -count=1 ./...
742674
.PHONY: test

biome.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
3+
"organizeImports": {
4+
"enabled": false
5+
},
6+
"linter": {
7+
"enabled": false
8+
},
9+
"json": {
10+
"parser": {
11+
"allowComments": true
12+
}
13+
},
14+
"formatter": {
15+
"ignore": [
16+
"node_modules/",
17+
"build/",
18+
"provisioner/terraform/testdata/",
19+
"site/out/"
20+
],
21+
"indentStyle": "space",
22+
"indentWidth": 2,
23+
"lineWidth": 80
24+
},
25+
"javascript": {
26+
"formatter": {
27+
"trailingComma": "all"
28+
}
29+
}
30+
}

dogfood/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ RUN yarn global add --prefix=/usr/local \
284284
vercel \
285285
typescript \
286286
typescript-language-server \
287-
prettier && \
287+
@biomejs/biome && \
288288
yarn cache clean
289289

290290
# We use yq during "make deploy" to manually substitute out fields in

0 commit comments

Comments
 (0)