Registry / testing / eslint-plugin-simple-header

eslint-plugin-simple-header

JSON →
library1.2.2jsnpmunverified

ESLint plugin for enforcing and auto-fixing license headers in source files. Current stable version is 1.2.2. It requires ESLint >=8.41.0 and ships TypeScript type definitions. Designed as a lightweight alternative to eslint-plugin-header with support for template variables (year, author, etc.), multiple comment syntaxes (block, line), and configurable decoration. It uses ESM-only exports and has a flat config-first API.

npm install eslint-plugin-simple-header
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-SIMP
E
eslint-plugin-simple-header
testingjavascriptv1.2.2
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–223 runs
build_error
glibc
node 18–223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
✓ import simpleHeader from 'eslint-plugin-simple-header'
✗ const simpleHeader = require('eslint-plugin-simple-header')
ESM-only; CommonJS require() will fail since package type is module.
rules
✓ const { rules } = await import('eslint-plugin-simple-header')
✗ const { rules } = require('eslint-plugin-simple-header')
Named export only accessible via dynamic import due to ESM.
simple-header/header
✓ "simple-header/header": ["error", { ... }]
✗ "header": ["error", { ... }]
Rule key must be prefixed with plugin name in flat config.

ESLint flat config with simple-header plugin, using template variables for year and author.

import simpleHeader from "eslint-plugin-simple-header"; export default [ { plugins: { "simple-header": simpleHeader, }, rules: { "simple-header/header": ["error", { text: [ "Copyright (c) {year} {author}", "SPDX-License-Identifier: MIT", ], templates: { year: { pattern: "\\d{4}", default: new Date().getFullYear().toString() }, author: { pattern: ".*", default: "John Doe" }, }, }], }, }, ];
Debug
Known issues
breakingv1.x removes support for legacy ESLint config format (no use .eslintrc)
fix
Use flat config (eslint.config.js) with plugins object as shown in docs.
affects: >=1.0.0
breakingESM-only module, import fails with require()
fix
Use import instead of require; configure package.json with "type": "module" if needed.
affects: >=1.0.0
deprecatedThe old syntax for templates used an array [pattern, default] is deprecated in favor of object {pattern, default}
fix
Use object syntax: { pattern: '...', default: '...' } instead of array.
affects: >=1.2.0
gotchaDefault year template matches only 4-digit years but does not validate realistic year range
fix
Override template pattern if you need custom year validation.
affects: >=1.0.0
gotchaIf no files option is provided, rule applies to all files; may cause linting errors on non-code files
fix
Specify files pattern (e.g., ['**/*.js']) to limit scope.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'eslint-plugin-simple-header'
Module is ESM-only and not transpiled for CommonJS; your project uses require().
fix
Switch to import or set "type": "module" in package.json.
Configuration for rule "simple-header/header" is invalid: value must be an array
Rule entry is missing array brackets in flat config.
fix
Use "simple-header/header": ["error", { ... }] instead of "simple-header/header": { ... }.
Cannot read properties of undefined (reading 'year')
Missing templates definition for year variable used in header text.
fix
Add templates: { year: { pattern: "\\d{4}", default: "2023" } } to the rule options.
Upgrade
Version history
1.2.2latest on npm
Audit
Dependencies
eslintrequiredPeer dependency for plugin functionality
Agent activity
9 hits · last 30 days
node
8
Resources
eslint-plugin-simple-header — npm install eslint-plugin-simple-header · libregistry