-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Description
The developer docs currently do not use any kind of linter/code formatting. This results in a lot of different coding styles, etc. in many code examples, as well as code in the repo itself. Linters can be very useful for flagging bugs, stylistic issues, typos, etc. before they're spotted by humans, as well as maintaining a consistent style and feel.
There are typos regularly found in code blocks, code blocks with bad highlighting (json for bash blocks, etc.), and other issues that would be spotted, reported, and prevented by adding linting and code formatting here.
I would also encourage the repo switch to hard tabs for indentation as per all of the reasons outlined at cloudflare/workers-sdk#1298, but that might be out of scope here.
I started some of this work at #5518 a while back, but it was a monster of a PR that is probably best handled by someone internally.
A lot of work here has already been done in https://github.com/cloudflare/cloudflare-docs/blob/production/bin/format.ts, but it was never finalised and/or re-enabled after the migration to Hugo.
Here's a short list with some example PRs that could have been caught and or aided with linting. This is by no means exhaustive.
- [D1] Fix sh codeblocks #7780
- [R2] Use sh codeblock and $ for curl in CORS guide #7795
- [ZT] Fix codeblock for uninstalling WARP on Linux #7797
- Clean up all "bash" and "sh" codeblocks #5885
- [Teams] Fix codeblocks in ssh-cert-bastion.md #1156
- Fixed typo in variable name #6850
- [WFP] Fix code example in dispatch Worker #7003
- [Queues] Codeblock cleanup #7673
- [Pages] Add $ to sh codeblocks for plugins #4771
- add missing shortcode closing tags #7882
- [Turnstile] Refactor codeblocks #6089
- [Docs Site] Change all internal links to relative #8303
- fix: schema for load-balancing payload #8350
- Update worker-variables.md fix broken function example #8393
- [Workers] fix example typo in routes.md #8596
- [Constellation] Clarify wrangler commands, fix bash codeblocks #9133
- [Workers] Fix Tail Worker example #9141
- [Vectorize] Vectorize database new tile #10908
- [workers-ai] Fixes and copy on RAG tut #10929
- [workers] Write r2 finetune tutorial #10754
- Update OpenAI function calling tutorial to latest SDK #12412
- Update runtime-api.md #13052
- workers: python examples #13800
- redoing bedrock docs + codeowner change #14008
- rate limiting: best practices on key choice #14111
- [Workers] Fix RPC promise pipelining example #15248
- docs: add missing comma in code example #15178