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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@allons-y/stylelint-header

v4.0.2

Published

A stylelint plugin that checks for a file header.

Readme

A stylelint custom rule that asserts every file begins with a configured header comment — typically a copyright or licence notice. When the header is missing, the rule reports an error; with --fix, it prepends the header for you.

The problem

Copyright and licence headers are easy to add and easy to forget. A pre-commit lint check is the natural place to enforce them, but stylelint doesn't ship a header rule out of the box. stylelint-header bridges the gap — point it at a string or a file and every CSS/SCSS/Less file in your project picks up the same header, formatted consistently, with --fix doing the boring work.

Features

  • Template-driven — pass a string or a path to a file; supports lodash.template syntax for variables
  • Fuzzy matching — uses string-similarity so cosmetic edits (whitespace, year bumps) don't trigger false positives
  • Auto-fixable — missing headers are prepended on --fix, preserving the rest of the file
  • Minifier-friendly — opt into /*! syntax so the header survives tools like cssnano
  • Built-in variablesYEAR, FILE_NAME, and FILE_PATH are filled in automatically; bring your own as needed

Installation

yarn add --dev @allons-y/stylelint-header
npm install --save-dev @allons-y/stylelint-header
pnpm add --save-dev @allons-y/stylelint-header
bun add --dev @allons-y/stylelint-header

Usage

Add the plugin to your stylelint config and enable the header/header rule, passing either a string template or a path to a file containing the template. To toggle the rule off, set the value to null.

With a template file

{
	"plugins": ["@allons-y/stylelint-header"],
	"rules": {
		"header/header": ["./COPYRIGHT"]
	}
}

With an inline template string

{
  "plugins": ["@allons-y/stylelint-header"],
  "rules": {
    "header/header": [
      "Copyright <%= YEAR %>. <%= company %>",
      {
        templateVariables: {
          company: "AI Overlords Inc.",
        },
        nonMatchingTolerance: 0.8,
      },
    ],
  },
}

Options

templateVariables

Type: object   Default: {}

Key/value pairs used to substitute variables in the header template. Given a template like:

(c) <%= YEAR %> <%= company %>

and a config of:

{
  templateVariables: {
    company: "AI Overlords Inc.",
  },
}

the resulting header becomes:

/*!
 * (c) 2026 AI Overlords Inc.
 */

YEAR was substituted automatically — it doesn't need to appear in templateVariables. The following variables are always available:

| Variable | Value | | ----------- | -------------------------------- | | YEAR | The current year | | FILE_NAME | The basename of the linted file | | FILE_PATH | The directory of the linted file |

Templates use lodash.template — see the lodash docs for the full syntax.

nonMatchingTolerance

Type: number between 0 and 1   Default: 0.98

Minimum similarity (per string-similarity) between the comment found at the top of the file and the configured header. Lower the value when you want to allow small drift (e.g. a stale year); raise it to enforce an exact match.

isRemovable

Type: boolean   Default: false

When true, generated headers begin with /* rather than /*!. The /*! prefix is preserved by most CSS minifiers (e.g. cssnano) — leave the default in place if you want the header to survive minification, set to true if you don't.

Requirements

  • Node.js >= 24
  • stylelint 17.x

Contributing

Contributions are welcome — see CONTRIBUTING.md for the full workflow, and CODE_OF_CONDUCT.md for community expectations. For bugs and ideas, please open an issue.

This project is licensed under the MPL-2.0 License - see the LICENSE file for details. This means you can use this freely, modify as needed; changes to MPL-licensed files should be shared back under the same license.

If you find this plugin useful and would like to buy me a coffee/beer as a small thank you, I would greatly appreciate it!