Conventions
Code
| Topic | Convention | Example |
|---|---|---|
| Language | JavaScript (no TypeScript) | page.js |
| Components | One component per file, PascalCase name | ProductList.js |
| Functions | camelCase, English verb | fetchProducts, removeProduct |
| Displayed text | in French | "Ajouter un produit" |
| Comments | in French, only to explain a why | // La page est rendue à chaque requête… |
| API calls | only in lib/ | lib/products.js |
| Styles | in app/globals.css, with the colour variables | var(--accent) |
Tests
- One test file per code file, in
__tests__/, named after it. - Test descriptions are in French:
it('affiche un message quand la liste est vide'). - Elements are looked up like a user would: by text, by role, by label. Not by CSS class.
- Never talk to the real API:
jest.mock('../lib/products').
Accessibility
- Error messages have
role="alert". - Buttons without explicit text have an
aria-label:Supprimer Lait. - Every field is inside a
<label>. - Colours have a light and a dark version (
prefers-color-scheme).
Git
feature/* branches → merge request to develop. Messages feat(web): …, fix(web): …. See The Git repository.