RUST · THE FLARE SUITE

flarelint — OXC-Powered Static AST Linter for Cloudflare Workers & Astro

flarelint is a nanosecond-fast static analysis linter built on the Rust OXC parser for Cloudflare Workers, Pages, and Astro edge applications. It catches unawaited floating Promises, missing ctx.waitUntil() calls, Node.js runtime incompatibilities, and illegal binding access in prerendered routes.

$ cargo install flarelint
GitHub ↗
< 2.5 µs
AST Parse & Lint Per File
100%
Rust 2024 Native Engine
6 IN 1
Consolidated Tools
0 MS
Node / JS Startup Overhead
Consolidated Core Rules
oxc-ast engine
node-compat ERROR / WARN

Node.js Edge Runtime Auditor

Audits AST import and require specifiers. Flags strictly unsupported modules (`child_process`, `cluster`, `dgram`, `vm`, `v8`) and verifies `nodejs_compat` configuration.

// ❌ FAILS on Workers edge
import { spawn } from 'child_process';
import crypto from 'node:crypto'; // without nodejs_compat

// ✔️ PASSES with nodejs_compat
import { Buffer } from 'node:buffer';
waituntil ERROR

Floating Promise Detector

Detects background async operations invoked inside request handlers that are neither awaited nor registered via `ctx.waitUntil(promise)`.

// ❌ Terminated prematurely when HTTP response sent
export default {
  async fetch(req, env, ctx) {
    sendTelemetry(req); // floating promise
    return new Response("OK");
  }
}
do-storage ERROR / WARN

Durable Object Transaction Safety

Enforces explicit `await` on storage methods, detects race hazards in `Promise.all` batch writes, and prohibits invalid nested transactions.

// ✔️ Atomically safe Durable Object batch write
await this.ctx.storage.transaction(async (txn) => {
  await txn.put("keyA", 1);
  await txn.put("keyB", 2);
});
routes PAGES ROUTER

Cloudflare Pages _routes.json

Guarantees compliance with Cloudflare Pages 100-rule limit, verifies trailing wildcard placement, and detects shadowed or unneeded routing rules.

{
  "version": 1,
  "include": ["/*"],
  "exclude": ["/static/*", "/favicon.ico"]
}
Interactive Rule Inspector
INPUT SOURCE // TSwrangler: nodejs_compat=true
import { exec } from 'child_process';
import { Buffer } from 'buffer';
import crypto from 'node:crypto';

export default {
  async fetch() { return new Response('OK'); }
};
FLARELINT OUTPUT0.8 µs
ERROR node-compat/strictly-unsupported:1:1
      'child_process' is strictly unsupported on edge.
WARN  node-compat/prefer-node-protocol:2:1
      Prefer explicit 'node:buffer' specifier.
CLI Commands & Subcommands
clap v4 suite
Command Description Example
flarelint check [PATH] Runs all rules across JS, TS, Astro, and `_routes.json` files. flarelint check . --strict
flarelint node-compat [PATH] Scans for unsupported Node.js runtime built-in modules. flarelint node-compat src/
flarelint waituntil [PATH] Detects floating promises inside request/queue handlers. flarelint waituntil src/
flarelint do-storage [PATH] Lints Durable Object storage concurrency and transactions. flarelint do-storage src/
flarelint routes [PATH] Lints Cloudflare Pages `_routes.json` quotas and globs. flarelint routes public/_routes.json
flarelint completions <SHELL> Generates shell completions (`zsh`, `bash`, `fish`, `powershell`). flarelint completions zsh