{"library":"nginx-lint-plugin","title":"nginx-lint-plugin","description":"TypeScript SDK for writing nginx-lint plugins, version 0.10.5. This package provides types, WIT definitions, and testing utilities for creating WebAssembly Component Model plugins that run in the nginx-lint CLI. Plugins are written in TypeScript (ESM-only), compiled via JCO to WebAssembly, and loaded at runtime. Key features include a PluginTestRunner for unit tests, parseConfig for simulating include contexts, and support for the rowan-based CST parser introduced in v0.9.0. Compared to direct nginx config parsing, this SDK offers a structured plugin API with versioned specifications and automatic integration with nginx-lint's linting pipeline. Release cadence is roughly monthly, with frequent dependency updates.","language":"javascript","status":"active","last_verified":"Fri May 01","install":{"commands":["npm install nginx-lint-plugin"],"cli":null},"imports":["import type { Config } from 'nginx-lint-plugin'","import type { LintError } from 'nginx-lint-plugin'","import type { PluginSpec } from 'nginx-lint-plugin'","import { PluginTestRunner } from 'nginx-lint-plugin/testing'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"// src/plugin.ts\nimport type { Config, LintError, PluginSpec } from 'nginx-lint-plugin';\n\nexport function spec(): PluginSpec {\n  return {\n    name: 'no-proxy-pass-http',\n    category: 'best-practices',\n    description: 'Disallow HTTP proxy_pass',\n    apiVersion: '1.0',\n    severity: 'warning',\n  };\n}\n\nexport function check(cfg: Config, path: string): LintError[] {\n  const errors: LintError[] = [];\n  for (const ctx of cfg.allDirectivesWithContext()) {\n    const directive = ctx.directive;\n    if (directive.is('proxy_pass') && !directive.hasBlock()) {\n      errors.push({\n        rule: 'no-proxy-pass-http',\n        category: 'best-practices',\n        message: 'proxy_pass should use https',\n        severity: 'warning',\n        line: directive.line(),\n        column: directive.column(),\n        fixes: [directive.replaceWith('proxy_pass https://upstream;')],\n      });\n    }\n  }\n  return errors;\n}","lang":"typescript","description":"Shows how to define a simple nginx-lint plugin with spec and check functions, using the TypeScript SDK.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}