This package provides lint rules for Dart and Flutter which are used at JESI.
For more information on each option, see the complete list of options.
For more information about the core libraries, see the related package:
To use the linting options, add a dependencies into your pubspec.yaml
:
dev_dependencies:
lints: ^1.0.1 # Add for Dart
# flutter_lints: ^1.0.0 # Add for Flutter
jesi_dart_analysis:
git:
url: https://github.com/jesims/jesi_dart_analysis.git
ref: #<tag, branch name, or omit to default to master>
Then, create the file analysis_options.yaml
and add an include statement:
# For Dart
include: package:jesi_dart_analysis/analysis_options.yaml
# For Flutter
include: package:jesi_dart_analysis/analysis_options.flutter.yaml
This will ensure you always use the latest version of the lints.
There may be cases where specific lint rules are undesirable. Lint rules can be suppressed at the line, file, or project level.
To suppress a specific lint rule for a specific line of code, use an ignore
comment directly above the line.
Read More
// ignore: uri_does_not_exist
import '/__generated__/main.gql.dart';
import 'collection_extensions.dart';
To suppress a specific lint rule of a specific file, use an ignore_for_file
comment at the top of the file.
Read More
// ignore_for_file: uri_does_not_exist
import '/__generated__/main.gql.dart';
import '/__generated__/another.gql.dart';
To suppress a specific lint rule for an entire project, modify analysis_options.yaml
.
Read More
include: package:jesi_dart_analysis/analysis_options.yaml
linter:
rules:
prefer_single_quotes: false
- Follow Semantic Versioning
- Update the
CHANGELOG.md
accordingly - When updating linter rules, ensure the rule is changed in both
analysis_options.yaml
andanalysis_options.flutter.yaml
. Unless the rule pertains exclusively to either Flutter or Dart. - After merging, create (and push) a new
tag
for the versiongit tag x.x.x
git push -u --tags
- Consider CI/CD Automation
- If package maintenance starts becoming a lot of effort maintaining two analysis files, consider creating a build
script to generate, or lint, the YAML files as part of a
pre-commit
orpre-push
hook.