GitHub 0
Skip to content
glosslint is in preview and not on npm yet. Version 0.0.1 will be the first release.

Defining terms

Configure glosslint terms with descriptions, nuance, avoid words, abbreviations, casing options, locale forms, and inline test examples.

Each entry in a corpus defines one word or phrase from your product vocabulary. Add a term when you want glosslint to enforce its spelling, control its capitals, flag words to avoid, or print a definition alongside every finding.

Only term is required, so a minimal entry can be { term: "Checkout" }. Adding descriptions, nuance, avoid words, examples, and links gives people and coding agents the context behind each finding:

{
  term: "Dock",
  description: "A powered stand where one bike is locked.",
  nuance: "A station is a group of docks.",
  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" }],
}
ts
FieldWhat it does
termThe term as it should be written, such as Dock or eBike. Required.
descriptionWhat the concept is, in one sentence. Every finding about the term prints it.
nuanceHow the term differs from near ones and when not to use it. Every finding's message prints it, and it is the finding's why unless an avoid word gives its own reason.
avoidWords to report in favour of this term. Each is a string, or { word, why } where why becomes the finding's reason.
examples{ good, bad }: strings that glosslint test expects to pass and to be reported. They are the term's tests.
links[{ title, url }], pages that explain the term. The first url becomes the finding's see.
caseHow capitals are checked: exact, spelling (the default), or context. See Casing rules.
casingThis term's case style per kind of text, over the corpus's casing, such as { label: "as-written" }. A term with casing and no case is a context term. See Casing rules.
abbrAbbreviations of the term, such as DP for Day Pass. They are always checked as exact.
skip["lower"], ["upper"], or both: whole-word casings that always pass. The tech preset sets both, as case-police does, so github and GITHUB pass while Github is reported.
formsOther forms per locale, such as { de: ["Dockingstation", "Dockingstationen"] }. They go to x18n's glossary as they are, and glosslint explain finds a term by its forms.
translationsThe term's translation per locale, such as { de: "Dock" }, passed to x18n's glossary as it is.

Each entry in avoid is either a plain string like "bay" or an object { word, why } like { word: "rack", why: "Racks are unpowered." }. When why is set, it becomes the finding's reason instead of nuance.

Matching follows three rules:

  • Avoid words match in any case.
  • An avoid word with two capitals in a row, such as SM, matches only as written.
  • An avoid word with the same key as a term, such as day-pass for Day Pass, counts as a misspelling of that term and gives GLOSSLINT_TERM, not GLOSSLINT_AVOID. See Findings.

Note

A term's key is its words joined and lowercased, letters and digits only. See The corpus for how keys work during merging.

Plurals ending in s or es match both terms and avoid words. You do not need to list plural forms separately in avoid: glosslint reports "racks" and suggests "docks".

The examples field holds { good, bad } lists that act as the term's tests. When you run glosslint test through the CLI, every string in good must pass with no findings, and every string in bad must give a finding for that term. Run glosslint test in CI and after editing your corpus.