diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index f62eaa63..a31231bc 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -39,16 +39,16 @@ jobs: - name: mono_repo self validate run: dart pub global run mono_repo generate --validate job_002: - name: "analyze_and_format; Dart 2.19.0; PKGS: pkgs/corpus, pkgs/dart_flutter_team_lints, pkgs/repo_manage; `dart analyze --fatal-infos .`" + name: "analyze_and_format; Dart 2.19.0; PKGS: pkgs/corpus, pkgs/repo_manage; `dart analyze --fatal-infos .`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:pkgs/corpus-pkgs/dart_flutter_team_lints-pkgs/repo_manage;commands:analyze" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:pkgs/corpus-pkgs/repo_manage;commands:analyze" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:pkgs/corpus-pkgs/dart_flutter_team_lints-pkgs/repo_manage + os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:pkgs/corpus-pkgs/repo_manage os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0 os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest @@ -68,15 +68,6 @@ jobs: run: dart analyze --fatal-infos . if: "always() && steps.pkgs_corpus_pub_upgrade.conclusion == 'success'" working-directory: pkgs/corpus - - id: pkgs_dart_flutter_team_lints_pub_upgrade - name: pkgs/dart_flutter_team_lints; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: pkgs/dart_flutter_team_lints - - name: "pkgs/dart_flutter_team_lints; dart analyze --fatal-infos ." - run: dart analyze --fatal-infos . - if: "always() && steps.pkgs_dart_flutter_team_lints_pub_upgrade.conclusion == 'success'" - working-directory: pkgs/dart_flutter_team_lints - id: pkgs_repo_manage_pub_upgrade name: pkgs/repo_manage; dart pub upgrade run: dart pub upgrade @@ -89,16 +80,16 @@ jobs: needs: - job_001 job_003: - name: "analyze_and_format; Dart 3.0.0; PKG: pkgs/firehose; `dart analyze --fatal-infos .`" + name: "analyze_and_format; Dart 3.0.0; PKGS: pkgs/dart_flutter_team_lints, pkgs/firehose; `dart analyze --fatal-infos .`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.0.0;packages:pkgs/firehose;commands:analyze" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.0.0;packages:pkgs/dart_flutter_team_lints-pkgs/firehose;commands:analyze" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.0.0;packages:pkgs/firehose + os:ubuntu-latest;pub-cache-hosted;sdk:3.0.0;packages:pkgs/dart_flutter_team_lints-pkgs/firehose os:ubuntu-latest;pub-cache-hosted;sdk:3.0.0 os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest @@ -109,6 +100,15 @@ jobs: - id: checkout name: Checkout repository uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 + - id: pkgs_dart_flutter_team_lints_pub_upgrade + name: pkgs/dart_flutter_team_lints; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/dart_flutter_team_lints + - name: "pkgs/dart_flutter_team_lints; dart analyze --fatal-infos ." + run: dart analyze --fatal-infos . + if: "always() && steps.pkgs_dart_flutter_team_lints_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/dart_flutter_team_lints - id: pkgs_firehose_pub_upgrade name: pkgs/firehose; dart pub upgrade run: dart pub upgrade @@ -275,23 +275,23 @@ jobs: - job_004 - job_005 job_007: - name: "unit_test; Dart 2.19.0; PKG: pkgs/dart_flutter_team_lints; `dart test`" + name: "unit_test; Dart 3.0.0; PKG: pkgs/dart_flutter_team_lints; `dart test`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:pkgs/dart_flutter_team_lints;commands:test_1" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.0.0;packages:pkgs/dart_flutter_team_lints;commands:test_1" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:pkgs/dart_flutter_team_lints - os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0 + os:ubuntu-latest;pub-cache-hosted;sdk:3.0.0;packages:pkgs/dart_flutter_team_lints + os:ubuntu-latest;pub-cache-hosted;sdk:3.0.0 os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: - sdk: "2.19.0" + sdk: "3.0.0" - id: checkout name: Checkout repository uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 diff --git a/pkgs/blast_repo/lib/src/top_level.dart b/pkgs/blast_repo/lib/src/top_level.dart index cc037a8d..40ac0af3 100644 --- a/pkgs/blast_repo/lib/src/top_level.dart +++ b/pkgs/blast_repo/lib/src/top_level.dart @@ -6,13 +6,13 @@ import 'dart:async'; import 'dart:convert'; import 'dart:io'; -import 'package:blast_repo/src/tweaks/mono_repo_tweak.dart'; import 'package:git/git.dart'; import 'repo_tweak.dart'; import 'tweaks/auto_publish_tweak.dart'; import 'tweaks/dependabot_tweak.dart'; import 'tweaks/github_action_tweak.dart'; +import 'tweaks/mono_repo_tweak.dart'; import 'tweaks/no_reponse_tweak.dart'; import 'utils.dart'; diff --git a/pkgs/corpus/bin/deps.dart b/pkgs/corpus/bin/deps.dart index c5ef3f7f..f120a2a9 100644 --- a/pkgs/corpus/bin/deps.dart +++ b/pkgs/corpus/bin/deps.dart @@ -57,7 +57,7 @@ void main(List args) async { var targetPackage = await pub.getPackageInfo(packageName); - final dateOneYearAgo = DateTime.now().subtract(Duration(days: 365)); + final dateOneYearAgo = DateTime.now().subtract(const Duration(days: 365)); var limit = packageLimit == null ? null : int.parse(packageLimit); diff --git a/pkgs/corpus/lib/api.dart b/pkgs/corpus/lib/api.dart index 0749e371..258d49fd 100644 --- a/pkgs/corpus/lib/api.dart +++ b/pkgs/corpus/lib/api.dart @@ -49,7 +49,7 @@ class ApiUsage { 'packages': fromPackages.toJson(), 'libraries': fromLibraries.toJson(), }; - file.writeAsStringSync(JsonEncoder.withIndent(' ').convert(json)); + file.writeAsStringSync(const JsonEncoder.withIndent(' ').convert(json)); } /// Returns whether we found any references to the target package. @@ -70,8 +70,8 @@ class ApiUsage { } static ApiUsage fromFile(PackageInfo packageInfo, File file) { - var json = - JsonDecoder().convert(file.readAsStringSync()) as Map; + var json = const JsonDecoder().convert(file.readAsStringSync()) + as Map; return ApiUsage( packageInfo, References.fromJson(json['packages'] as Map), diff --git a/pkgs/corpus/lib/report.dart b/pkgs/corpus/lib/report.dart index 86bd72d9..1a5c192b 100644 --- a/pkgs/corpus/lib/report.dart +++ b/pkgs/corpus/lib/report.dart @@ -4,9 +4,8 @@ import 'dart:io'; -import 'package:corpus/pub.dart'; - import 'api.dart'; +import 'pub.dart'; import 'utils.dart'; abstract class ReportTarget { diff --git a/pkgs/corpus/test/api_test.dart b/pkgs/corpus/test/api_test.dart index 65556459..1d2d8360 100644 --- a/pkgs/corpus/test/api_test.dart +++ b/pkgs/corpus/test/api_test.dart @@ -18,10 +18,10 @@ void main() { setUp(() { var json = - JsonDecoder().convert(_sampleUsageJson) as Map; + const JsonDecoder().convert(_sampleUsageJson) as Map; sampleUsage = ApiUsage( - PackageInfo.from( - JsonDecoder().convert(_packageInfoJson) as Map), + PackageInfo.from(const JsonDecoder().convert(_packageInfoJson) + as Map), References.fromJson(json['packages'] as Map), References.fromJson(json['libraries'] as Map), ); @@ -42,8 +42,8 @@ void main() { sampleUsage.toFile(tempFile); var result = ApiUsage.fromFile( - PackageInfo.from( - JsonDecoder().convert(_packageInfoJson) as Map), + PackageInfo.from(const JsonDecoder().convert(_packageInfoJson) + as Map), tempFile, ); diff --git a/pkgs/corpus/test/data/dart_library_references.dart b/pkgs/corpus/test/data/dart_library_references.dart index 44f94a0f..44c82cc5 100644 --- a/pkgs/corpus/test/data/dart_library_references.dart +++ b/pkgs/corpus/test/data/dart_library_references.dart @@ -11,6 +11,6 @@ void main() { map['three'] = 3; print(map); - var local = Queue(); - Queue.castFrom(local); + var local = Queue(); + Queue.castFrom(local); } diff --git a/pkgs/dart_flutter_team_lints/CHANGELOG.md b/pkgs/dart_flutter_team_lints/CHANGELOG.md index 72584595..9a01b784 100644 --- a/pkgs/dart_flutter_team_lints/CHANGELOG.md +++ b/pkgs/dart_flutter_team_lints/CHANGELOG.md @@ -1,3 +1,13 @@ +## 2.0.0 + +- Enable `strict-inference`. +- Added `comment_references`. +- Added `conditional_uri_does_not_exist`. +- Added `prefer_const_constructors`. +- Added `prefer_relative_imports`. +- Added `test_types_in_equals`. +- Added `use_super_parameters`. + ## 1.0.0 - Added `collection_methods_unrelated_type`. diff --git a/pkgs/dart_flutter_team_lints/lib/analysis_options.yaml b/pkgs/dart_flutter_team_lints/lib/analysis_options.yaml index 11659ff3..20d006a9 100644 --- a/pkgs/dart_flutter_team_lints/lib/analysis_options.yaml +++ b/pkgs/dart_flutter_team_lints/lib/analysis_options.yaml @@ -18,6 +18,7 @@ include: package:lints/recommended.yaml analyzer: language: strict-casts: true + strict-inference: true linter: rules: @@ -35,8 +36,10 @@ linter: - lines_longer_than_80_chars - omit_local_variable_types - prefer_asserts_in_initializer_lists + - prefer_const_constructors - prefer_generic_function_type_aliases - prefer_is_empty + - prefer_relative_imports - prefer_single_quotes - prefer_typing_uninitialized_variables - sort_pub_dependencies @@ -47,6 +50,7 @@ linter: - unnecessary_statements - use_is_even_rather_than_modulo - use_string_in_part_of_directives + - use_super_parameters # correctness - always_declare_return_types @@ -54,11 +58,14 @@ linter: - avoid_dynamic_calls - await_only_futures - collection_methods_unrelated_type + - comment_references + - conditional_uri_does_not_exist - dangling_library_doc_comments - hash_and_equals - implicit_call_tearoffs - no_duplicate_case_values - only_throw_errors + - test_types_in_equals - throw_in_finally - type_annotate_public_apis - unawaited_futures diff --git a/pkgs/dart_flutter_team_lints/pubspec.yaml b/pkgs/dart_flutter_team_lints/pubspec.yaml index dfba5abd..886263ea 100644 --- a/pkgs/dart_flutter_team_lints/pubspec.yaml +++ b/pkgs/dart_flutter_team_lints/pubspec.yaml @@ -1,10 +1,10 @@ name: dart_flutter_team_lints description: An analysis rule set used by the Dart and Flutter teams. -version: 1.0.0 +version: 2.0.0 repository: https://github.com/dart-lang/ecosystem/tree/main/pkgs/dart_flutter_team_lints environment: - sdk: '>=2.19.0 <3.0.0' + sdk: ^3.0.0 dependencies: lints: ^2.0.0 diff --git a/pkgs/firehose/lib/firehose.dart b/pkgs/firehose/lib/firehose.dart index 8011dcc4..4091a645 100644 --- a/pkgs/firehose/lib/firehose.dart +++ b/pkgs/firehose/lib/firehose.dart @@ -7,10 +7,9 @@ import 'dart:io'; import 'dart:math'; -import 'package:firehose/src/repo.dart'; - import 'src/github.dart'; import 'src/pub.dart'; +import 'src/repo.dart'; import 'src/utils.dart'; const String _botSuffix = '[bot]'; diff --git a/pkgs/firehose/lib/src/github.dart b/pkgs/firehose/lib/src/github.dart index c0400d91..6e57f909 100644 --- a/pkgs/firehose/lib/src/github.dart +++ b/pkgs/firehose/lib/src/github.dart @@ -6,10 +6,11 @@ import 'dart:convert'; import 'dart:io'; -import 'package:firehose/src/repo.dart'; import 'package:http/http.dart' as http; import 'package:path/path.dart' as path; +import 'repo.dart'; + // TODO:(devoncarew): Consider replacing some of this class with package:github. class Github { diff --git a/pkgs/firehose/lib/src/health/health.dart b/pkgs/firehose/lib/src/health/health.dart index a1e511ab..dcd24372 100644 --- a/pkgs/firehose/lib/src/health/health.dart +++ b/pkgs/firehose/lib/src/health/health.dart @@ -8,8 +8,8 @@ import 'dart:io'; import 'dart:math'; import 'package:collection/collection.dart'; -import 'package:firehose/firehose.dart'; +import '../../firehose.dart'; import '../github.dart'; import '../utils.dart'; import 'changelog.dart'; diff --git a/pkgs/firehose/lib/src/repo.dart b/pkgs/firehose/lib/src/repo.dart index 511c06a9..8336a5a5 100644 --- a/pkgs/firehose/lib/src/repo.dart +++ b/pkgs/firehose/lib/src/repo.dart @@ -4,11 +4,11 @@ import 'dart:io'; -import 'package:firehose/src/changelog.dart'; import 'package:path/path.dart' as path; import 'package:pubspec_parse/pubspec_parse.dart'; import 'package:yaml/yaml.dart' as yaml; +import 'changelog.dart'; import 'github.dart'; class Repository { diff --git a/pkgs/repo_manage/lib/issue_transfer.dart b/pkgs/repo_manage/lib/issue_transfer.dart index 130c9d3e..2d0bef8d 100644 --- a/pkgs/repo_manage/lib/issue_transfer.dart +++ b/pkgs/repo_manage/lib/issue_transfer.dart @@ -199,7 +199,7 @@ class TransferIssuesCommand extends ReportCommand { } print('Waiting a bit to allow Github to catch up...'); - await Future.delayed(Duration(seconds: 5)); + await Future.delayed(const Duration(seconds: 5)); } } diff --git a/pkgs/repo_manage/lib/weekly.dart b/pkgs/repo_manage/lib/weekly.dart index 3500d030..cc980242 100644 --- a/pkgs/repo_manage/lib/weekly.dart +++ b/pkgs/repo_manage/lib/weekly.dart @@ -59,10 +59,10 @@ class WeeklyCommand extends ReportCommand { final now = DateTime.now(); final currentDay = now.weekday; final thisWeek = now.subtract(Duration(days: currentDay - 1)); - firstReportingDay = thisWeek.subtract(Duration(days: 7)); + firstReportingDay = thisWeek.subtract(const Duration(days: 7)); } - lastReportingDay = firstReportingDay.add(Duration(days: 6)); + lastReportingDay = firstReportingDay.add(const Duration(days: 6)); } var repos = noteableRepos.map(RepositorySlug.full).toList();