Skip to content

Commit

Permalink
Update to latest lints (#1361)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevmoo authored Oct 26, 2023
1 parent e2c8bad commit f8e57b5
Show file tree
Hide file tree
Showing 67 changed files with 221 additions and 198 deletions.
2 changes: 1 addition & 1 deletion _test_yaml/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dev_dependencies:
build_runner: ^2.0.0
build_verify: ^3.0.0
checked_yaml: any
dart_flutter_team_lints: ^1.0.0
dart_flutter_team_lints: ^2.0.0
json_annotation: ^4.7.0
json_serializable: any
path: ^1.8.2
Expand Down
6 changes: 0 additions & 6 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,17 @@ linter:
- avoid_void_async
- cancel_subscriptions
- cascade_invocations
- comment_references
- invalid_case_patterns
- 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
- sort_child_properties_last
- test_types_in_equals
- type_literal_in_constant_pattern
- unnecessary_breaks
- unsafe_html
- use_full_hex_values_for_flutter_colors
- use_string_buffers
- use_super_parameters
2 changes: 1 addition & 1 deletion checked_yaml/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies:
dev_dependencies:
build_runner: ^2.0.0
build_verify: ^3.0.0
dart_flutter_team_lints: ^1.0.0
dart_flutter_team_lints: ^2.0.0
json_serializable: ^6.0.0
path: ^1.0.0
test: ^1.16.0
Expand Down
2 changes: 1 addition & 1 deletion checked_yaml/test/example_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ line 1, column 10: Unsupported value for "name". Cannot be empty.
});
}

void _expectThrows(String yamlContent, matcher) => expect(
void _expectThrows(String yamlContent, String matcher) => expect(
() => _run(yamlContent),
throwsA(
isA<ParsedYamlException>().having(
Expand Down
2 changes: 2 additions & 0 deletions example/lib/json_converter_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// 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.

// ignore_for_file: inference_failure_on_instance_creation

import 'package:json_annotation/json_annotation.dart';

part 'json_converter_example.g.dart';
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dev_dependencies:
build_verify: ^3.0.0

# Not required to use `json_serializable`.
dart_flutter_team_lints: ^1.0.0
dart_flutter_team_lints: ^2.0.0

# REQUIRED!
json_serializable: ^6.6.0
Expand Down
4 changes: 2 additions & 2 deletions example/test/json_convert_example_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ void main() {
throwsTypeError,
);

final collection2 =
GenericCollection.fromJson(jsonDecode(encoded) as Map<String, dynamic>);
final collection2 = GenericCollection<dynamic>.fromJson(
jsonDecode(encoded) as Map<String, dynamic>);

expect(collection2.results, [
1,
Expand Down
2 changes: 1 addition & 1 deletion json_annotation/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dependencies:
meta: ^1.4.0

dev_dependencies:
dart_flutter_team_lints: ^1.0.0
dart_flutter_team_lints: ^2.0.0
# When changing JsonSerializable class.
# build_runner: ^2.0.0
# json_serializable: any
4 changes: 4 additions & 0 deletions json_serializable/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 6.7.2-wip

- Add type arguments to `Map` literals used for `Record` serialization.

## 6.7.1

- Support the latest `package:analyzer`.
Expand Down
4 changes: 4 additions & 0 deletions json_serializable/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ targets:
- lines_longer_than_80_chars
# Only for the JSON literal output file
- text_direction_code_point_in_literal
# Too much work in generated code
- inference_failure_on_function_invocation
# Need to update sourcegen_helper to generate List/Map with the right type params
- inference_failure_on_collection_literal

json_serializable:
generate_for:
Expand Down
2 changes: 1 addition & 1 deletion json_serializable/example/example.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion json_serializable/lib/src/type_helpers/record_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ $helperName(
);
}

final mapValue = '{${items.map((e) => '$e,').join()}}';
final mapValue = '<String, dynamic>{${items.map((e) => '$e,').join()}}';

return targetType.isNullableType
? ifNullOrElse(
Expand Down
4 changes: 2 additions & 2 deletions json_serializable/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: json_serializable
version: 6.7.1
version: 6.7.2-wip
description: >-
Automatically generate code for converting to and from JSON by annotating
Dart classes.
Expand Down Expand Up @@ -34,7 +34,7 @@ dev_dependencies:
path: ../shared_test
build_runner: ^2.0.0
build_verify: ^3.0.0
dart_flutter_team_lints: ^1.0.0
dart_flutter_team_lints: ^2.0.0
dart_style: ^2.0.0
logging: ^1.0.0
source_gen_test: ^1.0.0
Expand Down
2 changes: 1 addition & 1 deletion json_serializable/test/default_value/default_value.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions json_serializable/test/default_value/default_value_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const _defaultInstance = {
'fieldString': 'string',
'fieldInt': 42,
'fieldDouble': 3.14,
'fieldListEmpty': [],
'fieldSetEmpty': [],
'fieldListEmpty': <dynamic>[],
'fieldSetEmpty': <dynamic>[],
'fieldMapEmpty': <String, dynamic>{},
'fieldListSimple': [1, 2, 3],
'fieldSetSimple': ['entry1', 'entry2'],
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions json_serializable/test/generic_files/generic_class.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// 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.

// ignore_for_file: inference_failure_on_instance_creation

import 'package:collection/collection.dart';
import 'package:json_annotation/json_annotation.dart';

Expand Down
2 changes: 1 addition & 1 deletion json_serializable/test/generic_files/generic_class.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions json_serializable/test/generic_files/generic_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ void main() {
}

test('no type args', () {
// ignore: inference_failure_on_instance_creation
roundTripGenericClass(GenericClass()
..fieldDynamic = 1
..fieldInt = 2
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion json_serializable/test/integration/integration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import 'json_enum_example.dart';
import 'json_test_common.dart' show Category, Platform, StatusCode;
import 'json_test_example.dart';

Matcher _throwsArgumentError(matcher) =>
Matcher _throwsArgumentError(Object matcher) =>
throwsA(isArgumentError.having((e) => e.message, 'message', matcher));

void main() {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions json_serializable/test/kitchen_sink/kitchen_sink.dart
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ class JsonConverterTestClass implements k.JsonConverterTestClass {
}

@JsonSerializable()
// ignore: inference_failure_on_instance_creation
@GenericConverter()
class JsonConverterGeneric<S, T, U> {
S item;
Expand Down
4 changes: 2 additions & 2 deletions json_serializable/test/kitchen_sink/kitchen_sink.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ class JsonConverterTestClass implements k.JsonConverterTestClass {
@JsonSerializable(
anyMap: true,
)
// ignore: inference_failure_on_instance_creation
@GenericConverter()
class JsonConverterGeneric<S, T, U> {
S item;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ class JsonConverterTestClass implements k.JsonConverterTestClass {
checked: true,
anyMap: true,
)
// ignore: inference_failure_on_instance_creation
@GenericConverter()
class JsonConverterGeneric<S, T, U> {
S item;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ class JsonConverterTestClass implements k.JsonConverterTestClass {
@JsonSerializable(
includeIfNull: false,
)
// ignore: inference_failure_on_instance_creation
@GenericConverter()
class JsonConverterGeneric<S, T, U> {
S item;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ class JsonConverterTestClass implements k.JsonConverterTestClass {
@JsonSerializable(
explicitToJson: true,
)
// ignore: inference_failure_on_instance_creation
@GenericConverter()
class JsonConverterGeneric<S, T, U> {
S item;
Expand Down
Loading

0 comments on commit f8e57b5

Please sign in to comment.