prettier-plugin-nginx is a Prettier plugin that formats NGINX configuration files (.nginx, .nginxconf). Version 1.0.3 ships TypeScript types and targets modern Prettier (v2+). It is written in TypeScript and depends only on Prettier. Differentiators: opinionated formatting with configurable alignment, parameter wrapping, and continuation indentation; supports standard NGINX directives but not extensions like lua-nginx-module. Release cadence is low; last release was 2024.
npm install prettier-plugin-nginxVerified import paths — ran on the pinned version, not inferred.
Formats an NGINX config string using Prettier with the plugin, enabling directive alignment and parameter wrapping.
Avoid using with configs containing Lua blocks, or handle those manually.
Set parser to 'nginx' in Prettier options or rename files.
Upgrade to v1.0.0+ and use named exports like `alignUniversally` if needed.
Run `npm install --save-dev prettier-plugin-nginx`
Ensure Prettier >=2.0 and pass plugin via `plugins` array.
Use `import prettier from 'prettier'` (ESM) or `const prettier = require('prettier')` (CJS).