Keep AI code clean
not chaotic
ESLint guardrails that catch the patterns AI coding assistants get wrong most often — god files, god functions, orphan TODOs, and redundant comments.
$
npm install --save-dev eslint-plugin-ai-guardrails
CopyWhy AI Guardrails?
AI coding assistants are incredibly productive — but they introduce predictable quality drift. These aren't style nitpicks — they're the patterns that turn a productive sprint into months of refactoring.
God files
What AI does: Keeps appending to one file instead of splitting
✓ Guardrails catches: max-file-lines warns when a file exceeds 300 lines
God functions
What AI does: Generates monolithic functions with everything inlined
✓ Guardrails catches: max-function-lines warns when a function exceeds 50 lines
Orphan TODOs
What AI does: Leaves TODO / FIXME / HACK with no tracking
✓ Guardrails catches: no-orphan-todos errors without a link or deadline
Redundant comments
What AI does: Adds "// Set x to 5" above const x = 5
✓ Guardrails catches: no-ai-obvious-comments flags comments that repeat the code
Catch AI mistakes before review
Each rule targets a specific pattern that AI coding assistants produce. Fully configurable thresholds and severity levels.
📄
max-file-lines
Prevent files from exceeding a maximum number of lines
Default: 300 lines🔧
max-function-lines
Prevent functions and methods from growing too long
Default: 50 lines📝
no-orphan-todos
Require TODO/FIXME/HACK to include a tracking reference
Default: reference required💬
no-ai-obvious-comments
Detect comments that just repeat the following code
Default: enabledSetup in seconds
One command or a few lines of config — works with every popular framework and ESLint version.
npx eslint-plugin-ai-guardrails init# 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/parserBuilt from real frustration
As a vibe coder, I fully understand the benefits and clutter that AI can bring to code. I often find myself frustrated when AI leaves behind giant files, long functions, and comments that simply repeat the code. This plugin is a solution I built from personal experience — to keep code structure tidy even when working intensively with AI.
Hanif Maulana
Creator of eslint-plugin-ai-guardrailsBuilt for your stack
Integration-tested against every popular framework and config format. ESM, CJS, flat config, legacy — it just works.