Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use and fix core lints across workspace #8331

Merged
merged 3 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 2 additions & 23 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include: package:lints/core.yaml

# https://dart.dev/tools/analysis
analyzer:
exclude:
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
3 changes: 1 addition & 2 deletions app/lib/admin/actions/actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion app/lib/shared/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Future<T> withTempDirectory<T>(Future<T> 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);
});
});
}
Expand Down
7 changes: 3 additions & 4 deletions app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions pkg/_pub_shared/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion pkg/api_builder/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/code_coverage/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion pkg/fake_gcloud/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ^1.0.7

dev_dependencies:
coverage: any # test already depends on it
Expand Down
5 changes: 3 additions & 2 deletions pkg/pub_package_reader/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/pub_worker/lib/src/testing/server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
5 changes: 4 additions & 1 deletion pkg/pub_worker/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions pkg/web_css/test/expression_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ packages:
source: hosted
version: "7.0.0"
lints:
dependency: transitive
dependency: "direct dev"
description:
name: lints
sha256: "3315600f3fb3b135be672bf4a178c55f274bebe368325ae18462c89ac1e3b413"
Expand Down
2 changes: 2 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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