{"id":21304,"library":"eslint-plugin-simple-header","title":"eslint-plugin-simple-header","description":"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.","status":"active","version":"1.2.2","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","eslint","eslintplugin","license","header","typescript"],"install":[{"cmd":"npm install eslint-plugin-simple-header","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-simple-header","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-simple-header","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for plugin functionality","package":"eslint","optional":false}],"imports":[{"note":"ESM-only; CommonJS require() will fail since package type is module.","wrong":"const simpleHeader = require('eslint-plugin-simple-header')","symbol":"default","correct":"import simpleHeader from 'eslint-plugin-simple-header'"},{"note":"Named export only accessible via dynamic import due to ESM.","wrong":"const { rules } = require('eslint-plugin-simple-header')","symbol":"rules","correct":"const { rules } = await import('eslint-plugin-simple-header')"},{"note":"Rule key must be prefixed with plugin name in flat config.","wrong":"\"header\": [\"error\", { ... }]","symbol":"simple-header/header","correct":"\"simple-header/header\": [\"error\", { ... }]"}],"quickstart":{"code":"import simpleHeader from \"eslint-plugin-simple-header\";\n\nexport default [\n  {\n    plugins: {\n      \"simple-header\": simpleHeader,\n    },\n    rules: {\n      \"simple-header/header\": [\"error\", {\n        text: [\n          \"Copyright (c) {year} {author}\",\n          \"SPDX-License-Identifier: MIT\",\n        ],\n        templates: {\n          year: { pattern: \"\\\\d{4}\", default: new Date().getFullYear().toString() },\n          author: { pattern: \".*\", default: \"John Doe\" },\n        },\n      }],\n    },\n  },\n];","lang":"typescript","description":"ESLint flat config with simple-header plugin, using template variables for year and author."},"warnings":[{"fix":"Use flat config (eslint.config.js) with plugins object as shown in docs.","message":"v1.x removes support for legacy ESLint config format (no use .eslintrc)","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Use import instead of require; configure package.json with \"type\": \"module\" if needed.","message":"ESM-only module, import fails with require()","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Use object syntax: { pattern: '...', default: '...' } instead of array.","message":"The old syntax for templates used an array [pattern, default] is deprecated in favor of object {pattern, default}","severity":"deprecated","affected_versions":">=1.2.0"},{"fix":"Override template pattern if you need custom year validation.","message":"Default year template matches only 4-digit years but does not validate realistic year range","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Specify files pattern (e.g., ['**/*.js']) to limit scope.","message":"If no files option is provided, rule applies to all files; may cause linting errors on non-code files","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Switch to import or set \"type\": \"module\" in package.json.","cause":"Module is ESM-only and not transpiled for CommonJS; your project uses require().","error":"Cannot find module 'eslint-plugin-simple-header'"},{"fix":"Use \"simple-header/header\": [\"error\", { ... }] instead of \"simple-header/header\": { ... }.","cause":"Rule entry is missing array brackets in flat config.","error":"Configuration for rule \"simple-header/header\" is invalid: value must be an array"},{"fix":"Add templates: { year: { pattern: \"\\\\d{4}\", default: \"2023\" } } to the rule options.","cause":"Missing templates definition for year variable used in header text.","error":"Cannot read properties of undefined (reading 'year')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}