Skip to content

Commit 071eb84

Browse files
authored
Add missing trailing commas (#671)
These were not surfaced in the stable Dart SDK, but they start getting reported in the dev release. Apply fixes with `dart fix`.
1 parent 70e46c0 commit 071eb84

8 files changed

+45
-45
lines changed

source_gen/lib/builder.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import 'src/utils.dart';
2222
const _outputExtensions = '.g.dart';
2323
const _partFiles = '.g.part';
2424
const _defaultExtensions = {
25-
'.dart': [_outputExtensions]
25+
'.dart': [_outputExtensions],
2626
};
2727

2828
Builder combiningBuilder([BuilderOptions options = BuilderOptions.empty]) {

source_gen/lib/src/builder.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class _Builder extends Builder {
5858
'.dart': [
5959
generatedExtension,
6060
...additionalOutputExtensions,
61-
]
61+
],
6262
}),
6363
formatOutput = formatOutput ?? _formatter.format,
6464
_header = (header ?? defaultFileHeader).trim() {

source_gen/test/builder_test.dart

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ void main() {
6666
generateFor: {'$_pkgName|lib/test_lib.dart'},
6767
outputs: {
6868
'$_pkgName|lib/test_lib.g.dart':
69-
decodedMatches(startsWith('$_customHeader\n\n// ***'))
69+
decodedMatches(startsWith('$_customHeader\n\n// ***')),
7070
},
7171
);
7272
});
@@ -79,7 +79,7 @@ void main() {
7979
srcs,
8080
generateFor: {'$_pkgName|lib/test_lib.dart'},
8181
outputs: {
82-
'$_pkgName|lib/test_lib.g.dart': decodedMatches(startsWith('// ***'))
82+
'$_pkgName|lib/test_lib.g.dart': decodedMatches(startsWith('// ***')),
8383
},
8484
);
8585
});
@@ -289,7 +289,7 @@ void main() {
289289
),
290290
{
291291
'$_pkgName|lib/a.dart': '''// @dart=2.12
292-
part "a.foo.dart";'''
292+
part "a.foo.dart";''',
293293
},
294294
generateFor: {'$_pkgName|lib/a.dart'},
295295
outputs: {
@@ -324,8 +324,8 @@ part "a.foo.dart";'''
324324
'.foo.dart',
325325
options: const BuilderOptions({
326326
'build_extensions': {
327-
'^lib/{{}}.dart': 'lib/generated/{{}}.foo.dart'
328-
}
327+
'^lib/{{}}.dart': 'lib/generated/{{}}.foo.dart',
328+
},
329329
}),
330330
);
331331
final logs = <String>[];
@@ -351,8 +351,8 @@ part "a.foo.dart";'''
351351
header: '',
352352
options: const BuilderOptions({
353353
'build_extensions': {
354-
'^lib/{{}}.dart': 'lib/generated/{{}}.foo.dart'
355-
}
354+
'^lib/{{}}.dart': 'lib/generated/{{}}.foo.dart',
355+
},
356356
}),
357357
),
358358
{'$_pkgName|lib/a.dart': 'part "generated/a.foo.dart";'},
@@ -375,8 +375,8 @@ part "a.foo.dart";'''
375375
additionalOutputExtensions: ['.bar.dart'],
376376
options: const BuilderOptions({
377377
'build_extensions': {
378-
'^lib/{{}}.dart': 'lib/generated/{{}}.foo.dart'
379-
}
378+
'^lib/{{}}.dart': 'lib/generated/{{}}.foo.dart',
379+
},
380380
}),
381381
),
382382
{'$_pkgName|lib/a.dart': 'part "generated/a.foo.dart";'},
@@ -395,8 +395,8 @@ part "a.foo.dart";'''
395395
const CommentGenerator(),
396396
options: const BuilderOptions({
397397
'build_extensions': {
398-
'^lib/{{}}.dart': 'lib/generated/{{}}.g.dart'
399-
}
398+
'^lib/{{}}.dart': 'lib/generated/{{}}.g.dart',
399+
},
400400
}),
401401
),
402402
_createPackageStub(),
@@ -418,8 +418,8 @@ part "a.foo.dart";'''
418418
additionalOutputExtensions: ['.foo.dart'],
419419
options: const BuilderOptions({
420420
'build_extensions': {
421-
'^lib/{{}}.dart': 'lib/generated/{{}}.foo.dart'
422-
}
421+
'^lib/{{}}.dart': 'lib/generated/{{}}.foo.dart',
422+
},
423423
}),
424424
),
425425
{'$_pkgName|lib/a.dart': 'part "generated/a.foo.dart";'},
@@ -469,7 +469,7 @@ part "a.foo.dart";'''
469469
'is empty': '',
470470
'contains whitespace': 'coo bob',
471471
'contains symbols': '%oops',
472-
'contains . in the middle': 'cool.thing'
472+
'contains . in the middle': 'cool.thing',
473473
}.entries) {
474474
test('throws if the partId ${entry.key}', () async {
475475
expect(
@@ -490,7 +490,7 @@ part "a.foo.dart";'''
490490
const CombiningBuilder(),
491491
{
492492
'$_pkgName|lib/a.dart': 'library a; part "a.g.dart";',
493-
'$_pkgName|lib/a.foo.g.part': 'some generated content'
493+
'$_pkgName|lib/a.foo.g.part': 'some generated content',
494494
},
495495
generateFor: {'$_pkgName|lib/a.dart'},
496496
outputs: {
@@ -510,7 +510,7 @@ part "a.foo.dart";'''
510510
library a;
511511
part "a.g.dart";
512512
''',
513-
'$_pkgName|lib/a.foo.g.part': 'some generated content'
513+
'$_pkgName|lib/a.foo.g.part': 'some generated content',
514514
},
515515
generateFor: {'$_pkgName|lib/a.dart'},
516516
outputs: {
@@ -533,7 +533,7 @@ some generated content
533533
const CombiningBuilder(),
534534
{
535535
'$_pkgName|lib/a.dart': 'library a; part "a.g.dart";',
536-
'$_pkgName|lib/a.foo.g.part': 'some generated content'
536+
'$_pkgName|lib/a.foo.g.part': 'some generated content',
537537
},
538538
generateFor: {'$_pkgName|lib/a.dart'},
539539
outputs: {
@@ -548,7 +548,7 @@ some generated content
548548
const CombiningBuilder(),
549549
{
550550
'$_pkgName|lib/a.dart': 'library a; part "a.g.dart";',
551-
'$_pkgName|lib/a.foo.g.part': 'some generated content'
551+
'$_pkgName|lib/a.foo.g.part': 'some generated content',
552552
},
553553
generateFor: {'$_pkgName|lib/a.dart'},
554554
outputs: {
@@ -744,8 +744,8 @@ foo generated content
744744
combiningBuilder(
745745
const BuilderOptions({
746746
'build_extensions': {
747-
'^lib/{{}}.dart': 'lib/generated/{{}}.g.dart'
748-
}
747+
'^lib/{{}}.dart': 'lib/generated/{{}}.g.dart',
748+
},
749749
}),
750750
),
751751
{
@@ -777,8 +777,8 @@ foo generated content
777777
combiningBuilder(
778778
const BuilderOptions({
779779
'build_extensions': {
780-
'^lib/{{}}.dart': 'lib/generated/{{}}.g.dart'
781-
}
780+
'^lib/{{}}.dart': 'lib/generated/{{}}.g.dart',
781+
},
782782
}),
783783
),
784784
{

source_gen/test/external_only_type_checker_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ void main() {
7676
);
7777
},
7878
onPlatform: const {
79-
'windows': Skip('https://github.com/dart-lang/source_gen/issues/573')
79+
'windows': Skip('https://github.com/dart-lang/source_gen/issues/573'),
8080
},
8181
);
8282

source_gen/test/generator_for_annotation_test.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ void main() {
2121
'empty string': '',
2222
'only whitespace': '\n \t',
2323
'empty list': <Object>[],
24-
'list with null, empty, and whitespace items': [null, '', '\n \t']
24+
'list with null, empty, and whitespace items': [null, '', '\n \t'],
2525
}.entries) {
2626
test(entry.key, () async {
2727
final generator =
@@ -56,7 +56,7 @@ void main() {
5656
// bar
5757
5858
// baz
59-
'''
59+
''',
6060
},
6161
);
6262
});
@@ -69,7 +69,7 @@ void main() {
6969
'from iterable': _StubGenerator<Deprecated>('FailingIterable', (_) sync* {
7070
yield '// There are deprecated values in this library!';
7171
throw StateError('not supported!');
72-
})
72+
}),
7373
}.entries) {
7474
test(entry.key, () async {
7575
final builder = LibraryBuilder(entry.value);
@@ -123,7 +123,7 @@ void main() {
123123
'a|lib/file.dart': '''
124124
@deprecated
125125
library foo;
126-
'''
126+
''',
127127
},
128128
outputs: {
129129
'a|lib/file.g.dart': '''
@@ -134,7 +134,7 @@ void main() {
134134
// **************************************************************************
135135
136136
// foo
137-
'''
137+
''',
138138
},
139139
);
140140
});
@@ -159,7 +159,7 @@ void main() {
159159
export 'imported.dart';
160160
@deprecated
161161
part 'part.dart';
162-
'''
162+
''',
163163
},
164164
outputs: {
165165
'a|lib/file.g.dart': '''
@@ -174,7 +174,7 @@ void main() {
174174
// LibraryExportElementImpl
175175
176176
// PartElementImpl
177-
'''
177+
''',
178178
},
179179
);
180180
});
@@ -208,7 +208,7 @@ const _inputMap = {
208208
209209
@deprecated
210210
final baz = 'baz';
211-
'''
211+
''',
212212
};
213213

214214
class _TestingResolver implements ReleasableResolver {

source_gen/test/test_files/annotations.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,5 @@ const objectAnnotation = {
7272
'String': 'a string',
7373
'core type': bool,
7474
'imported sdk type': collection.Queue,
75-
'non-core type': OtherPublicAnnotationClass
75+
'non-core type': OtherPublicAnnotationClass,
7676
};

source_gen/test/type_checker_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void main() {
7979
staticMap = core.getClass('Map')!.instantiate(
8080
typeArguments: [
8181
core.typeProvider.dynamicType,
82-
core.typeProvider.dynamicType
82+
core.typeProvider.dynamicType,
8383
],
8484
nullabilitySuffix: NullabilitySuffix.none,
8585
);
@@ -119,7 +119,7 @@ void main() {
119119
staticHashMap = collection.getClass('HashMap')!.instantiate(
120120
typeArguments: [
121121
core.typeProvider.dynamicType,
122-
core.typeProvider.dynamicType
122+
core.typeProvider.dynamicType,
123123
],
124124
nullabilitySuffix: NullabilitySuffix.none,
125125
);

source_gen/test/utils_test.dart

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ void main() {
5858
final buildExtensions = validatedBuildExtensionsFrom(
5959
{
6060
'build_extensions': {
61-
'.dart': ['.g.dart', '.h.dart']
62-
}
61+
'.dart': ['.g.dart', '.h.dart'],
62+
},
6363
},
6464
{},
6565
);
@@ -72,8 +72,8 @@ void main() {
7272
final buildExtensions = validatedBuildExtensionsFrom(
7373
{
7474
'build_extensions': {
75-
'.dart': ['.g.dart', '.swagger.json']
76-
}
75+
'.dart': ['.g.dart', '.swagger.json'],
76+
},
7777
},
7878
{},
7979
);
@@ -104,8 +104,8 @@ void main() {
104104
() => validatedBuildExtensionsFrom(
105105
{
106106
'build_extensions': {
107-
'.txt': ['.dart']
108-
}
107+
'.txt': ['.dart'],
108+
},
109109
},
110110
{},
111111
),
@@ -124,7 +124,7 @@ void main() {
124124
expect(
125125
() => validatedBuildExtensionsFrom(
126126
{
127-
'build_extensions': {'.dart': '.out'}
127+
'build_extensions': {'.dart': '.out'},
128128
},
129129
{},
130130
),
@@ -142,8 +142,8 @@ void main() {
142142
() => validatedBuildExtensionsFrom(
143143
{
144144
'build_extensions': {
145-
'.dart': ['.out', '.g.dart']
146-
}
145+
'.dart': ['.out', '.g.dart'],
146+
},
147147
},
148148
{},
149149
),

0 commit comments

Comments
 (0)