aws-samples / aws-samples/sample-autonomous-cloud-coding-agents
chore(eslint): re-enable @cdklabs rules after plugin fixes deprecated context.getFilename()
- Dominant language
- TypeScript
- Stars
- 143
- Forks
- 46
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 20
Description
## 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)
Contributor guide
Assessment
This issue has not been assessed yet.