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

chore: update to latest lints #568

Merged
merged 1 commit into from
Sep 20, 2023
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
2 changes: 1 addition & 1 deletion _test/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies:
http: any

dev_dependencies:
dart_flutter_team_lints: ^1.0.0
dart_flutter_team_lints: ^2.0.0

dependency_overrides:
_discoveryapis_commons:
Expand Down
5 changes: 0 additions & 5 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,13 @@ linter:
- avoid_unused_constructor_parameters
- avoid_void_async
- cancel_subscriptions
- comment_references
- join_return_with_assignment
- literal_only_boolean_expressions
- missing_whitespace_between_adjacent_strings
- no_runtimeType_toString
- package_api_docs
- prefer_const_constructors
- prefer_const_declarations
- prefer_expression_function_bodies
- prefer_final_locals
- prefer_relative_imports
- test_types_in_equals
- unnecessary_breaks
- use_string_buffers
- use_super_parameters
2 changes: 1 addition & 1 deletion config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ packages:
example: resources/googleapis/examples/main.dart
mono_pkg: resources/googleapis/_mono_pkg.yaml
extraDevDependencies:
dart_flutter_team_lints: ^1.0.0
dart_flutter_team_lints: ^2.0.0
googleapis_auth: ^1.0.0
apis:
- abusiveexperiencereport:v1 # https://developers.google.com/abusive-experience-report/
Expand Down
12 changes: 6 additions & 6 deletions discoveryapis_commons/lib/src/resumable_media_uploader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class ResumableMediaUploader {

await validateResponse(response);

await response.stream.drain();
await response.stream.drain<void>();

final uploadUri = response.headers['location'];
if (response.statusCode != 200 || uploadUri == null) {
Expand All @@ -168,7 +168,7 @@ class ResumableMediaUploader {
/// drained.
Future _uploadChunkDrained(Uri uri, ResumableChunk chunk) async {
final response = await _uploadChunkResumable(uri, chunk);
await response.stream.drain();
await response.stream.drain<void>();
}

/// Does repeated attempts to upload [chunk].
Expand All @@ -183,7 +183,7 @@ class ResumableMediaUploader {
final status = response.statusCode;
if (attemptsLeft > 0 &&
(status == 500 || (502 <= status && status < 504))) {
await response.stream.drain();
await response.stream.drain<void>();
// Delay the next attempt. Default backoff function is exponential
final failedAttempts = _options.numberOfAttempts - attemptsLeft;
final duration = _options.backoffFunction(failedAttempts);
Expand All @@ -194,17 +194,17 @@ class ResumableMediaUploader {
'$status. Maximum number of retries reached.');
}

await Future.delayed(duration);
await Future<void>.delayed(duration);
return tryUpload(attemptsLeft - 1);
} else if (!lastChunk && status != 308) {
await response.stream.drain();
await response.stream.drain<void>();
throw client_requests.DetailedApiRequestError(
status,
'Resumable upload: Uploading a chunk resulted in status '
'$status instead of 308.',
);
} else if (lastChunk && status != 201 && status != 200) {
await response.stream.drain();
await response.stream.drain<void>();
throw client_requests.DetailedApiRequestError(
status,
'Resumable upload: Uploading a chunk resulted in status '
Expand Down
2 changes: 1 addition & 1 deletion discoveryapis_commons/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ dependencies:
meta: ^1.3.0

dev_dependencies:
dart_flutter_team_lints: ^1.0.0
dart_flutter_team_lints: ^2.0.0
test: ^1.16.0
11 changes: 7 additions & 4 deletions discoveryapis_commons/test/discoveryapis_commons_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,8 @@ void main() {
expect(media.length, equals(_data256.length));

expect(
await media.stream.fold([], (List b, d) => b..addAll(d)),
await media.stream
.fold<List<int>>([], (List<int> b, d) => b..addAll(d)),
equals(_data256),
);
});
Expand Down Expand Up @@ -365,7 +366,8 @@ void main() {
expect(media.length, equals(data64.length));

expect(
await media.stream.fold([], (List b, d) => b..addAll(d)),
await media.stream
.fold<List<int>>(<int>[], (List<int> b, d) => b..addAll(d)),
equals(data64),
);
});
Expand Down Expand Up @@ -394,7 +396,8 @@ void main() {
expect(media.contentType, equals('foobar'));
expect(media.length, equals(_data256.length));

final d = await media.stream.fold([], (List b, d) => b..addAll(d));
final d = await media.stream
.fold<List<int>>([], (List<int> b, d) => b..addAll(d));
expect(d, equals(_data256));
});
});
Expand Down Expand Up @@ -529,7 +532,7 @@ void main() {
{
'url': 'http://example.com/xyz?uploadType=resumable&alt=json',
'method': 'POST',
'data': [],
'data': <int>[],
'headers': {
'content-length': '0',
'content-type': 'application/json; charset=utf-8',
Expand Down
4 changes: 3 additions & 1 deletion discoveryapis_generator/lib/src/apis_files_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,9 @@ class ApisFilesGenerator {
if (key == 'dependencies') {
// patch up dependencies.
var localValue = pubspec![key] as Map?;
localValue = localValue != null ? value = Map.from(localValue) : {};
localValue = localValue != null
? value = Map<dynamic, dynamic>.from(localValue)
: {};
localValue.addAll(_computeNewDependencies(localValue));
value = localValue;
} else {
Expand Down
2 changes: 1 addition & 1 deletion discoveryapis_generator/lib/src/dart_api_test_library.dart
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ $declaration buildUnnamed$_id() =>
}
}

class UnnamedArrayTest<T> extends UnnamedSchemaTest<UnnamedArrayType> {
class UnnamedArrayTest extends UnnamedSchemaTest<UnnamedArrayType> {
UnnamedArrayTest(super.apiTestLibrary, super.schema);

@override
Expand Down
2 changes: 1 addition & 1 deletion discoveryapis_generator/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies:
yaml: ^3.0.0

dev_dependencies:
dart_flutter_team_lints: ^1.0.0
dart_flutter_team_lints: ^2.0.0
test: ^1.0.0

executables:
Expand Down
3 changes: 2 additions & 1 deletion discoveryapis_generator/test/dart_schemas_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ void main() {
expect(db.dartClassTypes, hasLength(0));
});

withParsedDB({'empty-schemas': {}}, (DartSchemaTypeDB db) {
withParsedDB({'empty-schemas': <dynamic, dynamic>{}},
(DartSchemaTypeDB db) {
expect(db.dartTypes, hasLength(0));
expect(db.namedSchemaTypes, hasLength(0));
expect(db.dartClassTypes, hasLength(0));
Expand Down
2 changes: 1 addition & 1 deletion generated/googleapis/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ dependencies:
_discoveryapis_commons: ^1.0.0
http: ">=0.13.0 <2.0.0"
dev_dependencies:
dart_flutter_team_lints: ^1.0.0
dart_flutter_team_lints: ^2.0.0
googleapis_auth: ^1.0.0
test: ^1.16.0
2 changes: 1 addition & 1 deletion generator/lib/googleapis_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ $stack
' Trying again in $tryAgainLag second(s) – '
'${item.discoveryRestUrl}',
);
await Future.delayed(Duration(seconds: tryAgainLag));
await Future<void>.delayed(Duration(seconds: tryAgainLag));
continue;
}
}
Expand Down
2 changes: 1 addition & 1 deletion generator/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies:
yaml: '>=2.1.0 <4.0.0'

dev_dependencies:
dart_flutter_team_lints: ^1.0.0
dart_flutter_team_lints: ^2.0.0

dependency_overrides:
_discoveryapis_commons:
Expand Down
2 changes: 1 addition & 1 deletion googleapis_auth/lib/src/auth_http_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class AuthenticatedClient extends DelegatingClient implements AuthClient {
final response = await baseClient.send(modifiedRequest);
final wwwAuthenticate = response.headers['www-authenticate'];
if (wwwAuthenticate != null) {
await response.stream.drain();
await response.stream.drain<void>();
throw AccessDeniedException(
'Access was denied '
'(www-authenticate header was: $wwwAuthenticate).',
Expand Down
2 changes: 1 addition & 1 deletion googleapis_auth/lib/src/browser_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class _ScriptLoader {
return _pendingInitialization!;
}

final completer = Completer();
final completer = Completer<void>();

final timeout = Timer(callbackTimeout, () {
_pendingInitialization = null;
Expand Down
2 changes: 1 addition & 1 deletion googleapis_auth/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dev_dependencies:
build_runner: ^2.0.0
build_test: ^2.0.0
build_web_compilers: '>=3.2.7 <5.0.0'
dart_flutter_team_lints: ^1.0.0
dart_flutter_team_lints: ^2.0.0
test: ^1.16.0

false_secrets:
Expand Down
2 changes: 1 addition & 1 deletion googleapis_auth/test/oauth2_flows/auth_code_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ void main() {
try {
final request = await ioClient.getUrl(authCodeCall);
final response = await request.close();
await response.drain();
await response.drain<void>();
} finally {
closeMe();
}
Expand Down
2 changes: 1 addition & 1 deletion googleapis_auth/test/util_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void main() {
});

test('not a map', () async {
final body = [];
final body = <void>[];
final client = mockClient(
(request) async =>
Response(jsonEncode(body), 200, headers: jsonContentType),
Expand Down
2 changes: 1 addition & 1 deletion resources/googleapis/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ dependencies:
dependency_overrides:
_discoveryapis_commons:
path: ../../discoveryapis_commons
dart_flutter_team_lints: ^1.0.0
dart_flutter_team_lints: ^2.0.0
2 changes: 1 addition & 1 deletion test_integration/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies:
dev_dependencies:
build_runner: ^2.0.0
build_web_compilers: '>=3.0.0 <5.0.0'
dart_flutter_team_lints: ^1.0.0
dart_flutter_team_lints: ^2.0.0
test: ^1.16.0

dependency_overrides:
Expand Down
Loading