Work around Dart custom lint rule

3a34d1d201c7b30d0143c3d6fbe2b4e5?s=47 tomocy
February 28, 2020

Work around Dart custom lint rule

Flutter Meetup Osaka #2

3a34d1d201c7b30d0143c3d6fbe2b4e5?s=128

tomocy

February 28, 2020
Tweet

Transcript

  1. Dart ಠࣗLintϧʔϧ΁ͷ ϫʔΫΞϥ΢ϯυ 2020/02/28 Flutter Meetup Osaka #2 tomocy (@towocy)

  2. ੩తղੳͱ͸

  3. ੩తղੳ ࣮ߦϑΝΠϧΛ࣮ߦ͢Δ͜ͱͳ͘ ղੳΛߦ͏͜ͱ 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

  4. ੩తղੳΛར༻͢Δ͜ͱͰ ιʔείʔυͷ ิ׬΍ϑΥʔϚοτ͕Ͱ͖Δ

  5. Lint ιʔείʔυʹજΉ໰୊Λ ݕग़ɺࢦఠ͢Δ

  6. None
  7. Lint ιʔείʔυʹજΉ໰୊Λ ݕग़ɺࢦఠ͢Δ

  8. Lint ιʔείʔυʹજΉ໰୊Λ ݕग़ɺࢦఠ͢Δ

  9. analysis_options.yaml

  10. analysis_opsions.yaml LintϧʔϧΛྻڍͯ͠ ݕग़ɺࢦఠͷର৅ΛఆΊΔ

  11. ಠࣗLintϧʔϧ

  12. ಠࣗLintϧʔϧ ެࣜҎ֎ͷLintϧʔϧ΋ཉ͍͠

  13. ಠࣗLintϧʔϧ dart-lang/linter#697ʹͯݕ౼த (2020/02/28࣌఺) https://github.com/dart-lang/linter/issues/697

  14. ಠࣗLintϧʔϧ ͲͷΑ͏ʹ࣮ݱ͞ΕΔʹͤΑ dart-lang/linterΛ࢖͏͜ͱʹͳΓͦ͏

  15. None
  16. LintRuleʢϧʔϧͷ໊લɺઆ໌ɺର৅ͷNodeΛઃఆʣ Visitorʢର৅ͷNodeʹର͢ΔݕূΛ࣮૷ʣ ʢSimpleAstVisitorҎ֎ʹ΋Visitor͕͋Δʣ

  17. None
  18. 1. LintRuleଆͰର৅ͷNodeΛొ࿥͓ͯ͘͠

  19. 2. VisitorଆͰͦͷNodeΛݕࠪ͢Δ 1. LintRuleଆͰର৅ͷNodeΛొ࿥͓ͯ͘͠

  20. ಠࣗLintϧʔϧ΁ͷ ϫʔΫΞϥ΢ϯυ

  21. WidgetͷίϯετϥΫλʔͷҾ਺͸ ׳शతʹ໊લ෇͖Ҿ਺ʹ͢Δ https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html

  22. WidgetͷίϯετϥΫλʔͷҾ਺͸ ׳शతʹ໊લ෇͖Ҿ਺ʹ͢Δ ίϯετϥΫλʔͷҾ਺໊͕લ෇͖Ҿ਺Ͱͳ͍WidgetΛ ໰୊ͱͯ͠ࢦఠ͢ΔLintϧʔϧ https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html

  23. ಠࣗLintϧʔϧ use named parameters in widget constructors

  24. None
  25. None
  26. tool/rule.dart Lintϧʔϧͷ਽ܗͱͦͷςετΛੜ੒͢Δ Lintϧʔϧͷ໊લ

  27. None
  28. ςετ LintΤϥʔΛग़ͯ͠ཉ͍͠ߦʹ // Lint ίϝϯτΛॻ͘

  29. None
  30. Line Rule Lintϧʔϧͷ આ໌ͱৄࡉ

  31. None
  32. Lint Rule Lintͷର৅ͷNodeΛొ࿥

  33. Lint Rule Lintͷର৅ͷNodeΛొ࿥ ࠓճ͸ΫϥεఆٛͷNodeΛղੳ͢Δ

  34. None
  35. Visitor ର৅ͷNodeͷղੳ

  36. Visitor ର৅ͷNodeͷղੳ WidgetͷίϯετϥΫλʔͷҾ਺͕ ໊લ෇͖Ҿ਺Ͱ͋Δ͔Λ֬ೝ

  37. None
  38. None
  39. None
  40. None
  41. ·ͱΊ

  42. - LintͰίʔυͷ໰୊Λݕग़ - analysis_options.yamlͰ ɹLintϧʔϧΛ૊Έ߹Θͤ - ಠࣗLintϧʔϧ͸·ͩඇެࣜ

  43. ϧʔϧΛकָͬͯ͘͠Flutter/Dart!

  44. ͋Γ͕ͱ͏͍͟͝·ͨ͠

  45. 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