npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

eslint-plugin-ai-guardrails

v1.3.2

Published

ESLint rules to prevent AI-generated chaos: god files, god functions, orphan TODOs, and obvious comments.

Readme

eslint-plugin-ai-guardrails

npm version CI license typescript eslint node website Sponsor

ESLint guardrails for AI-assisted codebases.

🌐 Website & Docs: https://eslint-ai-guardrails.vercel.app

Stop AI-generated code from becoming long-term tech debt. eslint-plugin-ai-guardrails enforces structure-first linting rules that catch the patterns AI coding tools get wrong most often.


Why AI Guardrails?

AI coding assistants (Copilot, Cursor, ChatGPT, Claude, etc.) are incredibly productive — but they introduce predictable quality drift:

| Problem | What AI Does | What Guardrails Catches | |---------|-------------|------------------------| | God files | Keeps appending to one file instead of splitting | max-file-lines warns when a file exceeds 300 lines | | God functions | Generates monolithic functions with everything inlined | max-function-lines warns when a function exceeds 50 lines | | Orphan TODOs | Leaves TODO / FIXME / HACK with no tracking | no-orphan-todos errors without a link or deadline | | Redundant comments | Adds massive blocks of unnecessary explanations | no-ai-obvious-comments enforces max density (20%), length, and quality |

These aren't style nitpicks — they're the exact patterns that turn a productive AI-assisted sprint into months of refactoring.


Compatibility

| Requirement | Supported Versions | |------------|-------------------| | Node.js | >=18.0.0 | | ESLint | v8.x · v9.x | | TypeScript | >=5.0.0 | | @typescript-eslint/parser | v6.x · v7.x · v8.x |

TypeScript-only — this plugin applies to .ts, .tsx, .mts, and .cts files. If your project isn't using TypeScript, this plugin is not the right fit.

Tested With

This plugin is integration-tested against these framework configurations:

  • Vite + React + TypeScript (ESLint v9 flat config)
  • Next.js (ESLint v9 flat config with @eslint/js + typescript-eslint)
  • NestJS (ESLint v9 flat config with strict overrides)
  • Express + TypeScript (ESLint v8 legacy .eslintrc)
  • ESM projects ("type": "module" with eslint.config.mjs)
  • CJS projects (require() with eslint.config.cjs)
  • Monorepo workspaces (npm / pnpm / yarn workspaces)

Support Matrix

| Framework | Status | CLI init Support | |-----------|--------|-------------------| | Elysia | Native | Full | | Next.js | Native | Full | | Vite | Native | Full | | NestJS | Basic | Partial (In Progress) | | Express | Basic | Partial (In Progress) | | SvelteKit | Basic | Partial (In Progress) |


Installation

# npm
npm install --save-dev eslint-plugin-ai-guardrails @typescript-eslint/parser

# pnpm
pnpm add -D eslint-plugin-ai-guardrails @typescript-eslint/parser

# yarn
yarn add -D eslint-plugin-ai-guardrails @typescript-eslint/parser

# bun
bun add -d eslint-plugin-ai-guardrails @typescript-eslint/parser

🚀 Quick Setup

One-command setup (recommended)

npx eslint-plugin-ai-guardrails init

This smart automation CLI will:

  1. Detect your framework (Vite, Next.js, Elysia, NestJS, etc.) automatically.
  2. Completely configure your project to match the AI-Guardrails standards, replacing legacy configs where necessary.
  3. Add strict lint, typecheck, and build scripts to your package.json.
  4. Ensure all required dev dependencies are installed.
  5. Auto-generate strict AI guardrail instructions for .windsurf, .cursor, .agents, and .kiro.
  6. Provide a beautiful, interactive terminal experience to guide you through the process.

ESLint v9 — Flat Config (recommended)

// eslint.config.mjs
import aiGuardrails from 'eslint-plugin-ai-guardrails';

export default [
  aiGuardrails.flatConfigs.recommended
];

ESLint v8 — Legacy Config

// .eslintrc.json
{
  "parser": "@typescript-eslint/parser",
  "plugins": ["ai-guardrails"],
  "extends": ["plugin:ai-guardrails/recommended"]
}

Rules

| Rule | Default | Type | Description | |------|---------|------|-------------| | max-file-lines | warn | suggestion | Prevent files from exceeding 300 lines | | max-function-lines | warn | suggestion | Prevent functions/methods from exceeding 50 lines | | no-orphan-todos | error | problem | Require TODO/FIXME/HACK to include a tracking reference | | no-ai-obvious-comments | warn | suggestion | Enforce strict comment density, length, and quality constraints |

Custom Configuration

{
  "rules": {
    "ai-guardrails/max-file-lines": ["warn", { "max": 250 }],
    "ai-guardrails/max-function-lines": ["warn", { "max": 40 }],
    "ai-guardrails/no-orphan-todos": [
      "error",
      { "requireReference": true, "requireDate": true }
    ],
    "ai-guardrails/no-ai-obvious-comments": "warn"
  }
}

CI / Build Enforcement

Fail the build on any lint warning or error:

{
  "scripts": {
    "lint": "eslint . --max-warnings 0",
    "typecheck": "tsc --noEmit",
    "build": "npm run lint && npm run typecheck && <your-build-step>"
  }
}

This guarantees:

  • Any ESLint warning or error fails the pipeline
  • Any TypeScript error fails the pipeline

Integrations

Ready-to-copy setup guides for popular frameworks:

See also:


Development

git clone https://github.com/isaacnewton123/eslint-plugin-ai-guardrails.git
cd eslint-plugin-ai-guardrails
npm install
npm run lint
npm run build
npm test

See:


Roadmap

  • Phase 1 (Done): Core rules (max-file-lines, max-function-lines, no-orphan-todos, no-ai-obvious-comments), ESLint v8/v9 support, CLI init for Vite/Next.js/Elysia.
  • Phase 2 (In Progress): CLI Optimization for NestJS, Express, and SvelteKit.
  • Phase 3 (Future): AI Hallucination Guard, Automated CI Bot.

🤝 Contributions

A massive thank you to everyone who has helped build and improve AI Guardrails!


Creator

Hanif Maulana (Isaac Newton)

Support

If this plugin saves you from AI-generated chaos, consider supporting development:


License

MIT — Built with care for maintainable AI-assisted development.