Codacy wrapper for oxlint — the fast JavaScript/TypeScript linter.
Test the tool:
docker build -t codacy-oxlint .
docker run -it -v ${PWD}:/src -v ${PWD}/.codacyrc:/.codacyrc codacy-oxlintUpdating oxlint documentation:
- Run
npm run generate-docsto update rule documentation
Updating oxlint version:
- Update
.tool_versionwith the new oxlint version - Run
npm run generate-docsto update rule documentation - Open PR in codacy-oxlint
ESLint, TypeScript, React, Jest, Vitest, JSDoc, JSX a11y, Import, Next.js, Node, Promise, Vue, Unicorn, and OXC.
oxlint supports the configuration files:
.oxlintrc.json,
.oxlintrc.jsonc,
oxlint.config.json,
oxlint.config.jsonc
or the UI Codacy patterns.
See oxlint docs for configuration details.
This section is written for an AI coding agent (or a human) tasked with updating this repo — most commonly bumping the wrapped oxlint version, but also Node base image / CircleCI orb bumps. Follow it top to bottom.
This is a Codacy engine: a small Node.js/TypeScript wrapper with no build step and no npm
dependency on the tool itself — src/index.ts reads Codacy's .codacyrc (src/codacyrc.ts), then
src/engineImpl.ts shells out to the oxlint binary (spawnSync("oxlint", ["--format", "json", ...]))
and translates its JSON diagnostics into Codacy Issue lines on stdout. There's no codacy-seed
package and no compiled dist/ — both src/index.ts and docs-generator/docs-generator.ts run
directly via Node's --experimental-strip-types flag (see entrypoint.sh and the package.json
scripts). tsconfig.json has noEmit: true; it exists only so npx tsc --noEmit can type-check.
The docs/ directory is machine-consumed configuration, not just documentation:
docs/patterns.json— every oxlint rule Codacy knows about ("patterns":<plugin>_<rule>, e.g.eslint_no-unused-vars), with a Codacy category/level andenabled: falsefor all of them (rules are opt-in; Codacy's UI/.codacyrcdecides what's actually enabled per project). Also carries the oxlint version string. Generated file, do not hand-edit.docs/description/description.json+docs/description/<patternId>.md— human-readable titles/descriptions per pattern, scraped fromoxc.rs. Generated files, do not hand-edit.docs/multiple-tests/{all-patterns,with-config-file}/{patterns.xml,results.xml,src/}— fixtures used bycodacy-plugins-test's "multiple" DockerTest mode to validate real lint output against real source files.
All three generated artifacts come from docs-generator/docs-generator.ts (run via
npm run generate-docs), which:
- Runs
oxlint --rulesusing whateveroxlintbinary is onPATHto get the full rule list as Markdown — this means the generator needs the target oxlint version installed locally first (see step 1 below), not just bumped in.tool_version. - Parses that Markdown table into
{plugin, rule, category, level, enabled}entries (CATEGORY_MAPPING/PLUGIN_ALIASESin this file control the plugin→Codacy category mapping — check these if a bump adds a brand-new plugin oxlint didn't have before). - Fetches each rule's doc page from
https://oxc.rs/docs/guide/usage/linter/rules/<plugin>/<rule>.html(5 requests in parallel, 5s timeout each) — this needs network access, and a slow/unreachableoxc.rswill silently produce thin descriptions rather than fail loudly (see step 4 below).
| File | What it controls | What to check |
|---|---|---|
.tool_version |
The single source of truth for the oxlint version — read by the Dockerfile (npm install -g oxlint@"${VERSION}") and by docs-generator.ts's getOxlintVersion() (written into docs/patterns.json's "version" field) |
Bump to the target version. There is no package.json dependency on oxlint and no lockfile to regenerate — this file is the only pin. |
Dockerfile → FROM node:lts-alpine3.24 |
Node runtime the whole engine runs on | Only bump if asked explicitly or if the new oxlint release's engines.node requires it — don't bump opportunistically. |
.circleci/config.yml → codacy/base and codacy/plugins-test orbs |
Shared CircleCI steps and the codacy-plugins-test runner (run_multiple_tests: true) |
Check orb versions only if asked to update CI tooling itself; not tied to oxlint version bumps. |
This repo is new (first version merged via PR #1, a handful of follow-up fixes since) — there is no
prior "version bump" commit to pattern-match against yet. Expect the first few bumps to be purely
mechanical (.tool_version + regenerated docs/), and to become a precedent for the next agent:
consider looking at git log --oneline for whatever bump commits do exist by the time you read
this.
- Install the target oxlint version locally so the doc generator can query it directly:
npm install -g oxlint@<new-version>(matches what theDockerfiledoes) — then confirm withoxlint --version. - Bump
.tool_versionto the new version string (novprefix, e.g.1.85.0). - Regenerate the docs:
npm run generate-docs. This needs network access tooxc.rs. Review the diff indocs/patterns.json(new/removed/renamed pattern IDs — a plugin rename or new plugin shows up here first),docs/description/description.json, and the per-rule.mdfiles. - Sanity-check the description scrape: if
oxc.rswas flaky, somedocs/description/*.mdfiles will fall back to the generic "See the documentation for more details." blurb even thoughdescription.json's entry looks fine — grep for that string post-regeneration (grep -rl "See the documentation for more details" docs/description/) and re-runnpm run generate-docsif too many hit it (a handful is normal for genuinely thin upstream docs). - Type-check:
npx tsc --noEmit(no dedicated npm script for this;noEmit: trueintsconfig.jsonis deliberate — this only catches type errors, it does not build anything). - Build the Docker image:
docker build -t codacy-oxlint .. - Run
codacy-plugins-testlocally before pushing — clone https://github.com/codacy/codacy-plugins-test and run its "multiple" DockerTest mode against your local image tag, exercising both fixtures underdocs/multiple-tests/. Update the relevantresults.xmlif oxlint's message text or line numbers for those exact rules legitimately changed between versions (all-patternscovers a constant-reassignment, duplicate-key, anddebuggercheck;with-config-filecovers a repo-provided.oxlintrc.jsonbeing picked up correctly). - Iterate on failures, re-running only the relevant command after each fix.
- Commit the
.tool_versionbump together with the regenerateddocs/files (and any fixture updates) in one change. - Push and open a PR.
- Poll the PR's real CI checks until they all pass — local validation is NOT the finish line.
.circleci/config.ymlrunscodacy/checkout_and_version→publish_docker_local(build + save the image) →plugins_test(codacy_plugins_test/runwithrun_multiple_tests: true) → (master only)codacy/publish_docker→codacy/tag_version. After every push, rungh pr checks <pr-url>and keep re-polling (short sleep while any check ispending) until all finish. If a check fails, fetch its actual log (CircleCI, not a guess), find the true root cause, fix it, push again (never--no-verify, never force-push), and re-poll. Only stop iterating when every check passes, or you hit a genuine product/infra decision that needs a human — explain it in the PR rather than guessing.
| Symptom | Likely cause | Fix |
|---|---|---|
docs-generator throws "Failed to run oxlint --rules" |
The target oxlint version isn't installed locally yet, or an old oxlint on PATH doesn't match .tool_version |
Run npm install -g oxlint@<version> for the exact target version first, then re-run npm run generate-docs; confirm with oxlint --version. |
A rule's .md file is just "See the documentation for more details." |
oxc.rs request timed out (5s) or returned a page shape the scraper's <article>/<main> regex couldn't match |
Re-run npm run generate-docs (transient network flakiness is common); if it persists for that rule specifically, check the rule's actual page at https://oxc.rs/docs/guide/usage/linter/rules/<plugin>/<rule>.html for a structural change and adjust the scraping regexes in docs-generator/docs-generator.ts if needed. |
multiple DockerTest fails on all-patterns or with-config-file |
oxlint's diagnostic message text, severity, or line/column for one of the exact rules those fixtures exercise changed upstream | Confirm the new output is correct against oxlint's own changelog/release notes, then update that fixture's results.xml to match. |
A brand-new plugin appears in docs/patterns.json mapped to a generic CodeStyle/Warning default |
CATEGORY_MAPPING in docs-generator/docs-generator.ts doesn't have an entry for the new oxlint rule category yet |
Add the new category to CATEGORY_MAPPING with an appropriate Codacy category/level, then regenerate. |
.tool_versionbumped to the target oxlint version.docs/patterns.json,docs/description/description.json, anddocs/description/*.mdregenerated vianpm run generate-docsagainst the actually-installed target version, with any new/renamed/removed patterns reviewed and any thin-description fallbacks re-checked.npx tsc --noEmitpasses.- Docker image builds successfully (
docker build -t codacy-oxlint .). codacy-plugins-test's multiple-pattern DockerTest passes locally against the freshly built image for bothdocs/multiple-tests/fixtures;results.xmlupdated if output legitimately changed.- After pushing and opening/updating the PR, every CI check on it is green. Poll
gh pr checks <pr-url>and iterate on any failure (fetch the real CI log, fix, push, re-poll) until all pass — a passing local build is not sufficient, since the CI environment's toolchain and network access can differ from your local one.
Codacy is an Automated Code Review Tool that monitors your technical debt, helps you improve your code quality, teaches best practices to your developers, and helps you save time in Code Reviews.
- Identify new Static Analysis issues
- Commit and Pull Request Analysis with GitHub, BitBucket/Stash, GitLab (and also direct git repositories)
- Auto-comments on Commits and Pull Requests
- Integrations with Slack, HipChat, Jira, YouTrack
- Track issues in Code Style, Security, Error Proneness, Performance, Unused Code and other categories
Codacy also helps keep track of Code Coverage, Code Duplication, and Code Complexity.
Codacy supports PHP, Python, Ruby, Java, JavaScript, and Scala, among others.
Codacy is free for Open Source projects.