Skip to content

Commit d15f16f

Browse files
authored
chore: replace eslint with biome (coder#14263)
1 parent 7b09d98 commit d15f16f

File tree

592 files changed

+4131
-6259
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

592 files changed

+4131
-6259
lines changed

.editorconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ trim_trailing_whitespace = true
77
insert_final_newline = true
88
indent_style = tab
99

10-
[*.{md,json,yaml,yml,tf,tfvars,nix}]
10+
[*.{md,yaml,yml,tf,tfvars,nix}]
1111
indent_style = space
1212
indent_size = 2
1313

.prettierignore

+6-12
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,13 @@ result
7979
# by Prettier.
8080
helm/**/templates/*.yaml
8181

82-
# Terraform state files used in tests, these are automatically generated.
83-
# Example: provisioner/terraform/testdata/instance-id/instance-id.tfstate.json
84-
**/testdata/**/*.tf*.json
85-
8682
# Testdata shouldn't be formatted.
87-
scripts/apitypings/testdata/**/*.ts
88-
enterprise/tailnet/testdata/*.golden.html
89-
tailnet/testdata/*.golden.html
90-
91-
# Generated files shouldn't be formatted.
92-
site/e2e/provisionerGenerated.ts
83+
testdata/
9384

85+
# Ignore generated files
9486
**/pnpm-lock.yaml
95-
96-
# Ignore generated JSON (e.g. examples/examples.gen.json).
9787
**/*.gen.json
88+
89+
# Everything in site/ is formatted by Biome. For the rest of the repo though, we
90+
# need broader language support.
91+
site/

.prettierignore.include

+6-12
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,13 @@
22
# by Prettier.
33
helm/**/templates/*.yaml
44

5-
# Terraform state files used in tests, these are automatically generated.
6-
# Example: provisioner/terraform/testdata/instance-id/instance-id.tfstate.json
7-
**/testdata/**/*.tf*.json
8-
95
# Testdata shouldn't be formatted.
10-
scripts/apitypings/testdata/**/*.ts
11-
enterprise/tailnet/testdata/*.golden.html
12-
tailnet/testdata/*.golden.html
13-
14-
# Generated files shouldn't be formatted.
15-
site/e2e/provisionerGenerated.ts
6+
testdata/
167

8+
# Ignore generated files
179
**/pnpm-lock.yaml
18-
19-
# Ignore generated JSON (e.g. examples/examples.gen.json).
2010
**/*.gen.json
11+
12+
# Everything in site/ is formatted by Biome. For the rest of the repo though, we
13+
# need broader language support.
14+
site/

.vscode/extensions.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"zxh404.vscode-proto3",
1010
"redhat.vscode-yaml",
1111
"streetsidesoftware.code-spell-checker",
12-
"dbaeumer.vscode-eslint",
13-
"EditorConfig.EditorConfig"
12+
"EditorConfig.EditorConfig",
13+
"biomejs.biome"
1414
]
1515
}

.vscode/settings.json

+12-2
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@
190190
}
191191
]
192192
},
193-
"eslint.workingDirectories": ["./site"],
194193
"search.exclude": {
195194
"**.pb.go": true,
196195
"**/*.gen.json": true,
@@ -224,5 +223,16 @@
224223
// with VS Code.
225224
"typescript.tsdk": "./site/node_modules/typescript/lib",
226225
// Playwright tests in VSCode will open a browser to live "view" the test.
227-
"playwright.reuseBrowser": true
226+
"playwright.reuseBrowser": true,
227+
228+
"[javascript][javascriptreact][json][jsonc][typescript][typescriptreact]": {
229+
"editor.defaultFormatter": "biomejs.biome"
230+
// "editor.codeActionsOnSave": {
231+
// "source.organizeImports.biome": "explicit"
232+
// }
233+
},
234+
235+
"[css][html][markdown][yaml]": {
236+
"editor.defaultFormatter": "esbenp.prettier-vscode"
237+
}
228238
}

