Skip to content

Add linting for code blocks, docs source, etc. #7798

@Cherry

Description

@Cherry

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.

Metadata

Metadata

Assignees

Labels

DevRelTasks that need support from developer relations.engineeringProblems or updates to developers.cloudflare.com website

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions