Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fireairforce/utoo-lint

Repository files navigation

utoo-lint

utoo-lint logo

@utoo/lint is a High performance linter for JavaScript and TypeScript written by Zig. It uses yuku for parsing, AST traversal, scope tracking, and symbol resolution.

It currently has some performance advantages compared with other lint tools:

utoo-lint benchmark

Status

This repo is a working scaffold, not a production linter yet.

Useful docs:

Install

pnpm add -D @utoo/lint

Run it with:

pnpm exec utoo-lint src

CLI

utoo-lint [options] [file-or-directory ...]

If no target is provided, utoo-lint scans the current directory. It skips .git, .zig-cache, node_modules, vendor, and zig-out.

Start a frontend project from the packaged template:

cp node_modules/@utoo/lint/configs/frontend.json utoo.json
pnpm exec utoo-lint src

Run only a focused rule set:

utoo-lint --rules=no-debugger,no-unused-vars,@typescript-eslint/no-unused-vars src

Disable a rule from the command line:

utoo-lint --no-console=off src

Use machine-readable output:

utoo-lint --format=json src

Configuration

By default, utoo-lint reads utoo.json or utoo-lint.json from the current directory or its ancestors. Use --config=path/to/utoo.json for an explicit file or --no-config to ignore local config.

{
  "$schema": "https://raw.githubusercontent.com/fireairforce/utoo-lint/main/npm/utoo-lint/schema.json",
  "files": ["src/**/*.{js,jsx,ts,tsx}"],
  "ignores": ["dist", "node_modules"],
  "rules": {
    "no-console": "off",
    "no-debugger": "error",
    "@typescript-eslint/no-unused-vars": ["warn"]
  }
}

Rule values may be off, warn, error, 0, 1, 2, booleans, or an ESLint-style array whose first item is the severity and later items are native rule options.

To migrate an existing ESLint config into the native utoo format:

pnpm exec utoo-lint migrate eslint --from eslint.config.js --output utoo.json

JavaScript API

import { lintFiles } from "@utoo/lint";

const report = lintFiles(["src"], {
  config: "utoo.json",
  rules: ["no-debugger"]
});

Architecture

  • src/root.zig owns parsing, rule execution, and public API exports.
  • src/core.zig owns shared lint types, diagnostics, and common helpers.
  • src/rules/root.zig registers rules and dispatches AST visitor hooks.
  • src/rules/*.zig contains one lint rule per file.
  • src/main.zig owns CLI argument parsing, file discovery, and terminal output.
  • vendor/yuku is pinned as a git submodule so the parser API is reproducible.

The current rule engine deliberately uses Yuku's native flat AST and semantic traverser instead of converting to ESTree. That keeps the first version small and avoids a JS runtime dependency.

About

High performance linter for JavaScript and TypeScript written by Zig.

Resources

License

Contributing

Stars

9 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors