apigeelint - Apigee Proxy Linter

raw JSON →
2.84.6 verified Fri May 01 auth: no javascript

Static code analysis tool for Apigee API proxy and sharedflow bundles, enforcing best practices and avoiding anti-patterns. Version 2.84.6 requires Node >= 20 and npm >= 10.5.0. Active development with frequent releases (multiple per month). Provides over 80 built-in lint rules covering policies, endpoints, and bundle structure. Supports command-line and programmatic usage, multiple formatters (json, table, junit), and external plugins. Compared to alternatives like apigeelint-plugin or custom scripts, apigeelint is the official community-maintained linter with rule contributions from Apigee engineering and support teams.

error Error: Must use import to load ES Module: ...
cause Using require() on ESM-only version >=2.80.0
fix
Convert to ES module: use import syntax and set type:module.
error Cannot find module 'eslint'
cause PO025 rule requires eslint but it is not installed
fix
Install eslint: npm install -D eslint@10
error Error: Configuration file .eslintrc not supported
cause PO025 expects eslint.config.js (flat config) since v2.83.0
fix
Rename .eslintrc to eslint.config.js and migrate to flat config format.
error TypeError: Linter is not a constructor
cause Using import { Linter } incorrectly (e.g., default import)
fix
Use named import: import { Linter } from 'apigeelint'
breaking Node >= 20 required since v2.80.0. Older Node versions cause runtime errors.
fix Upgrade Node to 20+ using nvm or package manager.
breaking ESM-only from v2.80.0: require() calls will fail. Must use import syntax.
fix Switch to ES modules: set type: module in package.json or use .mjs extension.
deprecated CLI option -d (download) is deprecated and will be removed in v3.0.
fix Use apigeetool download proxy instead, then lint with -s.
gotcha PO025 rule requires eslint.config.js (not .eslintrc) since v2.83.0.
fix Create eslint.config.js file in your project root.
gotcha .apigeelintrc file is ignored when --norc flag is used. Settings may unexpectedly default.
fix Do not use --norc unless you provide all options via CLI.
npm install apigeelint
yarn add apigeelint
pnpm add apigeelint

Programmatically lint an Apigee proxy bundle directory and output results as JSON.

import { Linter, getDefaultPlugins } from 'apigeelint';

const linter = new Linter({
  sourceType: 'apiproxy',
  path: './my-proxy/apiproxy',
  plugins: getDefaultPlugins(),
  profile: 'apigee'
});

const results = await linter.lint();
console.log(JSON.stringify(results, null, 2));