Makefile

+13-67
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ BOLD := $(shell tput bold 2>/dev/null)
391391
GREEN := $(shell tput setaf 2 2>/dev/null)
392392
RESET := $(shell tput sgr0 2>/dev/null)
393393

394-
fmt: fmt/eslint fmt/prettier fmt/terraform fmt/shfmt fmt/go
394+
fmt: fmt/ts fmt/go fmt/terraform fmt/shfmt fmt/prettier
395395
.PHONY: fmt
396396

397397
fmt/go:
@@ -401,15 +401,19 @@ fmt/go:
401401
go run mvdan.cc/[email protected] -w -l .
402402
.PHONY: fmt/go
403403

404-
fmt/eslint:
405-
echo "$(GREEN)==>$(RESET) $(BOLD)fmt/eslint$(RESET)"
404+
fmt/ts:
405+
echo "$(GREEN)==>$(RESET) $(BOLD)fmt/ts$(RESET)"
406406
cd site
407-
pnpm run lint:fix
408-
.PHONY: fmt/eslint
407+
# Avoid writing files in CI to reduce file write activity
408+
ifdef CI
409+
pnpm run check --linter-enabled=false
410+
else
411+
pnpm run check:fix
412+
endif
413+
.PHONY: fmt/ts
409414

410-
fmt/prettier:
415+
fmt/prettier: .prettierignore
411416
echo "$(GREEN)==>$(RESET) $(BOLD)fmt/prettier$(RESET)"
412-
cd site
413417
# Avoid writing files in CI to reduce file write activity
414418
ifdef CI
415419
pnpm run format:check
@@ -442,7 +446,7 @@ lint/site-icons:
442446

443447
lint/ts:
444448
cd site
445-
pnpm i && pnpm lint
449+
pnpm lint
446450
.PHONY: lint/ts
447451

