# Contributing to Inline Comment Rules and conventions for everyone who works on this repository. ## What this is A MailExtension (Manifest V3) for **Thunderbird** and **Betterbird**, version 128 or later. When you start typing inside a quoted block in the compose window, the add-on splits the quote at the caret and inserts your own text in between, styled and prefixed with a marker such as `[OH]:`. Overview: [README.md](./README.md), structure: [.docs/architecture/overview.md](./.docs/architecture/overview.md). ## Read first 1. `.plan/roadmap.md` – current state and next steps 2. the latest entry in `.plan/daily/` 3. `.docs/architecture/system-design.md` – flows and design decisions 4. `.docs/decisions/` – architecture decision records ## Language - **English** for code, identifiers, code comments, JSDoc, documentation, test names and commit messages. - Exceptions: the German UI strings in `src/_locales/de/messages.json`, the German readme `README.de.md` and the German listing texts. ## Commands ```bash npm install # development tools only (prettier, eslint, jsdom) npm test # unit and DOM tests (node:test + jsdom) npm run lint # ESLint with the JSDoc rules (eslint.config.mjs) npm run format # format all files with Prettier npm run check # format check + lint + tests; run before every push npm run build # check + dist/inline-comment-.xpi ``` ## Rules - **Bilingual UI:** every user-visible string comes from `_locales` (default locale `en`, plus `de`). Each UI string needs a key in **both** `src/_locales/en/messages.json` and `src/_locales/de/messages.json`, with an English `description`. In extension pages, mark elements with `data-i18n` (see `src/lib/i18n.js`); in scripts, use `i18n.getMessage()` of the WebExtension API (`messenger` or `browser`). `test/i18n.test.js` enforces identical keys and placeholders in both locales and that every key is used. - **Licence header:** every new `.js`, `.css`, `.html`, `.svg` and `.sh` file in `src/`, `test/` and `scripts/` needs the MPL-2.0 header: `.js` and `.css` as a block comment, HTML and SVG as `` (HTML directly after ``), shell scripts as `# ` lines after the shebang. `eslint.config.mjs` carries it as well. JSON files get no header. `test/license.test.js` enforces this. - **JSDoc:** every named function (function declarations, and function or arrow expressions assigned to a variable, property or object key) has a JSDoc block with a description, a typed `@param` for each parameter and a typed `@returns` when it returns a value. Inline callbacks passed directly as arguments are exempt. Prefer specific types (`unknown`, `object`, `Record`) over `*`, `Object` or `Function`, and write defaults in the description ("Defaults to …") instead of `[name=value]`. `npm run lint` enforces this. - **No markup in DOM sinks:** never use `innerHTML`, `insertAdjacentHTML` or `document.write`, and never assign to `outerHTML`. Build DOM nodes with `createElement`, `textContent` and `setAttribute`. Reading `outerHTML` (to hand a node to the editor via `insertHTML`) is fine. `test/dom-sinks.test.js` enforces this for every file in `src/`. - **Mail HTML:** inline CSS only; no `