[Flutter] Lint - pedantic lint 적용하기

jaehee kim·2021년 5월 23일
1

Flutter

목록 보기
3/20
post-thumbnail

Lint - pedantic lint 적용하기

Lint?

소스 코드를 분석하여 프로그램 오류, 버그, 스타일 오류 등 실수할 수 있는 부분들을 개발자에게 안내해주는 장치

여러가지 lint 중에서 Google 에서 사용하는 pedantic 을 적용하는 방법에 대해서 알아보겠습니다.
먼저, project에 pedantic package를 적용합니다.

[pub.dev - pedantic]

마지막으로 analysis_options.yaml file 을 만들어주고, 다음과 같이 작성합니다.

  • 추가적으로 const keyword를 어디에 작성해주면 좋을지 알려주는 prefer_const_declarations, prefer_const_constructors 를 적용하였습니다.

<analysis_options.yaml>

  include: package:pedantic/analysis_options.yaml
  
  analyzer:
    errors:
      prefer_const_declarations: error
      prefer_const_constructors: error
      missing_required_param: error

  linter:
    rules:
      prefer_const_declarations: true
      prefer_const_constructors: true
      missing_required_param: true
      



Reference

[Linter for Dart]
[google/pedantic]
[개발하는남자]
[The Coding Papa 더코딩파파]

0개의 댓글