Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .github/workflows/typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ HELO = "HELO"
LKE = "LKE"
byt = "byt"
typ = "typ"
Inferrable = "Inferrable"

[files]
extend-exclude = [
Expand All @@ -47,5 +48,5 @@ extend-exclude = [
"provisioner/terraform/testdata/**",
# notifications' golden files confuse the detector because of quoted-printable encoding
"coderd/notifications/testdata/**",
"agent/agentcontainers/testdata/devcontainercli/**"
"agent/agentcontainers/testdata/devcontainercli/**",
]
6 changes: 4 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"[javascript][javascriptreact][json][jsonc][typescript][typescriptreact]": {
"editor.defaultFormatter": "biomejs.biome",
"editor.codeActionsOnSave": {
"quickfix.biome": "explicit"
"source.fixAll.biome": "explicit"
// "source.organizeImports.biome": "explicit"
}
},
Expand All @@ -60,5 +60,7 @@
"typos.config": ".github/workflows/typos.toml",
"[markdown]": {
"editor.defaultFormatter": "DavidAnson.vscode-markdownlint"
}
},
"biome.configurationPath": "./site/biome.jsonc",
"biome.lsp.bin": "./site/node_modules/.bin/biome"
}
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,7 @@ lint/go:
./scripts/check_codersdk_imports.sh
linter_ver=$(shell egrep -o 'GOLANGCI_LINT_VERSION=\S+' dogfood/coder/Dockerfile | cut -d '=' -f 2)
go run github.com/golangci/golangci-lint/cmd/golangci-lint@v$$linter_ver run
go run github.com/coder/paralleltestctx/cmd/paralleltestctx@v0.0.1 -custom-funcs="testutil.Context" ./...
.PHONY: lint/go

