glosslint/eslint checks JavaScript, TypeScript, Vue templates, YAML and JSON locale files, comments, and declared identifiers. It requires ESLint 9.15 or later and reads .agents/glossary.md by default.
For Nuxt projects using @nuxt/eslint and vue-i18n, see Nuxt and vue-i18n.
Spread glosslint() into your flat config after the parsers your project uses:
import glosslint from "glosslint/eslint";
import tseslint from "typescript-eslint";
import vueParser from "vue-eslint-parser";
import * as yamlParser from "yaml-eslint-parser";
export default [
{ files: ["**/*.ts"], languageOptions: { parser: tseslint.parser } },
{
files: ["**/*.vue"],
languageOptions: { parser: vueParser, parserOptions: { parser: tseslint.parser } },
},
{ files: ["**/*.yml"], languageOptions: { parser: yamlParser } },
...glosslint({ files: ["src/**/*.{ts,vue}", "locales/en.yml"] }),
];glosslint sets no parser of its own. Supply typescript-eslint for .ts, vue-eslint-parser for .vue, yaml-eslint-parser for YAML locales, and jsonc-eslint-parser for JSON locales. Scope locale files to your source locale. Plain JavaScript needs no extra parser.
Pass glossary to read another path, or corpus to pass a defineCorpus object instead. Passing both throws GLOSSLINT_C012.
import { defineCorpus, fromGlossary } from "glosslint";
import glosslint from "glosslint/eslint";
const corpus = defineCorpus({ extends: [fromGlossary()], wholeLabel: true });
export default [
// ...parsers
...glosslint({ corpus, files: ["src/**/*.{ts,vue}", "locales/en.yml"] }),
];Note
ESLint needs jiti or --flag unstable_native_nodejs_ts_config to load eslint.config.ts. An eslint.config.mjs with the same contents needs neither on Node 22.18+.
Options
Section titled "Options"All options on glosslint(options?) are optional.
glossary
Section titled "glossary"Default: ".agents/glossary.md".
Path resolved from process.cwd(), or a URL, to your glossary file, read once when the config builds. Cannot be combined with corpus.
corpus
Section titled "corpus"Default: none.
A Corpus object from defineCorpus to use instead of reading a glossary file. Cannot be combined with glossary.
Default: every file.
Glob patterns limiting which files the rules run on.
ignoreCallees
Section titled "ignoreCallees"Default: ["endsWith", "startsWith", "includes", "querySelector*"].
Functions whose first argument is never checked. A trailing * matches a prefix, and passing a list replaces the default. t, $t, te, and tm are always skipped.
identifierAvoid
Section titled "identifierAvoid"Default: false.
Reports avoid words inside declared names too. Off by default because renaming an identifier touches every caller.
kindOf
Section titled "kindOf"Default: none.
Decides a string's kind before glosslint's built-in classifier runs. See Casing rules.
To change rule severities or disable a rule, add a config object after the spread:
export default [
// ...parsers
...glosslint({ files: ["src/**/*.{ts,vue}", "locales/en.yml"] }),
{ rules: { "glosslint/identifier": "off" } },
];| Rule | Severity | Reports | Fix |
|---|---|---|---|
glosslint/term | error | GLOSSLINT_TERM, GLOSSLINT_CASE in strings | autofix, or a suggestion where the text's shape set its kind |
glosslint/avoid | error | GLOSSLINT_AVOID in strings | suggestion |
glosslint/comment | error | all three codes in comments | autofix for spelling and casing, suggestion for avoid words |
glosslint/identifier | warn | how a declared name splits into words | none, the message names the rename |
glosslint/term and glosslint/avoid
Section titled "glosslint/term and glosslint/avoid"Both rules check JS/TS string and template literals, Vue template text and static attributes, and YAML or JSON string values. glosslint/term autofixes spelling and casing, falling back to a suggestion when a context term's kind was guessed from text shape, while glosslint/avoid always offers an editor suggestion. See Casing rules and What glosslint doesn't check for skipped code strings, Vue attributes, and blanked spans.
glosslint/comment
Section titled "glosslint/comment"Checks line, block, and Vue HTML comments for spellings, avoid words, and exact or abbreviated casing, ignoring context casing and tool directives like eslint-disable. Spelling and casing findings autofix; avoid words offer a suggestion.
glosslint/identifier
Section titled "glosslint/identifier"Checks how declared variable, function, parameter, class, and property names split multi-word non-exact terms, keeping camel, snake, kebab, or SCREAMING_SNAKE style. It skips shorthand destructuring, never autofixes, and checks avoid words only when identifierAvoid is true.
Message format
Section titled "Message format"Each diagnostic is one line combining the headline, the avoid or term reason, Term: description, the nuance, and See <url> when those fields exist. Its ESLint messageId is the finding code, listed in Findings.
Worked example
Section titled "Worked example"With the eslint.config.ts above and the bike-share .agents/glossary.md, these three files:
# locales/en.yml
station:
title: Buy a day pass
description: Check-out starts when the dock lets go.<!-- src/StationCard.vue -->
<template>
<button title="Buy a Day pass">Find a hub near you</button>
</template>// src/rides.ts
// Free the rack when the ride ends.
export const endRide = () => "Return your e-bike to any dock.";
export const daypassTotal = 2;produce this output from eslint .:
locales/en.yml
2:16 error "day pass" is written "Day Pass" in labels glosslint/term
3:16 error "Check-out" is spelled "Checkout" glosslint/term
src/StationCard.vue
2:24 error "Day pass" is written "Day Pass" in labels glosslint/term
2:41 error Use "station" instead of "hub". Riders confuse it with the depot. Station: A group of docks on one street corner. See https://example.com/docs/stations glosslint/avoid
src/rides.ts
1:13 error Use "dock" instead of "rack". Racks are unpowered. Dock: A powered stand where one bike is locked. A station is a group of docks. See https://example.com/docs/docks glosslint/comment
2:43 error "e-bike" is spelled "eBike" glosslint/term
3:14 warning Rename "daypass" to "dayPass": the term is "Day Pass" glosslint/identifier
✖ 7 problems (6 errors, 1 warning)
4 errors and 0 warnings potentially fixable with the `--fix` option.Running eslint --fix applies the four autofixable glosslint/term findings: it rewrites locales/en.yml to title: Buy a Day Pass and description: Checkout starts when the dock lets go., fixes "Day pass" in src/StationCard.vue and "e-bike" in src/rides.ts, and leaves "hub" and "rack" as suggestions for a person alongside the daypassTotal rename warning.