Registry / testing / eslint-plugin-notice

eslint-plugin-notice

JSON →
library1.0.0jsnpmunverified

ESLint plugin that enforces a copyright or license notice at the top of source files. Version 1.0.0 provides a single rule `notice/notice` with an `--fix` option to automatically prepend missing headers. Unlike generic file-header linting, it uses configurable patterns, templates, and per-file overrides. Compatible with ESLint 3+. Low churn (single stable release); good for projects requiring consistent legal boilerplate.

npm install eslint-plugin-notice
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-NOTI
E
eslint-plugin-notice
testingjavascriptv1.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
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 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

plugin
const plugin = require('eslint-plugin-notice');
import plugin from 'eslint-plugin-notice';
Package does not provide ESM exports; use CommonJS require().
rules['notice/notice']
module.exports = { plugins: ['notice'], rules: { 'notice/notice': ['error', { ... }] } };
module.exports = { rules: { 'notice/notice': ... } };
Must register the plugin (via 'plugins' key) before using the rule.
options.template
const options = { template: 'Copyright (c) {{year}} {{author}}' };
const options = { template: 'Copyright (c) 2022 My Company' };
Template supports {{year}} and {{author}} placeholders. Do not hardcode year as it won't update automatically.

Configures the plugin to enforce a copyright notice header using a template with placeholders for year and author.

// .eslintrc.js module.exports = { plugins: ['notice'], rules: { 'notice/notice': ['error', { template: '/* Copyright (c) {{year}} {{author}} */\n', authors: ['John Doe'], onNonMatchingHeader: 'prepend', // or 'replace', 'report' var: { year: new Date().getFullYear().toString() } }] } };
Debug
Known issues
gotchaThe rule will error if no matching header is found, even if the file is empty.
fix
Add an allowEmptyFiles option or ensure all files have at least a header.
affects: >=1.0.0
gotchaThe '--fix' mode only prepends the header; it does not remove existing non-matching headers unless onNonMatchingHeader is set to 'replace'.
fix
Set onNonMatchingHeader: 'replace' to replace existing headers.
affects: >=1.0.0
deprecatedThe option 'nonMatchingTolerance' is deprecated and may be removed in a future version.
fix
Use 'onNonMatchingHeader' with 'report' or 'prepend' instead.
affects: >=1.0.0
Errors
Common errors & fixes
Definition for rule 'notice/notice' was not found
The plugin is not registered in the ESLint config.
fix
Add 'plugins: ["notice"]' to your .eslintrc.
Cannot find module 'eslint-plugin-notice'
Package is not installed or missing from node_modules.
fix
Run 'npm install eslint-plugin-notice --save-dev'.
Invalid option 'nonMatchingTolerance' for rule notice/notice
Misspelled or deprecated option name; use 'onNonMatchingHeader'.
fix
Replace 'nonMatchingTolerance' with 'onNonMatchingHeader' in rule options.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
eslintrequiredpeer dependency; the plugin requires ESLint >= 3.0.0 to run
Agent activity
2 hits · last 30 days
node
2
Resources
eslint-plugin-notice — npm install eslint-plugin-notice · libregistry