Changelog
All notable changes to eslint-plugin-ai-guardrails, following Keep a Changelog and Semantic Versioning.
All notable changes to this project are documented here.
The format follows Keep a Changelog, and this project follows Semantic Versioning.
[1.3.2] — 2026-05-11
Internal
- Type-safety refactor: Eliminated ambiguous
unknownandas unknown ascast annotations across the plugin source. No public API or rule behavior changes.- New
src/cli/json.tsexportsJsonValue/JsonObjecttypes now used byPackageJsonandwriteJson()instead ofunknown. - New
src/rules/utils/source-code.tsexportsresolveSourceCode(context), replacing the duplicated(context as unknown as { sourceCode?: TSESLint.SourceCode })shim in all four rules. loadParser()insrc/index.tsnow returnsTSESLint.Linter.ParserModule | undefinedinstead ofunknown; theas unknown as PluginWithMetadouble-cast on the plugin object was removed via aPluginBase = Omit<PluginWithMeta, 'flatConfigs'>intermediate type.no-ai-obvious-commentsAST walker now uses a typedAstChildunion and anisAstNodetype predicate, eliminating theas TSESTree.Nodecasts in the traversal.
- New
- Test suite: now 61 tests (up from 60); all green.
[1.3.1] — 2026-05-10
Fixed
- CLI Initialization: Corrected an issue where running
initon an Elysia project generated Next.js package scripts instead of the correctbun runcommands.
[1.3.0] — 2026-05-10
Added
- Smart CLI Initialization System (
npx eslint-plugin-ai-guardrails init):- Auto-detects frameworks (Vite, Next.js, Elysia, NestJS) and applies optimal config templates.
- Generates comprehensive baseline setups including
eslint.config.js/mjs,tsconfig.json, and automaticvite-plugin-checkerwiring. - Intelligently patches
package.jsonto inject necessarylint,typecheck, andbuildscripts without overwriting user data. - Interactive safety prompts prevent accidental destructive overwrites.
- Automated AI Rules Scaffolding (AI Cages):
- The CLI now automatically generates and formats strict AI guardrail instructions for
.windsurf/rules/ai-guardrails.md,.cursor/rules/ai-guardrails.md,.agents/rules/ai-guardrails.md, and.kiro/steering/ai-guardrails.md. - Injects a zero-tolerance "AI Cage" prompt to ensure future AI-generated code conforms strictly to project limitations (no redundant comments, strict lines limits).
- The CLI now automatically generates and formats strict AI guardrail instructions for
Changed
- Comprehensive Comment Quality Linter: The
no-ai-obvious-commentsrule has been completely overhauled from an absolute ban to a nuanced, professional-grade linter:- Density Control: Enforces maximum comment limits (20% for large files, 30% for files under 50 lines).
- Horizontal Limits: Fails if any individual comment line exceeds 80 characters.
- Vertical Limits: Allows 10 consecutive lines for docstrings but only 3 lines for inline logic.
- Content Heuristics: Detects commented-out code snippets and flags redundant explanations that merely repeat the code's token logic.
- Max Function Lines Rule: The
max-function-linesrule now setsskipCommentstotrueby default, ensuring comment blocks do not unfairly trigger line-limit violations.
[1.1.0] — 2026-05-07
Changed
- CLI initializer now creates
eslint.config.mjsfor new projects and preserves existinglint/buildscripts. - CLI initializer now skips
tsconfig.jsonupdates when the file exists but contains invalid JSON, preventing destructive overwrites. - Documentation updated to reflect non-destructive
initbehavior and.mjsflat-config defaults. - Added
.stress-tests/multi-framework failure harness for validating that guardrail violations break builds as expected.
[1.0.0] — 2026-05-07
Added
- 4 ESLint rules for AI-assisted codebase quality:
max-file-lines— prevent god files (default: 300 lines)max-function-lines— prevent god functions (default: 50 lines)no-orphan-todos— require tracking references on TODO/FIXME/HACKno-ai-obvious-comments— detect redundant comments that repeat code
- CLI initializer (
npx eslint-plugin-ai-guardrails init) with auto-detection for:- Package managers (npm, pnpm, yarn, bun)
- Frameworks (Vite, Next.js, NestJS, Elysia)
- Automatic
vite-plugin-checkerwiring tsconfig.jsonstrict baseline creation
- ESLint v8 support — legacy
.eslintrcconfig viaplugin:ai-guardrails/recommended - ESLint v9 support — flat config via
aiGuardrails.flatConfigs.recommended - Plugin metadata —
plugin.meta.nameandplugin.meta.versionfor ESLint v9 - Lazy parser loading —
@typescript-eslint/parserloaded on demand to prevent crashes during installation - CJS/ESM interop —
flatConfigsaccessible via bothrequire()andimport default - Comprehensive test suite — 60 tests covering all rules, edge cases, and plugin exports
- Integration-tested against ESLint v8 legacy, v9 flat CJS, v9 flat ESM, and framework-specific configs
- CI workflow — GitHub Actions with Node 18, 20, 22 matrix
- Full documentation — rule docs, configuration guide, integrations for 7+ frameworks, troubleshooting
Changed
- CLI config template now uses standard flat config array export (compatible with all ESLint v9 versions)
- Version bumped from 0.1.0 to 1.0.0 for production release