eslint-plugin-headers weekly downloads statistics
By robmisasi · npm · ESLint plugins
A flexible and `--fix`able rule for checking, inserting, and formatting file headers.
eslint-plugin-headers has 118,465 recorded weekly downloads on npm, an increase of 22.7% over the past 30 days, ranking #615 of 3,247 tracked listings.
About eslint-plugin-headers
eslint-plugin-headers
A flexible and --fixable rule for checking, inserting, and formatting file
headers.
Supports variable content injection, regex pattern matching, configurable usage of block or line comments, custom comment block prefixes and suffixes, custom line prefixes, and spacing between the header and code.
Useful for inserting, enforcing, and updating copyright or licensing notices while preserving pragma expressions in leading content blocks.
This plugin is best used with a formatter like prettier.
Motivation
This plugin aims to be a successor to the popular but defunct plugin
eslint-plugin-header.
eslint-plugin-headers strives to implement the same features as
eslint-plugin-header where possible, while sensibly extending features,
supporting modern JavaScript frameworks, and maintaining compatibility with
other common tools.
Installation
You'll first need to install ESLint:
npm i eslint --save-dev
Next, install eslint-plugin-headers:
npm install eslint-plugin-headers --save-dev
Usage
Flat config
Import the default export from the estlin-plugin-headers module. Add the
headers key to the plugins section of your config object in the configuration
file. You can omit the eslint-plugin- prefix:
import headers from "eslint-plugin-headers";
export default [
{
plugins: {
headers,
},
},
];
Then configure the rules you want to use under the rules section.
import headers from "eslint-plugin-headers";
export default [
{
plugins: {
headers,
},
rules: {
"headers/header-format": [
"error",
{
source: "string",
content: "Copyright 2024. All rights reserved.",
},
],
},
},
];
Legacy .eslintrc config
Add headers to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:
{
"plugins": ["headers"]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"headers/header-format": [
"error",
{
"source": "string",
"content": "Copyright 2024. All rights reserved."
}
]
}
}
Usage with Vue
This project supports parsing Vue files via the AST generated by the
vue-eslint-parser package. To properly apply this plugin's rules to Vue
files, you must:
- Install the
vue-eslint-parserpackage as a dev dependency. - Specify the
vue-eslint-parserin the configuration'slanguageOptions.parserfield (or the"parser"field for legacy configurations), and - Set the
enableVueSupportflag for the appropriate rules.
Example configuration:
import headers from "eslint-plugin-headers";
import vueEslintParser from "vue-eslint-parser";
export default [
{
plugins: {
headers,
},
files: ["**/*.vue"],
rules: {
"headers/header-format": [
"error",
{
source: "string",
content: "This is a header.",
enableVueSupport: true,
},
],
},
languageOptions: {
parser: vueEslintParser,
},
},
];
With this configuration the following file would be transformed like so:
Before:
<template>
<p>This is an example Vue file.</p>
</template>
After applying the fix:
<!--
This is a header.
-->
<template>
<p>This is an example Vue file.</p>
</template>
Since the vue-eslint-parser package strives to maintain compatibility with
rules targeting JavaScript, it exposes Vue AST tokens to rules in different
ways than the default ESlint parser. The means of exposing HTML Comment nodes
are of specific interest to this plugin, and the mechanism to access these
are substantially different than how a plugin would typically read a comment
node, making it necessary to both specify this particular parser as well as
setting the flag.
Examples
Example 0:
Example Configuration:
{
"rules": {
"headers/header-format": [
"error",
{
"source": "string",
"content": "Copyright 2024. All rights reserved."
}
]
}
}
Using the above configuration, here's a file without a matching header:
module.exports = 42;
When the fix is applied, the file now appears so:
/**
* Copyright 2024. All rights reserved.
*/
module.exports = 42;
Example 1:
Using the same configuration, this file already has a header, this one containing pragmas:
/**
* @fileoverview This file contains a magic number.
* @author Rob Misasi
*/
module.exports = 42;
When the fix is applied, the file now appears so:
/**
* Copyright 2024. All rights reserved.
*
* @fileoverview This file contains a magic number.
* @author Rob Misasi
*/
module.exports = 42;
Example 2: Using the following configuration, variable values can be injected into the provided header:
{
"rules": {
"headers/header-format": [
"error",
{
"source": "string",
"content": "Copyright {year} {company}. All rights reserved.",
"variables": {
"year": "2077",
"company": "Software Incorporated"
}
}
]
}
}
We can then apply a fix to the following file:
/**
* Copyright 1947 Hardware LLC. All rights reserved.
*/
module.exports = 42;
And get the resulting header:
/**
* Copyright 2077 Software Incorporated. All rights reserved.
*/
module.exports = 42;
Example 3:
Using the following configuration, patterns are used to validate content in existing headers:…
Description from the npm listing.
- eslint
- eslintplugin
- eslint-plugin
- header
- headers
- license
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (157)Similar npm ESLint plugins plugins
All 20 eslint-plugin-headers alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/eslint-plugin-headers. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.