Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
ESLintプラグインを使用してCDKのセオリーを適用する
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Ren Yamanashi
January 16, 2025
Programming
900
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
ESLintプラグインを使用してCDKのセオリーを適用する
クラスメソッドのAWS CDK事情大公開スペシャル#2 で発表したLTのスライドになります
https://classmethod.connpass.com/event/337711/
Ren Yamanashi
January 16, 2025
More Decks by Ren Yamanashi
See All by Ren Yamanashi
保守性を高める AWS CDK のセオリー・ベストプラクティス
yamanashi_ren01
6
1.5k
CDK開発におけるコーディング規約の運用
yamanashi_ren01
3
790
AWS初心者ってどうやってAWSを学ぶ?〜アプリエンジニアがやってよかったアーキテクチャ学習方法〜
yamanashi_ren01
0
730
Other Decks in Programming
See All in Programming
[ハンズオン]AIへの指示だけで「五目並べ」を作ってみよう
satoshi256kbyte
1
350
Androidだけじゃない、DroidKaigiで広がった私の技術スタック
akkeylab
0
120
自サークルのIdPからログアウトできるようになるまで
taiseiue
0
110
半永久的に提供し続けられるプライベートクラウドを目指して ― 利用者の認知負荷を抑えるAPI抽象化とハードウェア世代交代の基盤設計
tomokon
0
450
ジョジョの世界をXRで再現する
mofurune
0
130
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
190
iOS 27でニュースアプリはどう変わる!? 〜日経電子版の新機能対応と、開発事例から〜
lynnswap
7
13k
mrbgem 三角測量 開発
ogom
0
200
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
540
Agentic Software Factoryに、すごく賢いIF文を。 / super smart IF statement into the Agentic Software Factory.
rkaga
8
1.9k
Jetpack Compose Mechanisms
skydoves
2
510
AIに “答え“を書かせるのを やめてみた
___akari11
0
110
Featured
See All Featured
The Invisible Side of Design
smashingmag
301
52k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
350
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
Paper Plane
katiecoart
PRO
4
54k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.5k
Building AI with AI
inesmontani
PRO
1
1.3k
The Pragmatic Product Professional
lauravandoore
37
7.5k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.2k
The Language of Interfaces
destraynor
162
27k
Mobile First: as difficult as doing things right
swwweet
225
10k
Docker and Python
trallard
47
4.2k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.4k
Transcript
2025/01/17 山梨 蓮 クラスメソッドのAWS CDK事情大公開スペシャル#2
自己紹介 @ren_yamanashi ・job : web engineer (backend) ・lang 📝: TypeScript
・hobby 🚀: CDK Contribute
・TypeScriptを使用した開発を想定しています 前提
自己紹 介 CDKにおける「セオリー」とは?
・construct ID は PascalCaseで書く ・propsのプロパティはreadonlyに CDKのセオリー ・props/Constructで公開するリソースのプロパティはClassではなくInterfaceに など
・特にCDK / TypeScript になれていない場合 CDKコーディングにおける課題 ・セオリーを意識しながらのコーディングが大変 ・メンバー間で認識のレベルに差がある
・特にCDK / TypeScript になれていない場合 CDKコーディングにおける課題 レビューで毎回同じ指摘をする(される) ・セオリーを意識しながらのコーディングが大変 ・メンバー間で認識のレベルに差がある
・特にCDK / TypeScript になれていない場合 CDKコーディングにおける課題 レビューで毎回同じ指摘をする(される) ・セオリーを意識しながらのコーディングが大変 ・メンバー間で認識のレベルに差がある (レビュー漏れも・・・)
自己紹 介 この課題を ESLintを使って解決する
・JS / TS コードを解析し、構文エラーやルール違反コードを検出するツール ESLintとは? ・基本的なルールはESLintから提供される ・ルールはユースケースに応じて自前で作成可能
課題 ESLintを使用した課題の解決 ・セオリーを一つ一つ意識するのが大変なこと 解決方法 ・毎回同じ指摘をすること / レビュー漏れが起きること ・ESLintを使用した機械的な解析によって自動検知する ・意識しなくても /
レビューしなくても 勝手にエラーになる
自己紹 介 課題を解決するために
自己紹 介 CDKに特化した ESLintルールを作りました
自己紹 介
サポートしているルール(一部) eslint-cdk-pluginの紹介 ① construct ID は PascalCase で書く ② construct
には必ず this を渡す ③ construct ID に変数を使用しない ④ propsやconstructで公開するリソースのプロパティはinterfaceにする ⑤ propsやconstructで公開するリソースのプロパティはreadonlyにする CDKのセオリー / ベストプラクティス強制するESLintルール
自己紹 介 ① construct ID は PascalCase で書く
こちらの記事で紹介されているもの ① construct ID は PascalCase で書く
① construct ID は PascalCase で書く
自己紹 介 ② construct には必ず this を渡す
CDKのメンテナである Rico Hermans (@rrix0rr) 氏から提案いただいたもの ② construct には必ず this を渡す
② construct には必ず this を渡す
construct に this を渡すことは正しいリソース階層を維持するために重要 scope のような値を使用すると・・・ ② construct には必ず this
を渡す ・生成されるCFnテンプレートのリソース階層が正しくない ・予期しないリソースの命名 のような問題が起こる
自己紹 介 ③ construct ID に変数を使用しない
こちらもrrix0rr氏から提案いただいたもの ③ construct ID に変数を使用しない
③ construct ID に変数を使用しない
construct ID に変数を使用すると・・・ ③ construct ID に変数を使用しない ・不要な重複 ・パラメータ変更時のリソース再作成 のような問題が起こり得る
・IDの一意性を重視するあまり、不要な文字列を混在させてしまう
自己紹 介 ④ propsやconstructで公開する リソースのプロパティはinterfaceにする
こちらのスライドで紹介されているもの ④ propsやconstructで公開するリソースのプロパティは interfaceにする
④ propsやconstructで公開するリソースのプロパティは interfaceにする
④ propsやconstructで公開するリソースのプロパティは interfaceにする
自己紹 介 ⑤ propsやconstructで公開する リソースのプロパティはreadonlyにする
同じく、こちらのスライドで紹介されているもの ⑤ propsやconstructで公開するリソースのプロパティは readonlyにする
⑤ propsやconstructで公開するリソースのプロパティは readonlyにする
⑤ propsやconstructで公開するリソースのプロパティは readonlyにする
まとめ ・セオリーを自動適用するプラグインを紹介 ・導入方法などはドキュメントをご覧ください 🙏 https://eslint-cdk-plugin.dev/ ・「こんなルールが欲しい」という要望もお待ちしております!! ・Twitter(X): @ren_yamanashi ・Github: @ren-yamanashi