448452
lint/go:
@@ -495,9 +499,6 @@ gen: \
495499
.prettierignore.include \
496500
.prettierignore \
497501
provisioner/terraform/testdata/version \
498-
site/.prettierrc.yaml \
499-
site/.prettierignore \
500-
site/.eslintignore \
501502
site/e2e/provisionerGenerated.ts \
502503
site/src/theme/icons.json \
503504
examples/examples.gen.json \
@@ -526,9 +527,6 @@ gen/mark-fresh:
526527
coderd/apidoc/swagger.json \
527528
.prettierignore.include \
528529
.prettierignore \
529-
site/.prettierrc.yaml \
530-
site/.prettierignore \
531-
site/.eslintignore \
532530
site/e2e/provisionerGenerated.ts \
533531
site/src/theme/icons.json \
534532
examples/examples.gen.json \
@@ -603,7 +601,6 @@ provisionerd/proto/provisionerd.pb.go: provisionerd/proto/provisionerd.proto
603601
site/src/api/typesGenerated.ts: $(wildcard scripts/apitypings/*) $(shell find ./codersdk $(FIND_EXCLUSIONS) -type f -name '*.go')
604602
go run ./scripts/apitypings/ > $@
605603
./scripts/pnpm_install.sh
606-
pnpm exec prettier --write "$@"
607604

608605
site/e2e/provisionerGenerated.ts: provisionerd/proto/provisionerd.pb.go provisionersdk/proto/provisioner.pb.go
609606
cd site
@@ -613,7 +610,7 @@ site/e2e/provisionerGenerated.ts: provisionerd/proto/provisionerd.pb.go provisio
613610
site/src/theme/icons.json: $(wildcard scripts/gensite/*) $(wildcard site/static/icon/*)
614611
go run ./scripts/gensite/ -icons "$@"
615612
./scripts/pnpm_install.sh
616-
pnpm exec prettier --write "$@"
613+
pnpm -C site/ exec biome format --write src/theme/icons.json
617614

618615
examples/examples.gen.json: scripts/examplegen/main.go examples/examples.go $(shell find ./examples/templates)
619616
go run ./scripts/examplegen/main.go > examples/examples.gen.json
@@ -702,23 +699,6 @@ scripts/ci-report/testdata/.gen-golden: $(wildcard scripts/ci-report/testdata/*)
702699
go test ./scripts/ci-report -run=TestOutputMatchesGoldenFile -update
703700
touch "$@"
704701

705-
# Generate a prettierrc for the site package that uses relative paths for
706-
# overrides. This allows us to share the same prettier config between the
707-
# site and the root of the repo.
708-
site/.prettierrc.yaml: .prettierrc.yaml
709-
. ./scripts/lib.sh
710-
dependencies yq
711-
712-
echo "# Code generated by Makefile (../$<). DO NOT EDIT." > "$@"
713-
echo "" >> "$@"
714-
715-
# Replace all listed override files with relative paths inside site/.
716-
# - ./ -> ../
717-
# - ./site -> ./
718-
yq \
719-
'.overrides[].files |= map(. | sub("^./"; "") | sub("^"; "../") | sub("../site/"; "./") | sub("../!"; "!../"))' \
720-
"$<" >> "$@"
721-
722702
# Combine .gitignore with .prettierignore.include to generate .prettierignore.
723703
.prettierignore: .gitignore .prettierignore.include
724704
echo "# Code generated by Makefile ($^). DO NOT EDIT." > "$@"
@@ -728,40 +708,6 @@ site/.prettierrc.yaml: .prettierrc.yaml
728708
cat "$$f" >> "$@"
729709
done
730710

731-
# Generate ignore files based on gitignore into the site directory. We turn all
732-
# rules into relative paths for the `site/` directory (where applicable),
733-
# following the pattern format defined by git:
734-
# https://git-scm.com/docs/gitignore#_pattern_format
735-
#
736-
# This is done for compatibility reasons, see:
737-
# https://github.com/prettier/prettier/issues/8048
738-
# https://github.com/prettier/prettier/issues/8506
739-
# https://github.com/prettier/prettier/issues/8679
740-
site/.eslintignore site/.prettierignore: .prettierignore Makefile
741-
rm -f "$@"
742-
touch "$@"
743-
# Skip generated by header, inherit `.prettierignore` header as-is.
744-
while read -r rule; do
745-
# Remove leading ! if present to simplify rule, added back at the end.
746-
tmp="$${rule#!}"
747-
ignore="$${rule%"$$tmp"}"
748-
rule="$$tmp"
749-
case "$$rule" in
750-
# Comments or empty lines (include).
751-
\#*|'') ;;
752-
# Generic rules (include).
753-
\*\**) ;;
754-
# Site prefixed rules (include).
755-
site/*) rule="$${rule#site/}";;
756-
./site/*) rule="$${rule#./site/}";;
757-
# Rules that are non-generic and don't start with site (rewrite).
758-
/*) rule=.."$$rule";;
759-
*/?*) rule=../"$$rule";;
760-
*) ;;
761-
esac
762-
echo "$${ignore}$${rule}" >> "$@"
763-
done < "$<"
764-
765711
test:
766712
$(GIT_FLAGS) gotestsum --format standard-quiet -- -v -short -count=1 ./...
767713
.PHONY: test

offlinedocs/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
"@chakra-ui/react": "2.8.2",
1717
"@emotion/react": "11.11.4",
1818
"@emotion/styled": "11.11.5",
19-
"@types/lodash": "4.14.196",
2019
"archiver": "6.0.2",
2120
"framer-motion": "^10.17.6",
2221
"front-matter": "4.0.2",
@@ -36,7 +35,7 @@
3635
"@types/react-dom": "18.3.0",
3736
"eslint": "8.56.0",
3837
"eslint-config-next": "14.0.1",
39-
"prettier": "3.1.0",
38+
"prettier": "3.3.3",
4039
"typescript": "5.3.2"
4140
},
4241
"engines": {

0 commit comments

Comments
 (0)