Skip to content

How does AI Guard relate to ESLint?

AI Guard extends ESLint; it does not replace it. eslint-plugin-ai-guard is an ESLint plugin, the standard way to add rules and configurations to ESLint, so you add its rules to your existing config alongside ESLint core and typescript-eslint. It also ships a CLI that runs the same rules without your ESLint config, for a quick scan or CI.

By the AI Guard maintainers · Last updated · Applies to v1.4.7

A plugin, in ESLint's own terms

ESLint's documentation describes plugins as the way to "extend ESLint with additional functionality": a plugin can provide rules, named configurations and processors (ESLint docs: plugins). AI Guard provides 27 rules and 4 configurations (recommended, strict, security, agent):

javascript
// eslint.config.mjsimport aiGuard from 'eslint-plugin-ai-guard'; export default [  // …your existing config…  {    plugins: { 'ai-guard': aiGuard },    rules: { ...aiGuard.configs.recommended.rules },  },];

It works with ESLint 8 or later (flat config and legacy config).

Where rules overlap

PatternAI GuardAlso available in
Floating promises`no-floating-promise` (syntax and scope; uses type information when available)typescript-eslint no-floating-promises, which "requires type information to run" (docs)
await in loops`no-await-in-loop` (allows retry and sequential intent; simple loops autofix to Promise.all)ESLint core no-await-in-loop (docs)
eval`no-eval-dynamic` (only non-literal arguments)ESLint core no-eval (docs)

Where both exist, choose by what you have: type-aware rules see more but need a full TypeScript program; AI Guard's run without one, in plain JavaScript too. Running both is fine.

Most AI Guard rules have no direct counterpart because they target patterns specific to AI-assisted code: placeholder implementations, tautological assertions, secrets exposed to the browser, undeclared imports and invisible Unicode.

Oxlint

The same rules run as an Oxlint JS plugin (npx ai-guard init-oxlint). AI Guard's CI lints a fixture set with both linters and fails on any difference; 27 of 27 rules gave identical results (Results). Oxlint's JS plugin support is in alpha (Oxlint docs).

Beyond lint

The ai-guard CLI adds checks ESLint does not do: verify (one verdict for a change), integrity (weakened checks), verify-deps (packages before install) and agent hooks. These use ESLint internally for the lint part.

Sources