Skip to article frontmatterSkip to article content

Coding policies and practices

Checks

Task runners

We like to use pre-commit where possible. It helps automate the execution of checks and autofixes so we rely less on our memories to run tools.

Formatting

We use auto-formatters for code format concerns, like indentation, line length, and more.

For Python, we use Ruff, and for JavaScript and more, we use Prettier.

Some specifics

Tailing commas

We prefer to use trailing commas in any multi-line objects or lists. Trailing commas make it easier to add or remove items from an object, and they make diffs more readable.

 const foo = [
     "bar",
-    "baz",
-    "qux"
+    "baz"
 ];

We prefer to see the diff below to the diff above:

 const foo = [
     "bar",
     "baz",
-    "qux",
 ];

Linting

We use linters to help make our code more consistent (examples), more clear (examples), and to avoid common pitfalls (examples).

For Python, we use Ruff, and for JavaScript/TypeScript, we use ESLint.

Testing

... TODO ...