Files
Oliver_Herb 9053327486 Inline Comment 0.2.0 - initial public release
Thunderbird/Betterbird add-on (Manifest V3): typing inside a quote splits
the quote and inserts your own text with a marker such as [OH]:.

- English and German user interface
- Licensed under the Mozilla Public License 2.0
- English documentation, JSDoc lint gate, 87 tests (node:test + jsdom)
2026-11-24 12:07:09 +01:00

88 lines
5.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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-<version>.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 `<!doctype html>`), 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<string, T>`) 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 `<style>` blocks, no classes. Other mail clients strip them.
- **No runtime dependencies** in the add-on. npm packages are development tools only.
- **Script format:** files in `src/lib/` are classic scripts in the UMD pattern
(`globalThis.InlineComment` plus `module.exports`), because compose scripts cannot load ES modules.
- **No secrets, no private infrastructure, no personal data** in the repository: no tokens or
passwords, no internal host names, IP addresses or local paths, no real names or e-mail addresses
of third persons. Examples and test fixtures use invented names and `example.com` addresses.
- **Version and changelog:** every change that ships in the `.xpi` gets an entry in `CHANGELOG.md`
and a new version in `package.json` **and** `src/manifest.json`. `test/manifest.test.js` checks
that all three match.
- **Tests:** new behaviour only with tests. Testable logic belongs in `src/lib/`; `compose.js` and
`background.js` stay thin.
- **Manual test before releases:** the jsdom tests cannot cover the real mail editor. Before a
release, run the manual test plan in `.docs/guides/testplan.md` in Thunderbird and record the
result (version, application, date) in `.plan/daily/<date>.md`.
- **Docs in the same commit:** update `README.md` / `README.de.md`, `.docs/`, `CHANGELOG.md` and
`.plan/daily/<date>.md` in the same commit as the change.
## Workflow
- **Develop:** change code and tests, run `npm run check`.
- **Try it in Thunderbird:** `npm run build`, then load `dist/inline-comment-<version>.xpi` as a
temporary add-on (`about:debugging` → "This Thunderbird" → "Load Temporary Add-on…"). The guides
in `.docs/guides/` describe the details.
- **Release:** bump the version, update `CHANGELOG.md`, pass the manual test plan, then publish the
`.xpi` as a release in the public repository. Submission to addons.thunderbird.net is planned (see
`.plan/roadmap.md`).