Skip to content

chore: fix linting issues and generated files #10317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 17, 2023
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/setup-sqlc/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ runs:
using: "composite"
steps:
- name: Setup sqlc
uses: sqlc-dev/setup-sqlc@v3
uses: sqlc-dev/setup-sqlc@v4
with:
sqlc-version: "1.20.0"
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,6 @@ lint: lint/shellcheck lint/go lint/ts lint/helm lint/site-icons

lint/site-icons:
./scripts/check_site_icons.sh

.PHONY: lint/site-icons

lint/ts:
Expand Down Expand Up @@ -517,6 +516,8 @@ coderd/database/dump.sql: coderd/database/gen/dump/main.go $(wildcard coderd/dat
go run ./coderd/database/gen/dump/main.go

# Generates Go code for querying the database.
# coderd/database/queries.sql.go
# coderd/database/models.go
coderd/database/querier.go: coderd/database/sqlc.yaml coderd/database/dump.sql $(wildcard coderd/database/queries/*.sql)
./coderd/database/generate.sh

Expand All @@ -539,19 +540,18 @@ provisionerd/proto/provisionerd.pb.go: provisionerd/proto/provisionerd.proto
--go-drpc_opt=paths=source_relative \
./provisionerd/proto/provisionerd.proto

site/src/api/typesGenerated.ts: scripts/apitypings/main.go $(shell find ./codersdk $(FIND_EXCLUSIONS) -type f -name '*.go')
go run ./scripts/apitypings/ > site/src/api/typesGenerated.ts
cd site
pnpm run format:types ./src/api/typesGenerated.ts
site/src/api/typesGenerated.ts: $(wildcard scripts/apitypings/*) $(shell find ./codersdk $(FIND_EXCLUSIONS) -type f -name '*.go')
go run ./scripts/apitypings/ > $@
pnpm run format:write:only "$@"

site/e2e/provisionerGenerated.ts: provisionerd/proto/provisionerd.pb.go provisionersdk/proto/provisioner.pb.go
cd site
../scripts/pnpm_install.sh
pnpm run gen:provisioner

site/src/theme/icons.json: $(wildcard site/static/icon/*)
go run ./scripts/gensite/ -icons $@
pnpm run format:write:only $@
site/src/theme/icons.json: $(wildcard scripts/gensite/*) $(wildcard site/static/icon/*)
go run ./scripts/gensite/ -icons "$@"
pnpm run format:write:only "$@"

examples/examples.gen.json: scripts/examplegen/main.go examples/examples.go $(shell find ./examples/templates)
go run ./scripts/examplegen/main.go > examples/examples.gen.json
Expand Down
3 changes: 2 additions & 1 deletion cli/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package cli
import (
"time"

"github.com/coder/pretty"
"github.com/google/uuid"
"golang.org/x/xerrors"

"github.com/coder/pretty"

"github.com/coder/coder/v2/cli/clibase"
"github.com/coder/coder/v2/cli/cliui"
"github.com/coder/coder/v2/codersdk"
Expand Down
3 changes: 2 additions & 1 deletion cli/templateversionarchive.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (
"strings"
"time"

"github.com/coder/pretty"
"golang.org/x/xerrors"

"github.com/coder/pretty"

"github.com/coder/coder/v2/cli/clibase"
"github.com/coder/coder/v2/cli/cliui"
"github.com/coder/coder/v2/codersdk"
Expand Down
3 changes: 2 additions & 1 deletion cli/templateversions.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import (
"strings"
"time"

"github.com/coder/pretty"
"github.com/google/uuid"
"golang.org/x/xerrors"

"github.com/coder/pretty"

"github.com/coder/coder/v2/cli/clibase"
"github.com/coder/coder/v2/cli/cliui"
"github.com/coder/coder/v2/codersdk"
Expand Down
5 changes: 3 additions & 2 deletions coderd/database/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}")
sqlc generate

first=true
for fi in queries/*.sql.go; do
files=$(find ./queries/ -type f -name "*.sql.go" | LC_ALL=C sort)
for fi in $files; do
# Find the last line from the imports section and add 1. We have to
# disable pipefail temporarily to avoid ERRPIPE errors when piping into
# `head -n1`.
Expand Down Expand Up @@ -56,7 +57,7 @@ SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}")
go mod download
go run golang.org/x/tools/cmd/goimports@latest -w queries.sql.go

go run ../../scripts/dbgen/main.go
go run ../../scripts/dbgen
# This will error if a view is broken.
go test -run=TestViewSubset
)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "coder",
"version": "0.0.0",
"scripts": {
"format:write:only": "pnpm exec prettier --write"
"format:write:only": "prettier --cache --write"
},
"devDependencies": {
"prettier": "3.0.0"
Expand Down
1 change: 0 additions & 1 deletion site/build/tsconfig.tsbuildinfo

This file was deleted.

7 changes: 3 additions & 4 deletions site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
"check:all": "pnpm format:check && pnpm lint && pnpm test",
"chromatic": "chromatic",
"dev": "vite",
"format:check": "pnpm exec prettier --cache --check '../**/*.{css,html,js,json,jsx,md,ts,tsx,yaml,yml}'",
"format:types": "pnpm exec prettier --cache --write './src/api/typesGenerated.ts'",
"format:write": "pnpm exec prettier --cache --write '../**/*.{css,html,js,json,jsx,md,ts,tsx,yaml,yml}'",
"format:write:only": "pnpm exec prettier --write",
"format:check": "prettier --cache --check '../**/*.{css,html,js,json,jsx,md,ts,tsx,yaml,yml}'",
"format:write": "prettier --cache --write '../**/*.{css,html,js,json,jsx,md,ts,tsx,yaml,yml}'",
"format:write:only": "prettier --cache --write",
"lint": "pnpm typegen && pnpm run lint:types && pnpm exec jest --selectProjects lint",
"lint:fix": "FIX=true pnpm lint",
"lint:types": "tsc --noEmit",
Expand Down