From 1f805fe014d24e53e7d5743672863db675d014b1 Mon Sep 17 00:00:00 2001 From: Parker Lougheed Date: Sat, 23 Nov 2024 14:54:45 +0800 Subject: [PATCH 1/2] Use and fix core lints across workspace --- analysis_options.yaml | 25 ++----------------- app/lib/admin/actions/actions.dart | 3 +-- ...d-api-sync.dart => exported_api_sync.dart} | 0 app/lib/shared/utils.dart | 2 +- app/pubspec.yaml | 7 +++--- pkg/_pub_shared/pubspec.yaml | 1 + pkg/api_builder/pubspec.yaml | 3 ++- pkg/code_coverage/pubspec.yaml | 2 +- pkg/fake_gcloud/pubspec.yaml | 4 ++- pkg/pub_package_reader/pubspec.yaml | 5 ++-- pkg/pub_worker/lib/src/testing/server.dart | 2 +- pkg/pub_worker/pubspec.yaml | 5 +++- pkg/web_css/test/expression_test.dart | 8 +++--- pubspec.lock | 2 +- pubspec.yaml | 2 ++ 15 files changed, 29 insertions(+), 42 deletions(-) rename app/lib/admin/actions/{exported-api-sync.dart => exported_api_sync.dart} (100%) diff --git a/analysis_options.yaml b/analysis_options.yaml index df8f031f7a..e21445a09d 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,3 +1,5 @@ +include: package:lints/core.yaml + # https://dart.dev/tools/analysis analyzer: exclude: @@ -10,36 +12,21 @@ linter: rules: - always_declare_return_types - annotate_overrides - - avoid_empty_else - avoid_init_to_null - avoid_null_checks_in_equality_operators - - avoid_relative_lib_imports - avoid_return_types_on_setters - - avoid_shadowing_type_parameters - - avoid_types_as_parameter_names - - await_only_futures - - camel_case_extensions - - camel_case_types - cancel_subscriptions - close_sinks - - collection_methods_unrelated_type - comment_references - constant_identifier_names - control_flow_in_finally - - curly_braces_in_flow_control_structures - - dangling_library_doc_comments - directives_ordering - - empty_catches - empty_constructor_bodies - empty_statements - - hash_and_equals - implementation_imports - - library_annotations - library_names - library_prefixes - literal_only_boolean_expressions - - no_duplicate_case_values - - non_constant_identifier_names - null_closures #- omit_local_variable_types - one_member_abstracts @@ -55,15 +42,10 @@ linter: - prefer_final_in_for_each - prefer_final_locals - prefer_for_elements_to_map_fromIterable - - prefer_generic_function_type_aliases - prefer_if_null_operators - - prefer_is_empty - - prefer_is_not_empty - - prefer_iterable_whereType - prefer_null_aware_operators - prefer_single_quotes - prefer_spread_collections - - prefer_typing_uninitialized_variables - recursive_getters - slash_for_doc_comments - test_types_in_equals @@ -79,8 +61,5 @@ linter: - unnecessary_new - unnecessary_null_in_if_null_operators - unnecessary_this - - unrelated_type_equality_checks - use_function_type_syntax_for_parameters - use_rethrow_when_possible - - use_string_in_part_of_directives - - valid_regexps diff --git a/app/lib/admin/actions/actions.dart b/app/lib/admin/actions/actions.dart index 1d6b3be488..5fd6be94f2 100644 --- a/app/lib/admin/actions/actions.dart +++ b/app/lib/admin/actions/actions.dart @@ -2,12 +2,11 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'package:pub_dev/admin/actions/exported-api-sync.dart'; - import '../../shared/exceptions.dart'; import 'download_counts_backfill.dart'; import 'download_counts_delete.dart'; import 'email_send.dart'; +import 'exported_api_sync.dart'; import 'merge_moderated_package_into_existing.dart'; import 'moderate_package.dart'; import 'moderate_package_versions.dart'; diff --git a/app/lib/admin/actions/exported-api-sync.dart b/app/lib/admin/actions/exported_api_sync.dart similarity index 100% rename from app/lib/admin/actions/exported-api-sync.dart rename to app/lib/admin/actions/exported_api_sync.dart diff --git a/app/lib/shared/utils.dart b/app/lib/shared/utils.dart index e8ec044341..0e5ec1f9e6 100644 --- a/app/lib/shared/utils.dart +++ b/app/lib/shared/utils.dart @@ -40,7 +40,7 @@ Future withTempDirectory(Future Function(Directory dir) func, {String prefix = 'dart-tempdir'}) { return Directory.systemTemp.createTemp(prefix).then((Directory dir) { return func(dir).whenComplete(() { - return dir.delete(recursive: true); + dir.delete(recursive: true); }); }); } diff --git a/app/pubspec.yaml b/app/pubspec.yaml index affa611945..19258f2042 100644 --- a/app/pubspec.yaml +++ b/app/pubspec.yaml @@ -11,7 +11,7 @@ dependencies: basics: ^0.10.0 chunked_stream: ^1.1.0 clock: ^1.1.0 - collection: ^1.15.0-nullsafety.4 + collection: ^1.18.0 convert: '^3.0.0' crypto: '^3.0.0' fake_async: ^1.2.0 @@ -26,11 +26,10 @@ dependencies: indexed_blob: intl: '^0.19.0' json_annotation: '^4.3.0' - lints: ^5.0.0 logging: '>=0.9.3 <2.0.0' markdown: ^7.2.2 meta: ^1.1.2 - mime: '>=0.9.3 <2.0.0' + mime: ^1.0.6 neat_cache: ^2.0.4 neat_periodic_task: ^2.0.0 path: '^1.8.0' @@ -46,7 +45,7 @@ dependencies: stack_trace: ^1.10.0 stream_transform: ^2.0.0 watcher: ^1.0.0 - yaml: '^3.0.0' + yaml: ^3.1.0 # pana version to be pinned pana: '0.22.15' # 3rd-party packages with pinned versions diff --git a/pkg/_pub_shared/pubspec.yaml b/pkg/_pub_shared/pubspec.yaml index 7237f3157e..1ace0b2a88 100644 --- a/pkg/_pub_shared/pubspec.yaml +++ b/pkg/_pub_shared/pubspec.yaml @@ -8,6 +8,7 @@ resolution: workspace dependencies: clock: ^1.1.0 html: ^0.15.0 + http: ^1.0.0 json_annotation: ^4.3.0 logging: ^1.2.0 meta: ^1.3.0 diff --git a/pkg/api_builder/pubspec.yaml b/pkg/api_builder/pubspec.yaml index f07cd070a2..a480314c03 100644 --- a/pkg/api_builder/pubspec.yaml +++ b/pkg/api_builder/pubspec.yaml @@ -7,10 +7,11 @@ environment: resolution: workspace dependencies: + analyzer: ^6.0.0 build: ^2.0.0 build_config: ^1.0.0 + collection: ^1.18.0 source_gen: ^1.0.0 - analyzer: ^6.0.0 shelf_router: ^1.0.0 code_builder: ^4.0.0 shelf: ^1.0.0 diff --git a/pkg/code_coverage/pubspec.yaml b/pkg/code_coverage/pubspec.yaml index 84a3ce9e50..aeef3a0afb 100644 --- a/pkg/code_coverage/pubspec.yaml +++ b/pkg/code_coverage/pubspec.yaml @@ -7,7 +7,7 @@ resolution: workspace dependencies: args: ^2.0.0 - collection: ^1.17.2 + collection: ^1.18.0 coverage: ^1.3.2 lcov_dart: ^7.0.0 path: ^1.8.0 diff --git a/pkg/fake_gcloud/pubspec.yaml b/pkg/fake_gcloud/pubspec.yaml index 3a58a2413f..c47a96cbd5 100644 --- a/pkg/fake_gcloud/pubspec.yaml +++ b/pkg/fake_gcloud/pubspec.yaml @@ -7,9 +7,11 @@ environment: resolution: workspace dependencies: + clock: ^1.1.0 + crypto: ^3.0.0 gcloud: ^0.8.18 logging: '>=0.11.3 <2.0.0' - clock: ^1.1.0 + _discoveryapis_commons: dev_dependencies: coverage: any # test already depends on it diff --git a/pkg/pub_package_reader/pubspec.yaml b/pkg/pub_package_reader/pubspec.yaml index e90f1adc16..4f9fadf81e 100644 --- a/pkg/pub_package_reader/pubspec.yaml +++ b/pkg/pub_package_reader/pubspec.yaml @@ -9,12 +9,13 @@ resolution: workspace dependencies: clock: ^1.1.0 logging: '>=0.11.3+1 <2.0.0' + path: ^1.8.0 pub_semver: ^2.0.0 pubspec_parse: '>=0.1.4 <2.0.0' - yaml: ^3.0.0 + yaml: ^3.1.0 yaml_edit: ^2.0.1 tar: ^2.0.0 - collection: ^1.15.0-nullsafety.4 + collection: ^1.18.0 dev_dependencies: coverage: any # test already depends on it diff --git a/pkg/pub_worker/lib/src/testing/server.dart b/pkg/pub_worker/lib/src/testing/server.dart index 8efee3018a..1a0dffe4b4 100644 --- a/pkg/pub_worker/lib/src/testing/server.dart +++ b/pkg/pub_worker/lib/src/testing/server.dart @@ -58,7 +58,7 @@ class PubWorkerTestServer { } started = true; - final server = await io.serve(_router, 'localhost', 0); + final server = await io.serve(_router.call, 'localhost', 0); _baseUrl = Uri.parse('http://localhost:${server.port}'); _server = server; } diff --git a/pkg/pub_worker/pubspec.yaml b/pkg/pub_worker/pubspec.yaml index adae9c8292..c50e1fd580 100644 --- a/pkg/pub_worker/pubspec.yaml +++ b/pkg/pub_worker/pubspec.yaml @@ -11,6 +11,7 @@ dependencies: json_annotation: ^4.3.0 jsontool: ^2.0.0 pana: ^0.22.15 + path: ^1.8.0 lints: ^5.0.0 # required for pana meta: ^1.7.0 api_builder: @@ -26,12 +27,14 @@ dependencies: shelf: ^1.2.0 shelf_router: ^1.1.2 async: ^2.10.0 - collection: ^1.17.0 + collection: ^1.18.0 + mime: ^1.0.6 pub_semver: ^2.1.4 sanitize_html: ^2.1.0 stream_transform: ^2.0.0 stack_trace: ^1.11.1 tar: ^2.0.0 + yaml: ^3.1.0 dev_dependencies: test: ^1.19.3 diff --git a/pkg/web_css/test/expression_test.dart b/pkg/web_css/test/expression_test.dart index 3cfe8d8454..9d529d7a85 100644 --- a/pkg/web_css/test/expression_test.dart +++ b/pkg/web_css/test/expression_test.dart @@ -137,24 +137,24 @@ class _Visitor extends Visitor { void visitSelector(Selector node) { selectors .addAll(node.simpleSelectorSequences.map((e) => e.simpleSelector.name)); - return super.visitSelector(node); + super.visitSelector(node); } @override void visitClassSelector(ClassSelector node) { classes.add(node.name); - return super.visitClassSelector(node); + super.visitClassSelector(node); } @override void visitIdSelector(IdSelector node) { ids.add(node.name); - return super.visitIdSelector(node); + super.visitIdSelector(node); } @override void visitElementSelector(ElementSelector node) { elements.add(node.name); - return super.visitElementSelector(node); + super.visitElementSelector(node); } } diff --git a/pubspec.lock b/pubspec.lock index 41a6bff141..42b81d2e63 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -479,7 +479,7 @@ packages: source: hosted version: "7.0.0" lints: - dependency: transitive + dependency: "direct dev" description: name: lints sha256: "3315600f3fb3b135be672bf4a178c55f274bebe368325ae18462c89ac1e3b413" diff --git a/pubspec.yaml b/pubspec.yaml index 854cecc256..a491c5401f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,5 +15,7 @@ workspace: - pkg/fake_gcloud - pkg/indexed_blob - pkg/pub_package_reader + dev_dependencies: + lints: ^5.0.0 mono_repo: ^6.6.1 From d8bd9216322e4e782936251e0164639c80d1e9f9 Mon Sep 17 00:00:00 2001 From: Parker Lougheed Date: Tue, 26 Nov 2024 13:03:29 +0530 Subject: [PATCH 2/2] Add missing constraint --- pkg/fake_gcloud/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/fake_gcloud/pubspec.yaml b/pkg/fake_gcloud/pubspec.yaml index c47a96cbd5..845a829f22 100644 --- a/pkg/fake_gcloud/pubspec.yaml +++ b/pkg/fake_gcloud/pubspec.yaml @@ -11,7 +11,7 @@ dependencies: crypto: ^3.0.0 gcloud: ^0.8.18 logging: '>=0.11.3 <2.0.0' - _discoveryapis_commons: + _discoveryapis_commons: ^1.0.7 dev_dependencies: coverage: any # test already depends on it