npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nginx-linter

v0.7.0

Published

A linter and formatter for Nginx configuration files

Downloads

3,223

Readme

NPM version build status Code coverage

nginx-linter

A command line tool for validating nginx files for style and common pitfalls.

Installation

Requirements

  • Node 18+

Instructions

You can install nginx-linter globally using:

npm install -g nginx-linter

User Guide

You can run nginx-linter without any configurations like so:

nginx-linter

This will by default validate the configuration files under /etc/nginx/. For all the options, you can use the --help:

nginx-linter --help

Built-in rules

There are a number of built in rules in nginx-linter designed both keep your nginx configuration style consist but also to find common pitfalls which may cause bugs in production.

if-is-evil

The if directive has a number of common pitfalls due to nginx configuration being a declarative language not a procedural one and as a result should either be used sparingly or not at all. There are two modes for this rule which can be used:

  • always - Don't allow any uses of the if directive regardless if they are a safe to use
  • mostly - Only allow uses of the if directive which are documented as safe to use

Default value: mostly

indentation

Enforces a consistent indentation for all directive blocks and lua blocks. If the configuration value is a digit, it indicates the number of spaces to use for each level of indentation. Alternatively, you can use tab as the value to use tabs for indentation.

Default value: 4

line-ending

Enforce a consistent line ending within the file. The configuration value can either be lf for Unix/Linux/MacOS style newlines or crlf for Windows style newlines.

Default value: lf

location-order

This rules enforces that locations are ordered in the same order in which they will would take precedence when matching requests. A common pitfall is thinking that Nginx configuration is matched sequentially which isn't the case. By enforcing that locations are ordered in precedence order, this will lead to less surprising results in production.

strict-location

location directives have a number of modifiers which can be used change the way the location matches. As these are special symbols it can be difficult for a novice to remember which modes allow for regular expressions and which ones are regular string comparisons. strict-location checks that prefix and exact matches don't use regular expressions in the location URI.

trailing-whitespace

Enforce that no line ends with whitespace. This rule is largely for cleanliness and style purposes.