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

fix(tooling): cdk/scripts is excluded from eslint, so its eslint-disable directives are inert

Offen
#882 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
TypeScript
Sterne
143
Forks
46
Ø Merge
3 T. 10 Std.
Gemergte PRs (30 T.)
24

Beschreibung

**Component:** cdk (tooling)

## Describe the bug

`cdk/eslint.config.mjs:49` scopes the TypeScript config to `['src/**/*.ts', 'test/**/*.ts']`, so `cdk/scripts/` is never linted:

```
$ npx eslint scripts/generate-bootstrap-template.ts
0:0 warning File ignored because no matching configuration was supplied
```

Two consequences:

1. **The `eslint-disable` directives already in those files are inert.** `scripts/generate-bootstrap-template.ts` carries five of them. They read as deliberate suppressions of real rules, but nothing is being suppressed because no rule ever runs — so a reader can't tell which are load-bearing and which are leftovers.
2. **`mise //cdk:eslint` runs `eslint --fix src test`**, so even widening the config's `files` glob would not lint `scripts/` until that task is updated too. Both halves need changing.

This was harmless while `scripts/` was write-only tooling invoked by mise. It matters more now: `cdk/test/bootstrap/bootstrap-template.test.ts` imports `buildTemplate()` and `renderTemplate()` from the generator ([#867](https://github.com/aws-samples/sample-autonomous-cloud-coding-agents/pull/867)), so generator code is on a test path while sitting outside the lint surface that governs everything else it touches.

## Expected behavior

Either `cdk/scripts/**/*.ts` is linted like `src/` and `test/`, or the exclusion is deliberate and recorded — with the inert `eslint-disable` comments removed so they don't imply otherwise.

## Current behavior

`scripts/` is silently unlinted. `eslint` reports the ignore only as a warning, so `mise //cdk:eslint` passes and nothing signals the gap.

## Reproduction steps

```bash
cd cdk
npx eslint scripts/generate-bootstrap-template.ts # "File ignored because no matching configuration"
grep -c eslint-disable scripts/generate-bootstrap-template.ts # 5 inert directives
grep -n "files:" eslint.config.mjs | head -2 # src/** and test/** only
```

## Possible solution

1. Add `scripts/**/*.ts` to the `files` glob at `eslint.config.mjs:49`, probably as its own block — scripts are Node-side and may legitimately want different rules than CDK constructs (`no-console` being the obvious one, since these are CLI tools that print).
2. Update the `//cdk:eslint` task in `cdk/mise.toml` from `src test` to include `scripts`.
3. Fix or delete whatever the newly-active rules flag, including the five directives that are currently no-ops.

Worth checking whether `cli/` and `docs/` have the same gap — `//cli:eslint` passes `src test build-tools`, so it may already cover its equivalent.

## Notes

Raised by @ayushtr-aws while reviewing [#867](https://github.com/aws-samples/sample-autonomous-cloud-coding-agents/pull/867) as pre-existing and out of scope for that PR. Filing separately as suggested.

## Environment

- Commit `e96dc21e` (also present well before it — the config predates the PR)

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit cdk/eslint.config.mjs:49 und cdk/mise.toml und führe dann die Reproduktionsbefehle aus dem Issue gegen scripts/generate-bootstrap-template.ts aus. Überprüfe die neu gelinteten cdk/scripts-Dateien und die fünf eslint-disable-Direktiven, einschließlich aller Regeln, die sie sichtbar machen. Erledigt ist es, wenn die Skripte durch die Lint-Aufgabe des Projekts abgedeckt sind und die Direktiven oder daraus resultierenden Verstöße beabsichtigt und behoben sind.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
eslint, typescript
Bereich
build-system, tooling
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Aktiv
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
76/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.