aws-samples / aws-samples/sample-autonomous-cloud-coding-agents

chore(eslint): re-enable @cdklabs rules after plugin fixes deprecated context.getFilename()

オープン
#170 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
enhancement tooling
主要言語
TypeScript
スター
143
フォーク
46
平均マージ
3日 10時間
マージ済み PR(30日)
24

説明

## Summary

Four `@cdklabs/eslint-plugin` rules are disabled in `cdk/eslint.config.mjs` because they use the deprecated `context.getFilename()` API which was removed in ESLint 10. Re-enable them when cdklabs publishes a fix.

## Disabled rules

| Rule | Purpose |
|------|---------|
| `@cdklabs/no-core-construct` | Prevents use of deprecated core Construct class |
| `@cdklabs/invalid-cfn-imports` | Validates CloudFormation import patterns |
| `@cdklabs/no-literal-partition` | Catches hardcoded AWS partition strings |
| `@cdklabs/no-invalid-path` | Validates path references |

## Root cause

ESLint 10 removed `context.getFilename()` (deprecated since ESLint 9.x). The replacement is `context.filename`. The `@cdklabs/eslint-plugin@2.0.6` (latest as of 2026-05-22) still calls the removed API, causing runtime errors during linting.

`promiseall-no-unbounded-parallelism` remains enabled as it doesn't use the deprecated API.

## Action required

1. Monitor `@cdklabs/eslint-plugin` releases for a version that uses `context.filename`
2. When published: bump the dependency and remove the `off` overrides from `cdk/eslint.config.mjs`
3. Re-run `mise //cdk:eslint` — the 3 file-level `@cdklabs/no-literal-partition` suppressions in `cdk/src/bootstrap/policies/` will become active again

## Upstream

- Package: https://www.npmjs.com/package/@cdklabs/eslint-plugin
- Current: 2.0.6 (peerDeps: `eslint >=9 <11` — claims ESLint 10 support but uses removed API)
- Consider filing an upstream issue at the cdklabs GitHub org if not already tracked

## Related

- #169 — ESLint 10 upgrade (this was discovered during migration)

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

cdk/eslint.config.mjs から始め、無効化されている @cdklabs ルールと依存関係のバージョンを確認します。context.getFilename() を置き換えるリリースが公開されるか @cdklabs/eslint-plugin を監視し、その後依存関係を更新して off の overrides を削除し、mise //cdk:eslint を実行します。cdk/src/bootstrap/policies/ の suppressions が再び有効になり、ランタイムエラーが発生しないことを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
eslint, typescript
領域
tooling
issue の種類
リファクタリング
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。