aws-samples / aws-samples/sample-autonomous-cloud-coding-agents
fix(eslint): support license headers in shebang files without disabling the rule
まだ誰も着手していません。
- 主要言語
- TypeScript
- スター
- 146
- フォーク
- 46
- 平均マージ
- 3日 10時間
- マージ済み PR(30日)
- 24
説明
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-headerto 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-headerhas an option for allowed preamble patterns (shebangs,@ts-check, etc.)
Related
- PR #171 — ESLint 10 migration (introduced the workaround)
- #169 — ESLint 10 upgrade issue
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
eslint.config.mjs と cli/src/bin/bgagent.ts から始め、次に PR #171 と、shebang に関する eslint-plugin-license-header の動作を確認します。プラグインが許可されたプリアンブルをサポートしているか確認し、サポートしていない場合は upstream-fix、custom-rule、alternative-plugin の各オプションを比較します。完了の条件は、shebang を含むファイルで実行可能ヘッダーが維持され、その直後にライセンスヘッダーが引き続き適用され、空行が最大 1 行であることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- eslint, typescript
- 領域
- developer-experience, tooling
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 48/100