Most projects only need .agents/glossary.md. Build a corpus in TypeScript with defineCorpus when you need options the glossary has no field for (skip, wholeLabel) or want to merge corpora across packages, then pass it to the tool that needs it. There is no config file that glosslint finds on its own.
import { defineCorpus, fromGlossary } from "glosslint";
const corpus = defineCorpus({
extends: [fromGlossary()],
terms: [
{
term: "Dock",
description: "A powered stand where one bike is locked.",
nuance: "A station is a group of docks.",
why: 'Riders read "dock" on the stand itself.',
avoid: [{ word: "rack", why: "Racks are unpowered." }, "bay"],
examples: { good: ["Return the bike to any dock"], bad: ["Return the bike to any rack"] },
links: [{ title: "Docks", url: "https://example.com/docs/docks" }],
translations: { de: "Dock" },
forms: { de: ["Dockingstation", "Dockingstationen"] },
},
],
wholeLabel: true,
});fromGlossary() reads .agents/glossary.md from the working directory; pass fromGlossary(new URL("./docs/glossary.md", import.meta.url)) for another path. defineCorpus validates on load and throws GlosslintConfigError on mistakes (Config and glossary errors).
Pass the corpus to a tool
Section titled "Pass the corpus to a tool"Write the corpus inline in the tool's config, or export it from any module and import it where you need it.
- ESLint.
glosslint({ corpus })ineslint.config.ts(ESLint). - x18n.
glosslint({ corpus })inx18n.config.ts, andtoX18nGlossary(corpus)for the translation glossary (x18n). - CLI.
--corpus <module>oncheck,test,print, andexplain, where the module's default export is the corpus (CLI).doctorreads only the Markdown glossary. - Oxlint. Takes no corpus: it reads
.agents/glossary.mdorsettings.glosslint.glossary(Oxlint).
Corpus fields
Section titled "Corpus fields"| Field | What it does |
|---|---|
extends | Corpora merged first: fromGlossary(...), presets, or another defineCorpus(...) (Merge order). |
terms | Term objects. Shared fields match The glossary file; TypeScript-only fields follow below. |
allow | Phrases never reported (Allowing phrases). |
casing | Default style for context terms: { label, header, sentence } (Casing rules). |
wholeLabel | Set true to check every word of a label or header holding a context term (Casing rules). |
TypeScript-only term fields
Section titled "TypeScript-only term fields"Shared term fields (term, abbr, description, nuance, why, avoid, examples, links, case, casing, translations, forms) are documented in The glossary file. skip exists only in defineCorpus, and forms and translations are written as objects here:
| Property | What it does |
|---|---|
skip | ["lower"], ["upper"], or both: whole-word casings that always pass (tech sets both so github and GITHUB pass while Github fails). |
forms | Locale forms such as { de: ["Dockingstation", "Dockingstationen"] }, passed to x18n and matched by glosslint explain. |
translations | Locale translations such as { de: "Dock" }, passed to x18n. |
In .agents/glossary.md they are the Forms and Translations fields (Translations and forms).
Allowing phrases
Section titled "Allowing phrases"Findings inside an allow or Allow: phrase are dropped. Use it for second meanings like "roof rack" or "check out our", or to silence a preset term. Words match in any case, across spaces, hyphens, and underscores, and with s or es plurals.
Merge order
Section titled "Merge order"Terms merge by key: words joined and lowercased, letters and digits only ("Re-charge point" and "recharge point" share a key).
extendsmerges left to right; later corpora replace earlier terms with the same key.- Your own
termsreplace matching keys fromextends. Duplicate keys throwGLOSSLINT_C005(GLOSSLINT_G005in Markdown). - Replacement is whole; fields do not merge.
allowlists concatenate,extendsfirst, then yours.casingmerges per kind (label,header,sentence), last wins;wholeLabeltakes the last defined boolean.