From eec8f477b5c334eaa7ec94e2509b4e78bf590889 Mon Sep 17 00:00:00 2001 From: Moritz Date: Mon, 20 Nov 2023 09:53:37 +0100 Subject: [PATCH 1/5] Rev analyzer dep --- pkgs/intl_translation/CHANGELOG.md | 4 +++- pkgs/intl_translation/pubspec.yaml | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pkgs/intl_translation/CHANGELOG.md b/pkgs/intl_translation/CHANGELOG.md index deb284e2..ff46040c 100644 --- a/pkgs/intl_translation/CHANGELOG.md +++ b/pkgs/intl_translation/CHANGELOG.md @@ -1,7 +1,9 @@ -## 0.19.0-dev +## 0.19.0-wip * Always generate null safe code, remove `null-safe` flag. * Add example for `he` locale. * MessageExtraction: add set of error codes to be ignored in analysis. + * Upgrade dependencies on `analyzer` and `lints`. + * Fix pubspec `repository` url. ## 0.18.1 * Update analyzer dependency to `5.2.0`. diff --git a/pkgs/intl_translation/pubspec.yaml b/pkgs/intl_translation/pubspec.yaml index 36483ad4..ed43d22f 100644 --- a/pkgs/intl_translation/pubspec.yaml +++ b/pkgs/intl_translation/pubspec.yaml @@ -1,21 +1,21 @@ name: intl_translation -version: 0.19.0-dev +version: 0.19.0-wip description: >- Contains code to deal with internationalized/localized messages, date and number formatting and parsing, bi-directional text, and other internationalization issues. -repository: https://github.com/dart-lang/intl_translation +repository: https://github.com/dart-lang/i18n/tree/main/pkgs/intl_translation environment: sdk: '>=2.18.0 <3.0.0' dependencies: - analyzer: ^5.2.0 + analyzer: ^6.3.0 args: ^2.0.0 dart_style: ^2.0.0 intl: ^0.18.0 path: ^1.0.0 dev_dependencies: - lints: ^2.0.0 + lints: ^3.0.0 test: ^1.0.0 From be6576f5eb653dc725c019c50e9fc8034752e0b5 Mon Sep 17 00:00:00 2001 From: Moritz Date: Mon, 20 Nov 2023 09:57:45 +0100 Subject: [PATCH 2/5] Run `dart fix` --- pkgs/intl_translation/lib/src/message_rewriter.dart | 2 ++ .../lib/src/messages/submessages/gender.dart | 4 ++-- .../lib/src/messages/submessages/plural.dart | 4 ++-- .../lib/src/messages/submessages/select.dart | 4 ++-- pkgs/intl_translation/pubspec.yaml | 2 +- .../test/generate_localized/code_map_test.dart | 2 ++ .../test/message_extraction/examples_parsing_test.dart | 8 ++++++-- .../message_extraction_flutter_test.dart | 8 ++++++-- .../message_extraction/message_extraction_json_test.dart | 8 ++++++-- pkgs/intl_translation/test/two_components/component.dart | 2 ++ .../test/two_components/initialize_child_test.dart | 2 ++ .../test/two_components/main_app_test.dart | 2 ++ 12 files changed, 35 insertions(+), 13 deletions(-) diff --git a/pkgs/intl_translation/lib/src/message_rewriter.dart b/pkgs/intl_translation/lib/src/message_rewriter.dart index 0622e8ee..baf95a79 100644 --- a/pkgs/intl_translation/lib/src/message_rewriter.dart +++ b/pkgs/intl_translation/lib/src/message_rewriter.dart @@ -4,6 +4,8 @@ /// Code to rewrite Intl.message calls adding the name and args parameters /// automatically, primarily used by the transformer. +library; + import 'package:analyzer/dart/analysis/utilities.dart'; import '../extract_messages.dart'; diff --git a/pkgs/intl_translation/lib/src/messages/submessages/gender.dart b/pkgs/intl_translation/lib/src/messages/submessages/gender.dart index 3be28549..b1bfed96 100644 --- a/pkgs/intl_translation/lib/src/messages/submessages/gender.dart +++ b/pkgs/intl_translation/lib/src/messages/submessages/gender.dart @@ -15,8 +15,8 @@ class Gender extends SubMessage { /// clauses. Each clause is expected to be a list whose first element is a /// variable name and whose second element is either a [String] or /// a list of strings and [Message] or [VariableSubstitution]. - Gender.from(String mainArgument, List clauses, [Message? parent]) - : super.from(mainArgument, clauses, parent); + Gender.from(super.mainArgument, super.clauses, [Message? super.parent]) + : super.from(); Message? female; Message? male; diff --git a/pkgs/intl_translation/lib/src/messages/submessages/plural.dart b/pkgs/intl_translation/lib/src/messages/submessages/plural.dart index dad36c92..351396ef 100644 --- a/pkgs/intl_translation/lib/src/messages/submessages/plural.dart +++ b/pkgs/intl_translation/lib/src/messages/submessages/plural.dart @@ -7,8 +7,8 @@ import 'submessage.dart'; class Plural extends SubMessage { Plural() : super.from('', [], null); - Plural.from(String mainArgument, List clauses, [Message? parent]) - : super.from(mainArgument, clauses, parent); + Plural.from(super.mainArgument, super.clauses, [Message? super.parent]) + : super.from(); Message? zero; Message? one; diff --git a/pkgs/intl_translation/lib/src/messages/submessages/select.dart b/pkgs/intl_translation/lib/src/messages/submessages/select.dart index b92ef724..dd4ba5d3 100644 --- a/pkgs/intl_translation/lib/src/messages/submessages/select.dart +++ b/pkgs/intl_translation/lib/src/messages/submessages/select.dart @@ -17,8 +17,8 @@ class Select extends SubMessage { /// clauses. Each clause is expected to be a list whose first element is a /// variable name and whose second element is either a String or /// a list of strings and [Message]s or [VariableSubstitution]s. - Select.from(String mainArgument, List clauses, [Message? parent]) - : super.from(mainArgument, clauses, parent); + Select.from(super.mainArgument, super.clauses, [Message? super.parent]) + : super.from(); Map cases = {}; diff --git a/pkgs/intl_translation/pubspec.yaml b/pkgs/intl_translation/pubspec.yaml index ed43d22f..860f68bf 100644 --- a/pkgs/intl_translation/pubspec.yaml +++ b/pkgs/intl_translation/pubspec.yaml @@ -7,7 +7,7 @@ description: >- repository: https://github.com/dart-lang/i18n/tree/main/pkgs/intl_translation environment: - sdk: '>=2.18.0 <3.0.0' + sdk: '>=2.19.0 <4.0.0' dependencies: analyzer: ^6.3.0 diff --git a/pkgs/intl_translation/test/generate_localized/code_map_test.dart b/pkgs/intl_translation/test/generate_localized/code_map_test.dart index 3ca1aafd..8c180f20 100644 --- a/pkgs/intl_translation/test/generate_localized/code_map_test.dart +++ b/pkgs/intl_translation/test/generate_localized/code_map_test.dart @@ -3,6 +3,8 @@ // BSD-style license that can be found in the LICENSE file. /// An application using the code map messages. +library; + import 'package:intl/intl.dart'; import 'package:test/test.dart'; diff --git a/pkgs/intl_translation/test/message_extraction/examples_parsing_test.dart b/pkgs/intl_translation/test/message_extraction/examples_parsing_test.dart index 471956c7..befed744 100644 --- a/pkgs/intl_translation/test/message_extraction/examples_parsing_test.dart +++ b/pkgs/intl_translation/test/message_extraction/examples_parsing_test.dart @@ -2,10 +2,14 @@ // 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. -@Timeout(Duration(seconds: 180)) - /// Test for parsing the examples argument from an Intl.message call. Very /// minimal so far. +library; + + + +@Timeout(Duration(seconds: 180)) + import 'dart:io'; diff --git a/pkgs/intl_translation/test/message_extraction/message_extraction_flutter_test.dart b/pkgs/intl_translation/test/message_extraction/message_extraction_flutter_test.dart index 816d185a..b712fff9 100644 --- a/pkgs/intl_translation/test/message_extraction/message_extraction_flutter_test.dart +++ b/pkgs/intl_translation/test/message_extraction/message_extraction_flutter_test.dart @@ -2,10 +2,14 @@ // 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. -@Timeout(Duration(seconds: 180)) - /// A test for message extraction and code generation using generated /// JSON rather than functions +library; + + + +@Timeout(Duration(seconds: 180)) + import 'package:test/test.dart'; diff --git a/pkgs/intl_translation/test/message_extraction/message_extraction_json_test.dart b/pkgs/intl_translation/test/message_extraction/message_extraction_json_test.dart index a2c7d521..213ec760 100644 --- a/pkgs/intl_translation/test/message_extraction/message_extraction_json_test.dart +++ b/pkgs/intl_translation/test/message_extraction/message_extraction_json_test.dart @@ -2,10 +2,14 @@ // 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. -@Timeout(Duration(seconds: 180)) - /// A test for message extraction and code generation using generated /// JSON rather than functions +library; + + + +@Timeout(Duration(seconds: 180)) + import 'package:test/test.dart'; diff --git a/pkgs/intl_translation/test/two_components/component.dart b/pkgs/intl_translation/test/two_components/component.dart index 737927c4..8ffa360b 100644 --- a/pkgs/intl_translation/test/two_components/component.dart +++ b/pkgs/intl_translation/test/two_components/component.dart @@ -4,6 +4,8 @@ /// A component which should have its own separate messages, with their own /// translations. +library; + import 'package:intl/intl.dart'; import 'component_messages_all.dart'; diff --git a/pkgs/intl_translation/test/two_components/initialize_child_test.dart b/pkgs/intl_translation/test/two_components/initialize_child_test.dart index e56cb349..106b6ffc 100644 --- a/pkgs/intl_translation/test/two_components/initialize_child_test.dart +++ b/pkgs/intl_translation/test/two_components/initialize_child_test.dart @@ -7,6 +7,8 @@ /// This is not actually related to the two components testing, but it's /// convenient to put it here because there's already a hard-coded /// message here. +library; + import 'package:intl/intl.dart'; import 'package:test/test.dart'; diff --git a/pkgs/intl_translation/test/two_components/main_app_test.dart b/pkgs/intl_translation/test/two_components/main_app_test.dart index 262ad482..98d55822 100644 --- a/pkgs/intl_translation/test/two_components/main_app_test.dart +++ b/pkgs/intl_translation/test/two_components/main_app_test.dart @@ -3,6 +3,8 @@ // BSD-style license that can be found in the LICENSE file. /// An application using the component +library; + import 'package:intl/intl.dart'; import 'package:test/test.dart'; From 7315909c2a5fe0769216be5116dedf1e0a34349d Mon Sep 17 00:00:00 2001 From: Moritz Date: Mon, 20 Nov 2023 10:00:02 +0100 Subject: [PATCH 3/5] Reformat --- .../test/message_extraction/examples_parsing_test.dart | 6 +----- .../message_extraction/message_extraction_flutter_test.dart | 6 +----- .../message_extraction/message_extraction_json_test.dart | 6 +----- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/pkgs/intl_translation/test/message_extraction/examples_parsing_test.dart b/pkgs/intl_translation/test/message_extraction/examples_parsing_test.dart index befed744..de4f493e 100644 --- a/pkgs/intl_translation/test/message_extraction/examples_parsing_test.dart +++ b/pkgs/intl_translation/test/message_extraction/examples_parsing_test.dart @@ -4,12 +4,8 @@ /// Test for parsing the examples argument from an Intl.message call. Very /// minimal so far. -library; - - - @Timeout(Duration(seconds: 180)) - +library; import 'dart:io'; diff --git a/pkgs/intl_translation/test/message_extraction/message_extraction_flutter_test.dart b/pkgs/intl_translation/test/message_extraction/message_extraction_flutter_test.dart index b712fff9..f811e3f5 100644 --- a/pkgs/intl_translation/test/message_extraction/message_extraction_flutter_test.dart +++ b/pkgs/intl_translation/test/message_extraction/message_extraction_flutter_test.dart @@ -4,12 +4,8 @@ /// A test for message extraction and code generation using generated /// JSON rather than functions -library; - - - @Timeout(Duration(seconds: 180)) - +library; import 'package:test/test.dart'; diff --git a/pkgs/intl_translation/test/message_extraction/message_extraction_json_test.dart b/pkgs/intl_translation/test/message_extraction/message_extraction_json_test.dart index 213ec760..25961546 100644 --- a/pkgs/intl_translation/test/message_extraction/message_extraction_json_test.dart +++ b/pkgs/intl_translation/test/message_extraction/message_extraction_json_test.dart @@ -4,12 +4,8 @@ /// A test for message extraction and code generation using generated /// JSON rather than functions -library; - - - @Timeout(Duration(seconds: 180)) - +library; import 'package:test/test.dart'; From 2da7748e0fa9ed5144a74e538c3beda3b7ff2d8b Mon Sep 17 00:00:00 2001 From: Moritz Date: Mon, 20 Nov 2023 10:05:11 +0100 Subject: [PATCH 4/5] More fixes --- pkgs/intl_translation/bin/make_examples_const.dart | 2 ++ pkgs/intl_translation/bin/rewrite_intl_messages.dart | 2 ++ pkgs/intl_translation/lib/src/messages/complex_message.dart | 2 +- pkgs/intl_translation/lib/src/messages/composite_message.dart | 4 +--- .../test/message_extraction/make_hardcoded_translation.dart | 1 + .../test/message_extraction/part_of_sample_with_messages.dart | 2 +- 6 files changed, 8 insertions(+), 5 deletions(-) diff --git a/pkgs/intl_translation/bin/make_examples_const.dart b/pkgs/intl_translation/bin/make_examples_const.dart index 0a54de81..bc8404a5 100644 --- a/pkgs/intl_translation/bin/make_examples_const.dart +++ b/pkgs/intl_translation/bin/make_examples_const.dart @@ -4,6 +4,8 @@ // BSD-style license that can be found in the LICENSE file. /// Converts the examples parameter for Intl messages to be const. +library; + import 'dart:io'; import 'package:args/args.dart'; diff --git a/pkgs/intl_translation/bin/rewrite_intl_messages.dart b/pkgs/intl_translation/bin/rewrite_intl_messages.dart index d2ddcf69..00a385df 100644 --- a/pkgs/intl_translation/bin/rewrite_intl_messages.dart +++ b/pkgs/intl_translation/bin/rewrite_intl_messages.dart @@ -10,6 +10,8 @@ /// It takes as input a single source Dart file and rewrites any /// Intl.message or related calls to automatically include the name and args /// parameters and writes the result to stdout. +library; + import 'dart:io'; import 'package:args/args.dart'; diff --git a/pkgs/intl_translation/lib/src/messages/complex_message.dart b/pkgs/intl_translation/lib/src/messages/complex_message.dart index f1f982b9..00f678cc 100644 --- a/pkgs/intl_translation/lib/src/messages/complex_message.dart +++ b/pkgs/intl_translation/lib/src/messages/complex_message.dart @@ -7,7 +7,7 @@ import 'message.dart'; /// Abstract class for messages with internal structure, representing the /// main Intl.message call, plurals, and genders. abstract class ComplexMessage extends Message { - ComplexMessage(parent) : super(parent); + ComplexMessage(super.parent); /// When we create these from strings or from AST nodes, we want to look up /// and set their attributes by string names, so we override the indexing diff --git a/pkgs/intl_translation/lib/src/messages/composite_message.dart b/pkgs/intl_translation/lib/src/messages/composite_message.dart index b122b276..76191947 100644 --- a/pkgs/intl_translation/lib/src/messages/composite_message.dart +++ b/pkgs/intl_translation/lib/src/messages/composite_message.dart @@ -9,9 +9,7 @@ import 'message.dart'; class CompositeMessage extends Message { List pieces; - CompositeMessage.withParent(parent) - : pieces = const [], - super(parent); + CompositeMessage.withParent(super.parent) : pieces = const []; CompositeMessage(this.pieces, [super.parent]) { for (var x in pieces) { x.parent = this; diff --git a/pkgs/intl_translation/test/message_extraction/make_hardcoded_translation.dart b/pkgs/intl_translation/test/message_extraction/make_hardcoded_translation.dart index 9a8c63b2..b83bd4cb 100644 --- a/pkgs/intl_translation/test/message_extraction/make_hardcoded_translation.dart +++ b/pkgs/intl_translation/test/message_extraction/make_hardcoded_translation.dart @@ -7,6 +7,7 @@ /// extract_message.dart for the files sample_with_messages.dart and /// part_of_sample_with_messages.dart and writing out hard-coded translations /// for German and French locales. +library; import 'dart:convert'; import 'dart:io'; diff --git a/pkgs/intl_translation/test/message_extraction/part_of_sample_with_messages.dart b/pkgs/intl_translation/test/message_extraction/part_of_sample_with_messages.dart index d99aa584..20daed4a 100644 --- a/pkgs/intl_translation/test/message_extraction/part_of_sample_with_messages.dart +++ b/pkgs/intl_translation/test/message_extraction/part_of_sample_with_messages.dart @@ -2,7 +2,7 @@ // 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.part of sample; -part of sample; +part of 'sample_with_messages.dart'; class Person { String name; From c782918d841d47c8cde37d4f81fca8b28e35657f Mon Sep 17 00:00:00 2001 From: Moritz Date: Mon, 20 Nov 2023 10:07:17 +0100 Subject: [PATCH 5/5] Last fixes --- pkgs/intl_translation/lib/src/messages/submessages/gender.dart | 3 +-- pkgs/intl_translation/lib/src/messages/submessages/plural.dart | 3 +-- pkgs/intl_translation/lib/src/messages/submessages/select.dart | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/pkgs/intl_translation/lib/src/messages/submessages/gender.dart b/pkgs/intl_translation/lib/src/messages/submessages/gender.dart index b1bfed96..5a8bd64a 100644 --- a/pkgs/intl_translation/lib/src/messages/submessages/gender.dart +++ b/pkgs/intl_translation/lib/src/messages/submessages/gender.dart @@ -15,8 +15,7 @@ class Gender extends SubMessage { /// clauses. Each clause is expected to be a list whose first element is a /// variable name and whose second element is either a [String] or /// a list of strings and [Message] or [VariableSubstitution]. - Gender.from(super.mainArgument, super.clauses, [Message? super.parent]) - : super.from(); + Gender.from(super.mainArgument, super.clauses, [super.parent]) : super.from(); Message? female; Message? male; diff --git a/pkgs/intl_translation/lib/src/messages/submessages/plural.dart b/pkgs/intl_translation/lib/src/messages/submessages/plural.dart index 351396ef..3a2ebdc7 100644 --- a/pkgs/intl_translation/lib/src/messages/submessages/plural.dart +++ b/pkgs/intl_translation/lib/src/messages/submessages/plural.dart @@ -7,8 +7,7 @@ import 'submessage.dart'; class Plural extends SubMessage { Plural() : super.from('', [], null); - Plural.from(super.mainArgument, super.clauses, [Message? super.parent]) - : super.from(); + Plural.from(super.mainArgument, super.clauses, [super.parent]) : super.from(); Message? zero; Message? one; diff --git a/pkgs/intl_translation/lib/src/messages/submessages/select.dart b/pkgs/intl_translation/lib/src/messages/submessages/select.dart index dd4ba5d3..e3682d4a 100644 --- a/pkgs/intl_translation/lib/src/messages/submessages/select.dart +++ b/pkgs/intl_translation/lib/src/messages/submessages/select.dart @@ -17,8 +17,7 @@ class Select extends SubMessage { /// clauses. Each clause is expected to be a list whose first element is a /// variable name and whose second element is either a String or /// a list of strings and [Message]s or [VariableSubstitution]s. - Select.from(super.mainArgument, super.clauses, [Message? super.parent]) - : super.from(); + Select.from(super.mainArgument, super.clauses, [super.parent]) : super.from(); Map cases = {};