lint/examples:
Expand Down
3 changes: 1 addition & 2 deletions agent/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,6 @@ func TestAgent_GitSSH(t *testing.T) {

func TestAgent_SessionTTYShell(t *testing.T) {
t.Parallel()
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
t.Cleanup(cancel)
if runtime.GOOS == "windows" {
// This might be our implementation, or ConPTY itself.
// It's difficult to find extensive tests for it, so
Expand All @@ -468,6 +466,7 @@ func TestAgent_SessionTTYShell(t *testing.T) {
for _, port := range sshPorts {
t.Run(fmt.Sprintf("(%d)", port), func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)

session := setupSSHSessionOnPort(t, agentsdk.Manifest{}, codersdk.ServiceBannerConfig{}, nil, port)
command := "sh"
Expand Down
4 changes: 3 additions & 1 deletion agent/agentcontainers/containers_dockercli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ func TestIntegrationDockerCLI(t *testing.T) {
}, testutil.WaitShort, testutil.IntervalSlow, "Container did not start in time")

dcli := agentcontainers.NewDockerCLI(agentexec.DefaultExecer)
ctx := testutil.Context(t, testutil.WaitMedium) // Longer timeout for multiple subtests
containerName := strings.TrimPrefix(ct.Container.Name, "/")

t.Run("DetectArchitecture", func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)

arch, err := dcli.DetectArchitecture(ctx, containerName)
require.NoError(t, err, "DetectArchitecture failed")
Expand All @@ -71,6 +71,7 @@ func TestIntegrationDockerCLI(t *testing.T) {

t.Run("Copy", func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)

want := "Help, I'm trapped!"
tempFile := filepath.Join(t.TempDir(), "test-file.txt")
Expand All @@ -90,6 +91,7 @@ func TestIntegrationDockerCLI(t *testing.T) {

t.Run("ExecAs", func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)

// Test ExecAs without specifying user (should use container's default).
want := "root"
Expand Down
86 changes: 86 additions & 0 deletions biome.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true,
"defaultBranch": "main"
},
"files": {
"includes": [
"**",
"!**/pnpm-lock.yaml"
],
"ignoreUnknown": true
},
"linter": {
"rules": {
"a11y": {
"noSvgWithoutTitle": "off",
"useButtonType": "off",
"useSemanticElements": "off",
"noStaticElementInteractions": "off"
},
"correctness": {
"noUnusedImports": "warn",
"useUniqueElementIds": "off", // TODO: This is new but we want to fix it
"noNestedComponentDefinitions": "off", // TODO: Investigate, since it is used by shadcn components
"noUnusedVariables": {
"level": "warn",
"options": {
"ignoreRestSiblings": true
}
}
},
"style": {
"noNonNullAssertion": "off",
"noParameterAssign": "off",
"useDefaultParameterLast": "off",
"useSelfClosingElements": "off",
"useAsConstAssertion": "error",
"useEnumInitializers": "error",
"useSingleVarDeclarator": "error",
"noUnusedTemplateLiteral": "error",
"useNumberNamespace": "error",
"noInferrableTypes": "error",
"noUselessElse": "error",
"noRestrictedImports": {
"level": "error",
"options": {
"paths": {
"@mui/material": "Use @mui/material/<name> instead. See: https://material-ui.com/guides/minimizing-bundle-size/.",
"@mui/icons-material": "Use @mui/icons-material/<name> instead. See: https://material-ui.com/guides/minimizing-bundle-size/.",
"@mui/material/Avatar": "Use components/Avatar/Avatar instead.",
"@mui/material/Alert": "Use components/Alert/Alert instead.",
"@mui/material/Popover": "Use components/Popover/Popover instead.",
"@mui/material/Typography": "Use native HTML elements instead. Eg: <span>, <p>, <h1>, etc.",
"@mui/material/Box": "Use a <div> instead.",
"@mui/material/styles": "Import from @emotion/react instead.",
"lodash": "Use lodash/<name> instead."
}
}
}
},
"suspicious": {
"noArrayIndexKey": "off",
"noThenProperty": "off",
"noTemplateCurlyInString": "off",
"useIterableCallbackReturn": "off",
"noUnknownAtRules": "off", // Allow Tailwind directives
"noConsole": {
"level": "error",
"options": {
"allow": [
"error",
"info",
"warn"
]
}
}
},
"complexity": {
"noImportantStyles": "off" // TODO: check and fix !important styles
}
}
},
"$schema": "https://biomejs.dev/schemas/2.2.0/schema.json"
}
2 changes: 1 addition & 1 deletion coderd/telemetry/telemetry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,6 @@ func TestTelemetryItem(t *testing.T) {

func TestPrebuiltWorkspacesTelemetry(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitMedium)
db, _ := dbtestutil.NewDB(t)

cases := []struct {
Expand Down Expand Up @@ -435,6 +434,7 @@ func TestPrebuiltWorkspacesTelemetry(t *testing.T) {
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)

deployment, snapshot := collectSnapshot(ctx, t, db, func(opts telemetry.Options) telemetry.Options {
opts.Database = tc.storeFn(db)
Expand Down
2 changes: 2 additions & 0 deletions coderd/workspaceapps/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ func Test_ResolveRequest(t *testing.T) {
for _, c := range cases {
t.Run(c.name, func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)

// Try resolving a request for each app as the owner, without a
// token, then use the token to resolve each app.
Expand Down Expand Up @@ -589,6 +590,7 @@ func Test_ResolveRequest(t *testing.T) {

t.Run("TokenDoesNotMatchRequest", func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)

badToken := workspaceapps.SignedToken{
Request: (workspaceapps.Request{
Expand Down
1 change: 1 addition & 0 deletions coderd/workspaces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1800,6 +1800,7 @@ func TestWorkspaceFilter(t *testing.T) {
for _, c := range testCases {
t.Run(c.Name, func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)
workspaces, err := client.Workspaces(ctx, c.Filter)
require.NoError(t, err, "fetch workspaces")

Expand Down
1 change: 1 addition & 0 deletions enterprise/coderd/schedule/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ func TestTemplateUpdateBuildDeadlines(t *testing.T) {
for _, c := range cases {
t.Run(c.name, func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)

user := quietUser
if c.noQuietHours {
Expand Down
1 change: 1 addition & 0 deletions enterprise/wsproxy/wsproxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ resourceLoop:

t.Run(r.RegionName, func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)

derpMap := &tailcfg.DERPMap{
Regions: map[int]*tailcfg.DERPRegion{
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"storybook": "pnpm run -C site/ storybook"
},
"devDependencies": {
"@biomejs/biome": "2.2.0",
"markdown-table-formatter": "^1.6.1",
"markdownlint-cli2": "^0.16.0",
"quicktype": "^23.0.0"
Expand Down
91 changes: 91 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading