From ea7ea574624601f6530ef75e745916cfe0d8262a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Dec 2024 14:17:16 -0800 Subject: [PATCH] Bump dart_style from 2.3.7 to 3.0.0 (#2459) * Bump dart_style from 2.3.7 to 3.0.0 Bumps [dart_style](https://github.com/dart-lang/dart_style) from 2.3.7 to 3.0.0. - [Release notes](https://github.com/dart-lang/dart_style/releases) - [Changelog](https://github.com/dart-lang/dart_style/blob/main/CHANGELOG.md) - [Commits](https://github.com/dart-lang/dart_style/compare/v2.3.7...v3.0.0) --- updated-dependencies: - dependency-name: dart_style dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * Update DartFormatter() to explicitly set the language version. This is now required in dart-style v3 * use set the dart version from the Platform library instead of the ananlyzer library because that analyzer library may use beta versions --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Carlos (Goodwine) <2022649+Goodwine@users.noreply.github.com> --- lib/src/deprecation.dart | 8 +++++--- pubspec.yaml | 2 +- tool/grind/generate_deprecations.dart | 5 ++++- tool/grind/synchronize.dart | 5 ++++- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/src/deprecation.dart b/lib/src/deprecation.dart index 3281e720d..1962ec627 100644 --- a/lib/src/deprecation.dart +++ b/lib/src/deprecation.dart @@ -191,15 +191,17 @@ enum Deprecation { String toString() => id; /// Returns the deprecation with a given ID, or null if none exists. - static Deprecation? fromId(String id) => Deprecation.values - .firstWhereOrNull((deprecation) => deprecation.id == id); + static Deprecation? fromId(String id) => Deprecation.values.firstWhereOrNull( + (deprecation) => deprecation.id == id, + ); /// Returns the set of all deprecations done in or before [version]. static Set forVersion(Version version) { var range = VersionRange(max: version, includeMax: true); return { for (var deprecation in Deprecation.values) - if (deprecation.deprecatedIn.andThen(range.allows) ?? false) deprecation + if (deprecation.deprecatedIn.andThen(range.allows) ?? false) + deprecation, }; } } diff --git a/pubspec.yaml b/pubspec.yaml index ba310f719..efc67893d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -41,7 +41,7 @@ dev_dependencies: analyzer: ^6.8.0 archive: ^3.1.2 crypto: ^3.0.0 - dart_style: ^2.0.0 + dart_style: ^3.0.0 dartdoc: ">=8.0.14 <8.3.1" # dart-lang/dartdoc#3947 grinder: ^0.9.0 node_preamble: ^2.0.2 diff --git a/tool/grind/generate_deprecations.dart b/tool/grind/generate_deprecations.dart index 21ce6f58e..5590f465c 100644 --- a/tool/grind/generate_deprecations.dart +++ b/tool/grind/generate_deprecations.dart @@ -8,6 +8,7 @@ import 'dart:io'; import 'package:crypto/crypto.dart'; import 'package:dart_style/dart_style.dart'; import 'package:grinder/grinder.dart'; +import 'package:pub_semver/pub_semver.dart'; import 'package:yaml/yaml.dart'; import 'utils.dart'; @@ -78,5 +79,7 @@ void deprecations() { fail("Couldn't find block for generated code in lib/src/deprecation.dart"); } var newCode = dartText.replaceFirst(_blockRegex, buffer.toString()); - dartFile.writeAsStringSync(DartFormatter().format(newCode)); + dartFile.writeAsStringSync(DartFormatter( + languageVersion: Version.parse(Platform.version.split(' ').first)) + .format(newCode)); } diff --git a/tool/grind/synchronize.dart b/tool/grind/synchronize.dart index de18066d2..8581eccc8 100644 --- a/tool/grind/synchronize.dart +++ b/tool/grind/synchronize.dart @@ -16,6 +16,7 @@ import 'package:crypto/crypto.dart'; import 'package:dart_style/dart_style.dart'; import 'package:grinder/grinder.dart'; import 'package:path/path.dart' as p; +import 'package:pub_semver/pub_semver.dart'; import 'package:source_span/source_span.dart'; import 'package:sass/src/util/nullable.dart'; @@ -58,7 +59,9 @@ String synchronizeFile(String source) { parseFile(path: source, featureSet: FeatureSet.latestLanguageVersion()) .unit .accept(visitor); - return DartFormatter().format(visitor.result); + return DartFormatter( + languageVersion: Version.parse(Platform.version.split(' ').first)) + .format(visitor.result); } /// The visitor that traverses the asynchronous parse tree and converts it to