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
910
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主導のプログラミング学習アプリを作ってみた
econanringo
0
170
パーソナライズPodcastを作った話
repunit11
0
140
Agentic Software Factoryに、すごく賢いIF文を。 / super smart IF statement into the Agentic Software Factory.
rkaga
8
2.2k
RAG の “R” を Swift で覗いてみる 〜「意味から探す」検索の仕組み〜
nao_randd
0
160
HTML-in-Canvasで作る未来のWeb UI表現
clockmaker
5
4.8k
GemmaをJevのように使ってみる / Use Gemma like Jev
kishida
5
780
contenteditable と日本語入力に向き合う
colorful12
0
190
SREの越境 / SRE Collaboration
y0hgi
2
310
全ての永続トークンを、生まれる前に消し去りたい!
sylph01
1
330
【加筆修正版】Laravel のアプリケーションをどこにデプロイするか #phpcon_ehime
akase244
0
150
sbt 2.0: takeoff
eed3si9n
0
150
コーディング自動化の次へ。人の介入をゼロにするファクトリーとサポートAIによる実践
timakin
2
1.8k
Featured
See All Featured
Test your architecture with Archunit
thirion
2
2.4k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
630
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
2
360
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
460
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.6k
Darren the Foodie - Storyboard
khoart
PRO
4
4k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
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