무기/다트

<Dart> Linter 사용하기

디벅잉 2021. 5. 6. 23:42
728x90

complie 단계에서의 에러를 사전에 체크해 주는 것은

android studio 같은 IDE를 사용하는 주요한 이유이다

 

이 때 Lint를 활용하면

+++ WHAT +++

개발자가 원하는 에러 / 스타일 / 패키지 관련

안내 / 경고 / 에러를 발생시켜

+++ WHY +++

개인적으로는 일관된 개발 습관을 기르고,

조직적으로는 통일된 개발 형식을 공유할 수 있다는 장점이 있다

 

+++ HOW +++

1. pub.dev 에서 'pedantic' 검색

2. pubspec.yaml 에서 dev_dependencies 아래에 'pedantic: ^1.11.0' 입력(2021-05-06 기준)

    ※ dependencies 와 dev_dependencies 의 차이점: 전자는 배포단계에서 적용 / 후자는 개발단계(테스트)에서 적용

3. 프로젝트 폴더(pubspec.yaml 파일과 같은 위치)에 analysis_options.yaml 파일 만들기

4. analysis_options.yaml 파일에 'include: package:pedantic/analysis_options.yaml' 입력

※ 해당 과정은 구글에서 사용하는 Lint를 사용하기 위한 방법으로 아래 주소에서 어떤 항목이 적용되었는지 확인 가능

github.com/google/pedantic/blob/master/lib/analysis_options.1.11.0.yaml

 

google/pedantic

How to get the most value from Dart static analysis - google/pedantic

github.com

※ Dart의 전체 Lint가 궁금하다면 아래 링크에서 확인

dart-lang.github.io/linter/lints/

 

Linter for Dart

Linter for Dart Lint Rules Using the Linter Supported Lint Rules This list is auto-generated from our sources. Rules are organized into familiar rule groups. errors - Possible coding errors. style - Matters of style, largely derived from the official Dart

dart-lang.github.io

 

*도움: 유튜브 더코딩파파 www.youtube.com/watch?v=xxJkq-zvWqI

 

728x90