Skip to content

Commit 94f5d52

Browse files
chore: adopt markdownlint and markdown-table-formatter for *.md (coder#15831)
Co-authored-by: Edward Angert <EdwardAngert@users.noreply.github.com>
1 parent 08463c2 commit 94f5d52

File tree

255 files changed

+18358
-16865
lines changed

Some content is hidden

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

255 files changed

+18358
-16865
lines changed

Diff for: .github/workflows/docs-ci.yaml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Docs CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "docs/**"
9+
- "**.md"
10+
- ".github/workflows/docs-ci.yaml"
11+
12+
pull_request:
13+
paths:
14+
- "docs/**"
15+
- "**.md"
16+
- ".github/workflows/docs-ci.yaml"
17+
18+
jobs:
19+
docs:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
24+
25+
- name: Setup Node
26+
uses: ./.github/actions/setup-node
27+
28+
- uses: tj-actions/changed-files@bab30c2299617f6615ec02a68b9a40d10bd21366 # v45.0.5
29+
id: changed-files
30+
with:
31+
files: |
32+
docs/**
33+
**.md
34+
separator: ","
35+
36+
- name: lint
37+
if: steps.changed-files.outputs.any_changed == 'true'
38+
run: |
39+
pnpm exec markdownlint-cli2 ${{ steps.changed-files.outputs.all_changed_files }}
40+
41+
- name: fmt
42+
if: steps.changed-files.outputs.any_changed == 'true'
43+
run: |
44+
# markdown-table-formatter requires a space separated list of files
45+
echo ${{ steps.changed-files.outputs.all_changed_files }} | tr ',' '\n' | pnpm exec markdown-table-formatter --check

Diff for: .markdownlint.jsonc

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Example markdownlint configuration with all properties set to their default value
2+
{
3+
"MD010": { "spaces_per_tab": 4}, // No hard tabs: we use 4 spaces per tab
4+
5+
"MD013": false, // Line length: we are not following a strict line lnegth in markdown files
6+
7+
"MD024": { "siblings_only": true }, // Multiple headings with the same content:
8+
9+
"MD033": false, // Inline HTML: we use it in some places
10+
11+
"MD034": false, // Bare URL: we use it in some places in generated docs e.g.
12+
// codersdk/deployment.go L597, L1177, L2287, L2495, L2533
13+
// codersdk/workspaceproxy.go L196, L200-L201
14+
// coderd/tracing/exporter.go L26
15+
// cli/exp_scaletest.go L-9
16+
17+
"MD041": false, // First line in file should be a top level heading: All of our changelogs do not start with a top level heading
18+
// TODO: We need to update /home/coder/repos/coder/coder/scripts/release/generate_release_notes.sh to generate changelogs that follow this rule
19+
20+
"MD052": false, // Image reference: Not a valid reference in generated docs
21+
// docs/reference/cli/server.md L628
22+
23+
"MD055": false, // Table pipe style: Some of the generated tables do not have ending pipes
24+
// docs/reference/api/schema.md
25+
// docs/reference/api/templates.md
26+
// docs/reference/cli/server.md
27+
28+
"MD056": false // Table column count: Some of the auto-generated tables have issues. TODO: This is probably because of splitting cell content to multiple lines.
29+
// docs/reference/api/schema.md
30+
// docs/reference/api/templates.md
31+
}

Diff for: .prettierignore

-96
This file was deleted.

Diff for: .prettierignore.include

-14
This file was deleted.

Diff for: .vscode/extensions.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
22
"recommendations": [
3+
"biomejs.biome",
4+
"bradlc.vscode-tailwindcss",
5+
"DavidAnson.vscode-markdownlint",
6+
"EditorConfig.EditorConfig",
7+
"emeraldwalk.runonsave",
8+
"foxundermoon.shell-format",
39
"github.vscode-codeql",
410
"golang.go",
511
"hashicorp.terraform",
6-
"esbenp.prettier-vscode",
7-
"foxundermoon.shell-format",
8-
"emeraldwalk.runonsave",
9-
"zxh404.vscode-proto3",
1012
"redhat.vscode-yaml",
1113
"tekumara.typos-vscode",
12-
"EditorConfig.EditorConfig",
13-
"biomejs.biome",
14-
"bradlc.vscode-tailwindcss"
14+
"zxh404.vscode-proto3"
1515
]
1616
}

Diff for: CODE_OF_CONDUCT.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
[https://coder.com/docs/coder-oss/latest/contributing/CODE_OF_CONDUCT](https://coder.com/docs/contributing/CODE_OF_CONDUCT)
1+
<!-- markdownlint-disable MD041 -->
2+
[https://coder.com/docs/contributing/CODE_OF_CONDUCT](https://coder.com/docs/contributing/CODE_OF_CONDUCT)

Diff for: CONTRIBUTING.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
https://coder.com/docs/CONTRIBUTING
1+
<!-- markdownlint-disable MD041 -->
2+
[https://coder.com/docs/CONTRIBUTING](https://coder.com/docs/CONTRIBUTING)

Diff for: Makefile

+43-24
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ BOLD := $(shell tput bold 2>/dev/null)
414414
GREEN := $(shell tput setaf 2 2>/dev/null)
415415
RESET := $(shell tput sgr0 2>/dev/null)
416416

417-
fmt: fmt/ts fmt/go fmt/terraform fmt/shfmt fmt/prettier
417+
fmt: fmt/ts fmt/go fmt/terraform fmt/shfmt fmt/biome fmt/markdown
418418
.PHONY: fmt
419419

420420
fmt/go:
@@ -438,15 +438,16 @@ else
438438
endif
439439
.PHONY: fmt/ts
440440

441-
fmt/prettier: .prettierignore
442-
echo "$(GREEN)==>$(RESET) $(BOLD)fmt/prettier$(RESET)"
441+
fmt/biome:
442+
echo "$(GREEN)==>$(RESET) $(BOLD)fmt/biome$(RESET)"
443+
cd site
443444
# Avoid writing files in CI to reduce file write activity
444445
ifdef CI
445446
pnpm run format:check
446447
else
447448
pnpm run format
448449
endif
449-
.PHONY: fmt/prettier
450+
.PHONY: fmt/biome
450451

451452
fmt/terraform: $(wildcard *.tf)
452453
echo "$(GREEN)==>$(RESET) $(BOLD)fmt/terraform$(RESET)"
@@ -463,7 +464,13 @@ else
463464
endif
464465
.PHONY: fmt/shfmt
465466

466-
lint: lint/shellcheck lint/go lint/ts lint/examples lint/helm lint/site-icons
467+
fmt/markdown:
468+
echo "$(GREEN)==>$(RESET) $(BOLD)fmt/markdown$(RESET)"
469+
./scripts/pnpm_install.sh
470+
pnpm format-docs
471+
.PHONY: fmt/markdown
472+
473+
lint: lint/shellcheck lint/go lint/ts lint/examples lint/helm lint/site-icons lint/markdown
467474
.PHONY: lint
468475

469476
lint/site-icons:
@@ -497,6 +504,11 @@ lint/helm:
497504
make lint
498505
.PHONY: lint/helm
499506

507+
lint/markdown:
508+
./scripts/pnpm_install.sh
509+
pnpm lint-docs
510+
.PHONY: lint/markdown
511+
500512
# All files generated by the database should be added here, and this can be used
501513
# as a target for jobs that need to run after the database is generated.
502514
DB_GEN_FILES := \
@@ -530,8 +542,6 @@ GEN_FILES := \
530542
docs/reference/cli/index.md \
531543
docs/admin/security/audit-logs.md \
532544
coderd/apidoc/swagger.json \
533-
.prettierignore.include \
534-
.prettierignore \
535545
provisioner/terraform/testdata/version \
536546
site/e2e/provisionerGenerated.ts \
537547
site/src/theme/icons.json \
@@ -566,8 +576,6 @@ gen/mark-fresh:
566576
docs/reference/cli/index.md \
567577
docs/admin/security/audit-logs.md \
568578
coderd/apidoc/swagger.json \
569-
.prettierignore.include \
570-
.prettierignore \
571579
site/e2e/provisionerGenerated.ts \
572580
site/src/theme/icons.json \
573581
examples/examples.gen.json \
@@ -648,6 +656,9 @@ vpn/vpn.pb.go: vpn/vpn.proto
648656
site/src/api/typesGenerated.ts: $(wildcard scripts/apitypings/*) $(shell find ./codersdk $(FIND_EXCLUSIONS) -type f -name '*.go')
649657
# -C sets the directory for the go run command
650658
go run -C ./scripts/apitypings main.go > $@
659+
cd site
660+
../scripts/pnpm_install.sh
661+
pnpm exec biome format --write src/api/typesGenerated.ts
651662

652663
site/e2e/provisionerGenerated.ts: provisionerd/proto/provisionerd.pb.go provisionersdk/proto/provisioner.pb.go
653664
cd site
@@ -656,8 +667,9 @@ site/e2e/provisionerGenerated.ts: provisionerd/proto/provisionerd.pb.go provisio
656667

657668
site/src/theme/icons.json: $(wildcard scripts/gensite/*) $(wildcard site/static/icon/*)
658669
go run ./scripts/gensite/ -icons "$@"
659-
./scripts/pnpm_install.sh
660-
pnpm -C site/ exec biome format --write src/theme/icons.json
670+
cd site
671+
../scripts/pnpm_install.sh
672+
pnpm exec biome format --write src/theme/icons.json
661673

662674
examples/examples.gen.json: scripts/examplegen/main.go examples/examples.go $(shell find ./examples/templates)
663675
go run ./scripts/examplegen/main.go > examples/examples.gen.json
@@ -676,29 +688,45 @@ codersdk/rbacresources_gen.go: scripts/typegen/codersdk.gotmpl scripts/typegen/m
676688

677689
site/src/api/rbacresourcesGenerated.ts: scripts/typegen/codersdk.gotmpl scripts/typegen/main.go coderd/rbac/object.go coderd/rbac/policy/policy.go
678690
go run scripts/typegen/main.go rbac typescript > "$@"
691+
cd site
692+
../scripts/pnpm_install.sh
693+
pnpm exec biome format --write src/api/rbacresourcesGenerated.ts
679694

680695
site/src/api/countriesGenerated.ts: scripts/typegen/countries.tstmpl scripts/typegen/main.go codersdk/countries.go
681696
go run scripts/typegen/main.go countries > "$@"
697+
cd site
698+
../scripts/pnpm_install.sh
699+
pnpm exec biome format --write src/api/countriesGenerated.ts
682700

683701
docs/admin/integrations/prometheus.md: scripts/metricsdocgen/main.go scripts/metricsdocgen/metrics
684702
go run scripts/metricsdocgen/main.go
685703
./scripts/pnpm_install.sh
686-
pnpm exec prettier --write ./docs/admin/integrations/prometheus.md
704+
pnpm exec markdownlint-cli2 --fix ./docs/admin/integrations/prometheus.md
705+
pnpm exec markdown-table-formatter ./docs/admin/integrations/prometheus.md
687706

688707
docs/reference/cli/index.md: scripts/clidocgen/main.go examples/examples.gen.json $(GO_SRC_FILES)
689708
CI=true BASE_PATH="." go run ./scripts/clidocgen
690709
./scripts/pnpm_install.sh
691-
pnpm exec prettier --write ./docs/reference/cli/index.md ./docs/reference/cli/*.md ./docs/manifest.json
710+
pnpm exec markdownlint-cli2 --fix ./docs/reference/cli/*.md
711+
pnpm exec markdown-table-formatter ./docs/reference/cli/*.md
712+
cd site
713+
../scripts/pnpm_install.sh
714+
pnpm exec biome format --write ../docs/manifest.json
692715

693716
docs/admin/security/audit-logs.md: coderd/database/querier.go scripts/auditdocgen/main.go enterprise/audit/table.go coderd/rbac/object_gen.go
694717
go run scripts/auditdocgen/main.go
695718
./scripts/pnpm_install.sh
696-
pnpm exec prettier --write ./docs/admin/security/audit-logs.md
719+
pnpm exec markdownlint-cli2 --fix ./docs/admin/security/audit-logs.md
720+
pnpm exec markdown-table-formatter ./docs/admin/security/audit-logs.md
697721

698722
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
699723
./scripts/apidocgen/generate.sh
700724
./scripts/pnpm_install.sh
701-
pnpm exec prettier --write ./docs/reference/api ./docs/manifest.json ./coderd/apidoc/swagger.json
725+
pnpm exec markdownlint-cli2 --fix ./docs/reference/api/*.md
726+
pnpm exec markdown-table-formatter ./docs/reference/api/*.md
727+
cd site
728+
../scripts/pnpm_install.sh
729+
pnpm exec biome format --write ../docs/manifest.json ../coderd/apidoc/swagger.json
702730

703731
update-golden-files: \
704732
cli/testdata/.gen-golden \
@@ -769,15 +797,6 @@ provisioner/terraform/testdata/version:
769797
fi
770798
.PHONY: provisioner/terraform/testdata/version
771799

772-
# Combine .gitignore with .prettierignore.include to generate .prettierignore.
773-
.prettierignore: .gitignore .prettierignore.include
774-
echo "# Code generated by Makefile ($^). DO NOT EDIT." > "$@"
775-
echo "" >> "$@"
776-
for f in $^; do
777-
echo "# $${f}:" >> "$@"
778-
cat "$$f" >> "$@"
779-
done
780-
781800
test:
782801
$(GIT_FLAGS) gotestsum --format standard-quiet -- -v -short -count=1 ./...
783802
.PHONY: test

0 commit comments

Comments
 (0)