Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Work around Dart custom lint rule
Search
tomocy
February 28, 2020
Programming
1
420
Work around Dart custom lint rule
Flutter Meetup Osaka #2
tomocy
February 28, 2020
Tweet
Share
More Decks by tomocy
See All by tomocy
Write Container Runtime in Go
tomocy
4
3.1k
Other Decks in Programming
See All in Programming
「Chatwork」Android版アプリを 支える単体テストの現在
okuzawats
0
180
Monixと常駐プログラムの勘どころ / Scalaわいわい勉強会 #4
stoneream
0
280
ドメインイベント増えすぎ問題
h0r15h0
2
360
PHPで作るWebSocketサーバー ~リアクティブなアプリケーションを知るために~ / WebSocket Server in PHP - To know reactive applications
seike460
PRO
2
510
Mermaid x AST x 生成AI = コードとドキュメントの完全同期への道
shibuyamizuho
0
160
SymfonyCon Vienna 2025: Twig, still relevant in 2025?
fabpot
3
1.2k
良いユニットテストを書こう
mototakatsu
8
2.8k
ブラウザ単体でmp4書き出すまで - muddy-web - 2024-12
yue4u
3
480
선언형 UI에서의 상태관리
l2hyunwoo
0
180
php-conference-japan-2024
tasuku43
0
320
Kaigi on Railsに初参加したら、その日にLT登壇が決定した件について
tama50505
0
100
数十万行のプロジェクトを Scala 2から3に完全移行した
xuwei_k
0
280
Featured
See All Featured
A Philosophy of Restraint
colly
203
16k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Adopting Sorbet at Scale
ufuk
73
9.1k
How GitHub (no longer) Works
holman
311
140k
Optimising Largest Contentful Paint
csswizardry
33
3k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
Raft: Consensus for Rubyists
vanstee
137
6.7k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Docker and Python
trallard
42
3.1k
Unsuck your backbone
ammeep
669
57k
Transcript
Dart ಠࣗLintϧʔϧͷ ϫʔΫΞϥϯυ 2020/02/28 Flutter Meetup Osaka #2 tomocy (@towocy)
੩తղੳͱ
੩తղੳ ࣮ߦϑΝΠϧΛ࣮ߦ͢Δ͜ͱͳ͘ ղੳΛߦ͏͜ͱ https://ja.wikipedia.org/wiki/%E9%9D%99%E7%9A%84%E3%82%B3%E3%83%BC%E3%83%89%E8%A7%A3%E6%9E%90
੩తղੳΛར༻͢Δ͜ͱͰ ιʔείʔυͷ ิϑΥʔϚοτ͕Ͱ͖Δ
Lint ιʔείʔυʹજΉΛ ݕग़ɺࢦఠ͢Δ
None
Lint ιʔείʔυʹજΉΛ ݕग़ɺࢦఠ͢Δ
Lint ιʔείʔυʹજΉΛ ݕग़ɺࢦఠ͢Δ
analysis_options.yaml
analysis_opsions.yaml LintϧʔϧΛྻڍͯ͠ ݕग़ɺࢦఠͷରΛఆΊΔ
ಠࣗLintϧʔϧ
ಠࣗLintϧʔϧ ެࣜҎ֎ͷLintϧʔϧཉ͍͠
ಠࣗLintϧʔϧ dart-lang/linter#697ʹͯݕ౼த (2020/02/28࣌) https://github.com/dart-lang/linter/issues/697
ಠࣗLintϧʔϧ ͲͷΑ͏ʹ࣮ݱ͞ΕΔʹͤΑ dart-lang/linterΛ͏͜ͱʹͳΓͦ͏
None
LintRuleʢϧʔϧͷ໊લɺઆ໌ɺରͷNodeΛઃఆʣ VisitorʢରͷNodeʹର͢ΔݕূΛ࣮ʣ ʢSimpleAstVisitorҎ֎ʹVisitor͕͋Δʣ
None
1. LintRuleଆͰରͷNodeΛొ͓ͯ͘͠
2. VisitorଆͰͦͷNodeΛݕࠪ͢Δ 1. LintRuleଆͰରͷNodeΛొ͓ͯ͘͠
ಠࣗLintϧʔϧͷ ϫʔΫΞϥϯυ
WidgetͷίϯετϥΫλʔͷҾ ׳शతʹ໊લ͖Ҿʹ͢Δ https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html
WidgetͷίϯετϥΫλʔͷҾ ׳शతʹ໊લ͖Ҿʹ͢Δ ίϯετϥΫλʔͷҾ໊͕લ͖ҾͰͳ͍WidgetΛ ͱͯ͠ࢦఠ͢ΔLintϧʔϧ https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html
ಠࣗLintϧʔϧ use named parameters in widget constructors
None
None
tool/rule.dart LintϧʔϧͷܗͱͦͷςετΛੜ͢Δ Lintϧʔϧͷ໊લ
None
ςετ LintΤϥʔΛग़ͯ͠ཉ͍͠ߦʹ // Lint ίϝϯτΛॻ͘
None
Line Rule Lintϧʔϧͷ આ໌ͱৄࡉ
None
Lint Rule LintͷରͷNodeΛొ
Lint Rule LintͷରͷNodeΛొ ࠓճΫϥεఆٛͷNodeΛղੳ͢Δ
None
Visitor ରͷNodeͷղੳ
Visitor ରͷNodeͷղੳ WidgetͷίϯετϥΫλʔͷҾ͕ ໊લ͖ҾͰ͋Δ͔Λ֬ೝ
None
None
None
None
·ͱΊ
- LintͰίʔυͷΛݕग़ - analysis_options.yamlͰ ɹLintϧʔϧΛΈ߹Θͤ - ಠࣗLintϧʔϧ·ͩඇެࣜ
ϧʔϧΛकָͬͯ͘͠Flutter/Dart!
͋Γ͕ͱ͏͍͟͝·ͨ͠
Links ੩తղੳ https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html Issue ‘Support custom lint rule' https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html Stateless
Widget https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html Lint rule ‘use named parameters in widget constructors’ https://github.com/tomocy/dart-linter/tree/use_named_parameters_in_widget_constructors