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
810
AWS初心者ってどうやってAWSを学ぶ?〜アプリエンジニアがやってよかったアーキテクチャ学習方法〜
yamanashi_ren01
0
730
Other Decks in Programming
See All in Programming
當我們開始不讀 Code - AI Agent 時代,Code Review 與 Clean Code 還剩下什麼?
jame2408
1
360
ActionController meets Protocol Buffers
sorah
1
780
自作Discord音声botをLambda MicroVMsに移行した話 / Migrating My Discord Voice Bot to Lambda MicroVMs
akihisaikeda
1
270
Kotlinize Is Not Just Converting to Kotlin
chigichan24
1
220
Railsのためのパスキー実践入門 〜マルチテナントSaaSでの意思決定〜
utakaha
4
3k
SFCで実現する病院・医療システムの動的組み立て式UI
koukimiura
1
170
AI駆動開発4年目の現在地(『あなたはFDEになるべきか?』イベント資料)
kumaiu
0
130
複数ドメインを一つのアプリに統合するFlutterの設計と運用_FlutterKaigi2026登壇資料(須永高弘)
takahirosunaga
0
140
graphql-ruby を Spinel で速くしようとした話
mtsmfm
0
140
느린 네트워크와 저사양 디바이스 사용자를 위한 웹뷰 로딩 시간 개선기
kmkim
1
180
AI時代のシニアエンジニアとは
yosuke_furukawa
PRO
14
11k
baseline으로 마이그레이션, 리팩토링 안전하게 맡기기
fornewid
1
870
Featured
See All Featured
Designing Experiences People Love
moore
143
24k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.9k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
540
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
420
How to train your dragon (web standard)
notwaldorf
96
6.9k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.7k
Documentation Writing (for coders)
carmenintech
77
5.6k
Heart Work Chapter 1 - Part 1
lfama
PRO
10
37k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1.1k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.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