Dart 및 Flutter 프로젝트를 위한 엄격하고 커뮤니티 중심의 린트 규칙 세트로, 일관된 코드 품질과 최선의 실천 방법을 강제하기 위해 설계되었습니다. `pedantic`의 기반 위에 더 엄격한 기준을 적용하여 개발자가 더 깔끔하고 유지보수성이 뛰어난 코드를 작성할 수 있도록 도와줍니다. 여러 플랫폼에서 표준화되고 의견이 분명한 코드 분석 접근법을 원하는 팀에게 이상적입니다.
사용 사례
팀 프로젝트에서 일관된 코드 스타일 강제 적용
엄격한 린팅을 통한 코드 품질 향상
정적 분석을 통한 코드 리뷰 자동화
Flutter 앱 간에 일관된 코딩 기준 유지
CI/CD 파이프라인에 린팅 통합하기
주요 기능
엄격하고 입장을 명확히 한 린트 규칙
커뮤니티 유지보수 및 최신 상태
더 엄격한 지침으로 pedantic 확장
모든 주요 Flutter 플랫폼을 지원합니다
pub add 명령을 통한 간편한 통합
적합한 대상
코드 일관성을 우선시하는 팀
높은 코드 품질을 요구하는 프로젝트
다양한 플랫폼에서 Flutter을 사용하는 개발자
자동 린트 검사를 필요로 하는 CI/CD 환경
현대적인 Dart 실천을 채택한 프로젝트
고려 사항
상당한 코드 조정이 필요할 수 있습니다
매우 관대한 코딩 스타일에는 적합하지 않습니다
초기 설정의 복잡성을 증가시킬 수 있습니다
지속적인 lint 구성 유지보수가 필요합니다
다른 린터 패키지와 충돌할 수 있습니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
Lint for Dart/Flutter
lint is a hand-picked, open-source, community-driven collection of lint rules for Dart and Flutter projects.
The set of rules follows the Effective Dart: Style Guide.
This package can be used as a replacement for package:lints or the discontinued package:pedantic for those who prefer stricter rules.
lint supports 3 different set of rules:
strict: tries to be strict but not annoying. Perfect for production app code
casual: great when prototyping, to be used in code samples, any non-production code
package: like strict but for dart packages, that have a public API
Install
Add lint as dependency to your pubspec.yaml. Version ^1.0.0 means you're automatically getting the latest version for lint when running pub upgrade
dev_dependencies:lint:^2.0.0
Create an analysis_options.yaml file in the root of your project with the following content:
# This file configures the analyzer to use the lint rule set from `package:lint`include:package:lint/strict.yaml# For production apps# include: package:lint/casual.yaml # For code samples, hackathons and other non-production code# include: package:lint/package.yaml # Use this for packages with public API# You might want to exclude auto-generated files from dart analysis.# Uncomment the section below and the files you want to exclude.# analyzer:# exclude:# - '**.freezed.dart'# - '**.g.dart'# You can customize the lint rules set to your own liking. A list of all rules# can be found at https://dart.dev/tools/linter-rules# Uncomment the section below and the rules you want to customize.# linter:# rules:# Util classes are awesome!# avoid_classes_with_only_static_members: false# Make constructors the first thing in every class# sort_constructors_first: true# Choose wisely, but you don't have to# prefer_double_quotes: true# prefer_single_quotes: true
Lint badge
You're using lint in your open-source project?
Add the badge to your README.md show that you honor strict lint rules
Google publicly shares their internal rules as package:pedantic in open-source.
It represents what Google is enforcing internally throughout all Dart code.
For a lint rule to be added to pedantic, Google has to change all code which doesn't follow the style.
This strict practice results in only 27/150+ rules to be enabled.
While some are contradictory to each other and can not enabled together, a big chunk of rules isn't enabled because it requires too much work to update all of Googles existing code.
For developers outside Google, it is the norm to have separate lint rules per project.
One project might enable more rules then others.
lint enables a majority of lint rules, leaving out contradictory and very opinionated rules.
License
Copyright 2022 Pascal Welsch
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.