GitHub 1
Skip to content

Oxlint integration

Run glosslint's four rules as an Oxlint JS plugin on JavaScript, TypeScript, and Vue script blocks, using your glossary file.

Use glosslint/oxlint to run glosslint's four rules inside Oxlint on JavaScript, TypeScript, and <script> blocks inside Vue files. It reads .agents/glossary.md from Oxlint's working directory on the first file and requires Oxlint 1.94 or later as an optional peer dependency.

Warning

JavaScript plugins in Oxlint 1.94 are alpha. The glosslint/oxlint entry point or .oxlintrc.json shape may change as Oxlint's JS plugin API evolves.

Add "glosslint/oxlint" to jsPlugins and enable the four rules in .oxlintrc.json:

{
  "jsPlugins": ["glosslint/oxlint"],
  "rules": {
    "glosslint/term": "error",
    "glosslint/avoid": "error",
    "glosslint/comment": "error",
    "glosslint/identifier": "warn"
  }
}
.oxlintrc.json

Run Oxlint as usual, and pass --fix to apply autofixes:

npx oxlint
npx oxlint --fix

Because Oxlint has no config hook that runs before the first file, the plugin reads .agents/glossary.md (or settings.glosslint.glossary) from context.cwd when the first file is linted and caches the corpus for the rest of the process.

Configure the plugin under settings.glosslint in .oxlintrc.json:

{
  "jsPlugins": ["glosslint/oxlint"],
  "settings": {
    "glosslint": {
      "glossary": "docs/glossary.md",
      "ignoreCallees": ["endsWith", "startsWith", "includes", "querySelector*"],
      "identifierAvoid": false
    }
  },
  "rules": {
    "glosslint/term": "error",
    "glosslint/avoid": "error",
    "glosslint/comment": "error",
    "glosslint/identifier": "warn"
  }
}
.oxlintrc.json
SettingDefaultWhat it does
glossary".agents/glossary.md"Path to the glossary file, resolved from Oxlint's working directory.
ignoreCallees["endsWith", "startsWith", "includes", "querySelector*"]Functions whose first argument is never checked. A trailing * matches a prefix. Your list replaces the default. t, $t, te and tm are always skipped.
identifierAvoidfalseReport avoid words in declared identifier names too. Off by default, because a rename touches every caller.

glosslint/oxlint exports the same four rules as ESLint and uses the same string, comment, and identifier skipping logic described in What glosslint skips:

RuleReportsoxlint --fix
glosslint/termGLOSSLINT_TERM and GLOSSLINT_CASE in stringsApplies autofixes; leaves shape-guessed context suggestions alone
glosslint/avoidGLOSSLINT_AVOID in stringsNever autofixes (suggestions only)
glosslint/commentAll three codes in JS/TS line and block commentsApplies spelling and casing autofixes; leaves avoid-word suggestions alone
glosslint/identifierHow a declared name splits into words (and avoid words if identifierAvoid is true)Never autofixes (the message names the rename)

Use ESLint instead of or alongside Oxlint when your project needs any of the following:

  • Vue <template> blocks. Oxlint lints <script> inside .vue files, not <template>, because Oxlint JS plugins do not expose Vue template parser services.
  • YAML locale files. Oxlint does not lint .yml or .yaml files.
  • defineCorpus or kindOf. Oxlint jsPlugins entries are module specifiers and settings are JSON, so glosslint/oxlint takes a glossary file path only and cannot accept a Corpus object or a kindOf callback.

With the .oxlintrc.json above and the bike-share .agents/glossary.md, Oxlint checks these two files:

// Return the bike to any rack.
export const label = "Return your e-bike to any rack";
export const daypassTotal = 2;
src/rides.ts
<template>
  <!-- Not checked by Oxlint -->
  <p>Start the check-out at the bay.</p>
</template>

<script setup lang="ts">
// Free the rack when the ride ends.
const title = "Return your e-bike to a dock";
const daypassCount = [title];
</script>
src/ReturnCard.vue

Running oxlint reports the comment, string, avoid-word, and identifier findings in src/rides.ts and in the <script> block of src/ReturnCard.vue, while skipping <template>. Running oxlint --fix rewrites "e-bike" to "eBike" in both files and leaves "rack" and the daypassTotal / daypassCount warnings for a person to review.