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