背景
awscdk-lint(oxlint-plugin-awscdk)を
apps/cdk に適用する。strict 構成を全ルール有効で導入し、検出された指摘に対応する。
唯一リソース置換を伴う no-construct-stack-suffix は、既存の 2 つの stack name に対してのみ
inline disable コメントで例外化し、破壊的変更を回避する(新規コードには引き続き適用される)。
検証は type-aware モードで実施(--type-aware 必須。付けないと型情報必須ルールが
黙ってスキップされ false negative になる)。
方針
oxlint-plugin-awscdk の strict 構成を全ルール有効で適用する。
- 検出された非破壊的な指摘(型注釈・readonly・未使用 Props 削除・コンストラクタ引数名・JSDoc)を修正する。
- 既存 stack name のみ例外化:
bin/cdk.ts の 2 箇所は disable コメントで抑制する。
対応する指摘(strict / type-aware、いずれも synth 出力不変)
| ルール |
件数 |
主な箇所 |
require-jsdoc |
28 |
各 construct / props |
no-mutable-property-of-props-interface |
27 |
webapp.ts, service.ts, bin/cdk.ts, us-east-1-stack.ts ほか |
no-construct-in-public-property-of-construct |
4 |
service.ts(urlParameter), event-bus/index.ts(api), auth/index.ts(userPool,client) |
no-construct-in-interface |
3 |
webapp.ts(accessLogBucket), service.ts(handler,accessLogBucket) |
no-unused-props |
2 |
service.ts(basicAuthUsername,basicAuthPassword) |
require-props-default-doc |
1 |
オプショナル Props |
construct-constructor-property |
1 |
database.ts / event-bus/index.ts |
(pascal-case-construct-id / no-parent-name-construct-id-match /
no-variable-construct-id / prevent-construct-id-collision / require-passing-this は検出 0 件)
例外化する指摘(リソース置換を伴うため disable)
| ルール |
件数 |
箇所 |
対応 |
no-construct-stack-suffix |
2 |
bin/cdk.ts(ServerlessWebappStarterKitStack, ServerlessWebappStarterKitUsEast1Stack) |
直上に // oxlint-disable-next-line awscdk/no-construct-stack-suffix + 理由コメント。stack ID 変更 = スタックごと再作成(RETAIN の DSQL/Cognito が孤立)のため既存名を維持 |
完了条件
補足
- 型情報必須ルールは素の
oxlint ではスキップされる。CI 組込みには
oxlint-tsgolint + --type-aware が前提。既存の lint:ci スクリプトの更新が必要。
- プラグイン peer 依存は
oxlint >= 1.70。現状リポジトリは oxlint ^1(要バージョン確認)。
- disable コメントが type-aware モードの JS プラグイン規則に効くことは検証済み。
背景
awscdk-lint(
oxlint-plugin-awscdk)をapps/cdkに適用する。strict 構成を全ルール有効で導入し、検出された指摘に対応する。唯一リソース置換を伴う
no-construct-stack-suffixは、既存の 2 つの stack name に対してのみinline disable コメントで例外化し、破壊的変更を回避する(新規コードには引き続き適用される)。
検証は type-aware モードで実施(
--type-aware必須。付けないと型情報必須ルールが黙ってスキップされ false negative になる)。
方針
oxlint-plugin-awscdkのstrict構成を全ルール有効で適用する。bin/cdk.tsの 2 箇所は disable コメントで抑制する。対応する指摘(strict / type-aware、いずれも synth 出力不変)
require-jsdocno-mutable-property-of-props-interfacewebapp.ts,service.ts,bin/cdk.ts,us-east-1-stack.tsほかno-construct-in-public-property-of-constructservice.ts(urlParameter),event-bus/index.ts(api),auth/index.ts(userPool,client)no-construct-in-interfacewebapp.ts(accessLogBucket),service.ts(handler,accessLogBucket)no-unused-propsservice.ts(basicAuthUsername,basicAuthPassword)require-props-default-docconstruct-constructor-propertydatabase.ts/event-bus/index.ts(
pascal-case-construct-id/no-parent-name-construct-id-match/no-variable-construct-id/prevent-construct-id-collision/require-passing-thisは検出 0 件)例外化する指摘(リソース置換を伴うため disable)
no-construct-stack-suffixbin/cdk.ts(ServerlessWebappStarterKitStack,ServerlessWebappStarterKitUsEast1Stack)// oxlint-disable-next-line awscdk/no-construct-stack-suffix+ 理由コメント。stack ID 変更 = スタックごと再作成(RETAIN の DSQL/Cognito が孤立)のため既存名を維持完了条件
strict構成を全ルール有効で導入するbin/cdk.tsの 2 箇所を disable コメント + 理由コメントで例外化するcdk synthの diff がゼロ(logical ID・テンプレート不変)であることをスナップショットテストで確認pnpm --filter @repo/cdk run lint:ci(type-aware 前提)が pass する補足
oxlintではスキップされる。CI 組込みにはoxlint-tsgolint+--type-awareが前提。既存のlint:ciスクリプトの更新が必要。oxlint >= 1.70。現状リポジトリはoxlint ^1(要バージョン確認)。