Skip to content

Conventions ​

Code ​

TopicConventionExample
LanguageJavaScript (no TypeScript)page.js
ComponentsOne component per file, PascalCase nameProductList.js
FunctionscamelCase, English verbfetchProducts, removeProduct
Displayed textin French"Ajouter un produit"
Commentsin French, only to explain a why// La page est rendue à chaque requête…
API callsonly in lib/lib/products.js
Stylesin app/globals.css, with the colour variablesvar(--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.