{"id":19862,"library":"eslint-plugin-notice","title":"eslint-plugin-notice","description":"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.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/nickdeis/eslint-plugin-notice","tags":["javascript","eslint","plugin","notice","copyright","header","lint","eslintplugin"],"install":[{"cmd":"npm install eslint-plugin-notice","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-notice","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-notice","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency; the plugin requires ESLint >= 3.0.0 to run","package":"eslint","optional":false}],"imports":[{"note":"Package does not provide ESM exports; use CommonJS require().","wrong":"import plugin from 'eslint-plugin-notice';","symbol":"plugin","correct":"const plugin = require('eslint-plugin-notice');"},{"note":"Must register the plugin (via 'plugins' key) before using the rule.","wrong":"module.exports = { rules: { 'notice/notice': ... } };","symbol":"rules['notice/notice']","correct":"module.exports = { plugins: ['notice'], rules: { 'notice/notice': ['error', { ... }] } };"},{"note":"Template supports {{year}} and {{author}} placeholders. Do not hardcode year as it won't update automatically.","wrong":"const options = { template: 'Copyright (c) 2022 My Company' };","symbol":"options.template","correct":"const options = { template: 'Copyright (c) {{year}} {{author}}' };"}],"quickstart":{"code":"// .eslintrc.js\nmodule.exports = {\n  plugins: ['notice'],\n  rules: {\n    'notice/notice': ['error', {\n      template: '/* Copyright (c) {{year}} {{author}} */\\n',\n      authors: ['John Doe'],\n      onNonMatchingHeader: 'prepend', // or 'replace', 'report'\n      var: { year: new Date().getFullYear().toString() }\n    }]\n  }\n};","lang":"javascript","description":"Configures the plugin to enforce a copyright notice header using a template with placeholders for year and author."},"warnings":[{"fix":"Add an allowEmptyFiles option or ensure all files have at least a header.","message":"The rule will error if no matching header is found, even if the file is empty.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Set onNonMatchingHeader: 'replace' to replace existing headers.","message":"The '--fix' mode only prepends the header; it does not remove existing non-matching headers unless onNonMatchingHeader is set to 'replace'.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use 'onNonMatchingHeader' with 'report' or 'prepend' instead.","message":"The option 'nonMatchingTolerance' is deprecated and may be removed in a future version.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Add 'plugins: [\"notice\"]' to your .eslintrc.","cause":"The plugin is not registered in the ESLint config.","error":"Definition for rule 'notice/notice' was not found"},{"fix":"Run 'npm install eslint-plugin-notice --save-dev'.","cause":"Package is not installed or missing from node_modules.","error":"Cannot find module 'eslint-plugin-notice'"},{"fix":"Replace 'nonMatchingTolerance' with 'onNonMatchingHeader' in rule options.","cause":"Misspelled or deprecated option name; use 'onNonMatchingHeader'.","error":"Invalid option 'nonMatchingTolerance' for rule notice/notice"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}