Summary
The eslint-plugin-license-header rule reports "Superfluous new lines before license header" on files that start with a shebang (#!/usr/bin/env node) followed by the license comment. The current workaround disables the rule entirely for src/bin/**/*.ts — this hides the problem instead of fixing it.
Problem
cli/src/bin/bgagent.ts starts with:
#!/usr/bin/env node
/**
* MIT No Attribution
* ...
*/
The license-header plugin expects the license comment at line 1. The shebang line + blank line before it triggers "superfluous new lines." The --fix option can't resolve this because removing the shebang would break the executable.
Current workaround (PR #171)
// eslint.config.mjs
{
files: ['src/bin/**/*.ts'],
rules: { 'license-header/header': 'off' },
}
This means shebang files have NO license header enforcement — a file could lose its header and ESLint wouldn't catch it.
Desired behavior
The license-header rule should:
- Recognize shebangs as valid preamble before the license header
- Still enforce that the license header appears immediately after the shebang (with at most one blank line separator)
Options
- Upstream fix: File an issue/PR on
eslint-plugin-license-header to support shebang-aware header detection
- Custom rule: Write a project-local rule that handles shebangs (more maintenance)
- Different plugin: Evaluate alternatives (e.g.,
eslint-plugin-header) that may already handle shebangs
- Plugin configuration: Check if
eslint-plugin-license-header has an option for allowed preamble patterns (shebangs, @ts-check, etc.)
Related
Summary
The
eslint-plugin-license-headerrule reports "Superfluous new lines before license header" on files that start with a shebang (#!/usr/bin/env node) followed by the license comment. The current workaround disables the rule entirely forsrc/bin/**/*.ts— this hides the problem instead of fixing it.Problem
cli/src/bin/bgagent.tsstarts with:The license-header plugin expects the license comment at line 1. The shebang line + blank line before it triggers "superfluous new lines." The
--fixoption can't resolve this because removing the shebang would break the executable.Current workaround (PR #171)
This means shebang files have NO license header enforcement — a file could lose its header and ESLint wouldn't catch it.
Desired behavior
The license-header rule should:
Options
eslint-plugin-license-headerto support shebang-aware header detectioneslint-plugin-header) that may already handle shebangseslint-plugin-license-headerhas an option for allowed preamble patterns (shebangs,@ts-check, etc.)Related