{"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,"search_vec":"'1.2.2':23 '8.41.0':27 'altern':37 'api':72 'author':49 'auto':12 'auto-fix':11 'block':54 'comment':52 'config':70 'config-first':69 'configur':57 'current':19 'decor':58 'definit':32 'design':33 'enforc':9 'eslint':2,6,26,40,74 'eslint-plugin-head':39 'eslint-plugin-simple-head':1 'eslintplugin':75 'esm':62 'esm-on':61 'etc':50 'export':64 'file':18 'first':71 'fix':13 'flat':68 'header':5,15,42,77 'javascript':73 'licens':14,76 'lightweight':36 'line':55 'multipl':51 'plugin':3,7,41 'requir':25 'ship':29 'simpl':4 'sourc':17 'stabl':20 'support':44 'syntax':53 'templat':46 'type':31 'typescript':30,78 'use':60 'variabl':47 'version':21 'year':48","created_at":"2026-04-27T16:59:11.617279+00:00","updated_at":"2026-04-27T16:59:11.617279+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":"https://codeberg.org/rini/eslint-plugin-simple-header#eslint-plugin-simple-header","github":null,"docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/eslint-plugin-simple-header","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-18","next_check":"2026-07-26","install_tag":null}}