From 42d32cb9db6c2eef9500f7be41483038a80c5233 Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Thu, 30 Nov 2023 16:07:59 -0800 Subject: [PATCH] Update to latest lints, require Dart ^3.1 (#568) --- .github/workflows/test-package.yml | 2 +- CHANGELOG.md | 1 + analysis_options.yaml | 6 ++---- pubspec.yaml | 8 ++++---- tool/expected_output.dart | 5 ++--- tool/stats.dart | 21 +++------------------ tool/update_github_emojis.dart | 2 +- 7 files changed, 14 insertions(+), 31 deletions(-) diff --git a/.github/workflows/test-package.yml b/.github/workflows/test-package.yml index 381cde99..57383f40 100644 --- a/.github/workflows/test-package.yml +++ b/.github/workflows/test-package.yml @@ -47,7 +47,7 @@ jobs: matrix: # Add macos-latest and/or windows-latest if relevant for this package. os: [ubuntu-latest] - sdk: [2.19.0, dev] + sdk: [3.1, dev] steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cd2f7a9..5fcfd579 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## 7.1.2-wip +* Require Dart `^3.1.0`. * Update all CommonMark specification links to 0.30. * Fix beginning of line detection in `AutolinkExtensionSyntax`. diff --git a/analysis_options.yaml b/analysis_options.yaml index 124348f7..1604ff0b 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -11,6 +11,8 @@ analyzer: # The example app explicitly takes a String of user-generated HTML and # inserts it straight into a
using innerHtml. unsafe_html: ignore + # Waiting on a couple of bug fixes and new features before this should be enabled + comment_references: ignore linter: rules: @@ -25,15 +27,11 @@ linter: - missing_whitespace_between_adjacent_strings - no_adjacent_strings_in_list - package_api_docs - - prefer_const_constructors - prefer_const_declarations - prefer_final_locals - prefer_final_in_for_each - - prefer_relative_imports - - test_types_in_equals - unnecessary_await_in_return - unnecessary_raw_strings - use_if_null_to_convert_nulls_to_bools - use_raw_strings - use_string_buffers - - use_super_parameters diff --git a/pubspec.yaml b/pubspec.yaml index 387a6677..6ddea8fa 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,7 +11,7 @@ executables: markdown: environment: - sdk: '>=2.19.0 <3.0.0' + sdk: ^3.1.0 dependencies: args: ^2.0.0 @@ -20,11 +20,11 @@ dependencies: dev_dependencies: build_runner: ^2.0.5 build_version: ^2.0.3 - build_web_compilers: '>=3.0.0 <5.0.0' + build_web_compilers: ^4.0.0 collection: ^1.15.0 - dart_flutter_team_lints: ^1.0.0 + dart_flutter_team_lints: ^2.0.0 html: ^0.15.0 - http: '>=0.13.5 <2.0.0' + http: ^1.0.0 io: ^1.0.0 js: ^0.6.3 path: ^1.8.0 diff --git a/tool/expected_output.dart b/tool/expected_output.dart index b50adb02..aa7bab36 100644 --- a/tool/expected_output.dart +++ b/tool/expected_output.dart @@ -92,11 +92,10 @@ Iterable _dataCases({ return results; } -/// Parse and yield data cases (each a [DataCase]) from the directory containing -/// [library], optionally under [subdirectory]. +/// Parse and yield data cases (each a [DataCase]) from [testDirectory]. /// /// By default, only read data cases from files with a `.unit` extension. Data -/// cases are read from files located immediately in [directory], or +/// cases are read from files located immediately in [testDirectory], or /// recursively, according to [recursive]. /// /// The typical use case of this method is to declare a library at the top of a diff --git a/tool/stats.dart b/tool/stats.dart index 4f952bb7..67b1d394 100644 --- a/tool/stats.dart +++ b/tool/stats.dart @@ -179,26 +179,11 @@ Future _processConfig( Object? _convert(Object? obj) { if (obj is CompareLevel) { - switch (obj) { - case CompareLevel.strict: - return 'strict'; - case CompareLevel.error: - return 'error'; - case CompareLevel.fail: - return 'fail'; - case CompareLevel.loose: - return 'loose'; - default: - throw ArgumentError('`$obj` is unknown.'); - } + return obj.name; } if (obj is Map) { - final map = {}; - obj.forEach((k, v) { - final newKey = k.toString(); - map[newKey] = v; - }); - return map; + return obj + .map((key, value) => MapEntry(key.toString(), value)); } return obj; } diff --git a/tool/update_github_emojis.dart b/tool/update_github_emojis.dart index 33751ecc..fb07ac51 100644 --- a/tool/update_github_emojis.dart +++ b/tool/update_github_emojis.dart @@ -30,7 +30,7 @@ const _emojisFilePath = 'lib/src/emojis.dart'; /// Reference to emoji map within legacy_emojis.dart const legacyEmojis = legacy.emojis; -/// AUTO GENERATED by [reconcile_emojis.dart] - this only needed to be done ONCE +/// AUTO GENERATED by `reconcile_emojis.dart` - this only needed to be done ONCE /// during the reconciliation process with the legacy emoji. /// This array is ONLY USED when the --useGitHubUnicodes option is used to /// minimize the visual differences in the output emoji.