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
Ren Yamanashi
January 16, 2025
Programming
890
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
750
AWS初心者ってどうやってAWSを学ぶ?〜アプリエンジニアがやってよかったアーキテクチャ学習方法〜
yamanashi_ren01
0
720
Other Decks in Programming
See All in Programming
モデルのリファクタリングが難しいと思ったら、そもそも複雑だったのはビジネス仕様だった ? / is-the-business-domain-the-real-complexity
hatsu38
0
350
テストを司るデーモンに会いに行く 〜隔離した仮想マシンでテストを通すまで〜
h1d3mun3
1
510
Starting & Sustaining Code-Based E2E Testing for Non-Coding QA Teams( #jasstniigata )
teyamagu
PRO
1
430
The Rails Doctrine Decade
koic
2
150
Webの地図
yosuke_furukawa
PRO
6
4.6k
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
220
What We Talk About When We Talk About XP
m_seki
2
660
Everything will be SERVERLESS — 信じて運用した10年の経験値 / Everything Will be Serverless — Lessons Learned from 10 Years of Operational Experience
seike460
PRO
1
290
Streamlitで実現する自然言語データアプリ開発
ayumu_yamaguchi
1
290
選挙速報を多くのユーザーへ 届ける Live Activities 設計
hamayokokuririn
0
150
App Intentsのビルドプロセスを支える技術
kntkymt
0
400
App Storeの外へ──日本のiOSサイドローディング入門 for iOSDC Japan 2026
yuukiw00w
0
220
Featured
See All Featured
Mobile First: as difficult as doing things right
swwweet
225
10k
Fashionably flexible responsive web design (full day workshop)
malarkey
409
67k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
700
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
240
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.9k
The untapped power of vector embeddings
frankvandijk
2
1.9k
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
Making the Leap to Tech Lead
cromwellryan
135
10k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
460
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
330
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