---
title: "Writing code"
description: "We use tooling to help us write better code and avoid mistakes. Make use of the tools described below when writing PHP, HTML, CSS, and JavaScript."
canonical_url: "https://codex.republic.se/writing-code"
section: "Pages"
---

# ✍🏻 Writing code

We use tooling to help us write better code and avoid mistakes. Make use of the tools described below when writing PHP, HTML, CSS, and JavaScript.

## Why have a common standard?

A few good reasons exist to use a shared coding standard when working on code with others. The most important ones which come to mind are:

- Removes cognitive load when writing code since you can focus on what the code does, not what it looks like.
- Makes it easier to scan code from different authors.
- Makes it easier to jump into projects and help each other out.
- Makes commits in Git easier to diff since the only changes between commits are changes that actually affect functionality.
- Makes it easier to onboard potential new colleagues or freelancers.

*Different types of languages have different types of standards, and we try to be pragmatic about it, but sometimes the syntax also has a deeper meaning. Make sure projects include `.editorconfig`, `eslint.config.mjs`, `.stylelintrc.json`, and `.prettierrc.json` files.*

## Tools

- [Vite](https://vitejs.dev/)
    - [DDEV and Vite](https://ddev.com/blog/working-with-vite-in-ddev/)
    - [Craft and Vite](https://nystudio107.com/docs/vite/#using-ddev)
- [Fractal](https://fractal.build/)
    - [Fractal and Twig](https://github.com/frctl/fractal/tree/main/packages/twig)

## Git

---

- [ EditorConfig ](/writing-code/editorconfig)
- [ Stylelint ](/writing-code/stylelint)
- [ Eslint ](/writing-code/eslint)
- [ Prettier ](/writing-code/prettier)
