Skip to content

Commit

Permalink
Bump dart_style from 2.3.7 to 3.0.0 (#2459)
Browse files Browse the repository at this point in the history
* 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](dart-lang/dart_style@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] <support@github.com>

* 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] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Carlos (Goodwine) <2022649+Goodwine@users.noreply.github.com>
  • Loading branch information
dependabot[bot] and Goodwine authored Dec 23, 2024
1 parent 6f4584c commit ea7ea57
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
8 changes: 5 additions & 3 deletions lib/src/deprecation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<Deprecation> 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,
};
}
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion tool/grind/generate_deprecations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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));
}
5 changes: 4 additions & 1 deletion tool/grind/synchronize.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ea7ea57

Please sign in to comment.