Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Update dart_style to pass in a language version to DartFormatter. #466

Merged
merged 4 commits into from
Oct 23, 2024

Conversation

munificent
Copy link
Contributor

We're in the process of moving dart_style to a new formatting style. That involves making the formatter aware of the language version of what it's formatting.

That in turn means that the library API now lets you pass in a language version. In dart_style 2.3.7 you can pass in a language version but the parameter is optional. In the forthcoming 3.0.0 release, that parameter will become mandatory.

This updates every call to DartFormatter() to pass in the latest language version. If there's a more specific version that should be used, let me know and I'll update the PR.

Thanks!

We're in [the process of](dart-lang/dart_style#1403) moving dart_style to [a new formatting style](dart-lang/dart_style#1253). That involves making the formatter [aware of the language version of what it's formatting](dart-lang/dart_style#1402).

That in turn means that the library API now lets you pass in a language version. In dart_style 2.3.7 [you can pass in a language version but the parameter is optional](https://pub.dev/documentation/dart_style/latest/dart_style/DartFormatter/DartFormatter.html). In the forthcoming 3.0.0 release, that parameter will become mandatory.

This updates every call to `DartFormatter()` to pass in the latest language version. If there's a more specific version that should be used, let me know and I'll update the PR.

Thanks!
test/common.dart Show resolved Hide resolved
Copy link
Contributor

@devoncarew devoncarew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add in a line to the latest changelog entry? Something like Upgrade to dart_style 2.3.7..

Also, it looks like there is an existing analysis issue w/ the analysis_options.yaml file; it would be great to address that as well, so that we can land this PR on green.

From your PR description and the code change, it looks like we're fine w/o this change as the upcoming api break is in the next major version of dart_style; but perhaps this makes it easier to roll that new version into a monorepo w/ this package.

@munificent
Copy link
Contributor Author

Can you add in a line to the latest changelog entry? Something like Upgrade to dart_style 2.3.7..

Done.

Also, it looks like there is an existing analysis issue w/ the analysis_options.yaml file; it would be great to address that as well, so that we can land this PR on green.

Sure thing, done.

From your PR description and the code change, it looks like we're fine w/o this change as the upcoming api break is in the next major version of dart_style;

Yeah, you don't need to pass the language version in just to please 2.3.7, but you will to work with 3.0.0 which is hot on its heels.

but perhaps this makes it easier to roll that new version into a monorepo w/ this package.

Yes, that's the motivation for me fixing this. :)

@munificent
Copy link
Contributor Author

@devoncarew, in order to get CI happy, I had to bump the stable version being tested to 3.3.0. Are you OK with that?

It should be fine since, after this change, anyone using the latest code_builder will need to be on 3.3.0 or later anyway (since it appears there is no version of analyzer that dart_style 2.3.7 accepts which allows an older SDK.

@devoncarew
Copy link
Contributor

@devoncarew, in order to get CI happy, I had to bump the stable version being tested to 3.3.0. Are you OK with that?

Yes, we're generally fine w/ moving sdk deps forward as necessary, up to and including the latest stable.

@munificent munificent merged commit 257c257 into master Oct 23, 2024
6 checks passed
@munificent munificent deleted the update-dart-style branch October 23, 2024 19:29
mosuem pushed a commit to dart-lang/tools that referenced this pull request Oct 25, 2024
…rt-archive/code_builder#466)

* Update dart_style to pass in a language version to DartFormatter.

We're in [the process of](dart-lang/dart_style#1403) moving dart_style to [a new formatting style](dart-lang/dart_style#1253). That involves making the formatter [aware of the language version of what it's formatting](dart-lang/dart_style#1402).

That in turn means that the library API now lets you pass in a language version. In dart_style 2.3.7 [you can pass in a language version but the parameter is optional](https://pub.dev/documentation/dart_style/latest/dart_style/DartFormatter/DartFormatter.html). In the forthcoming 3.0.0 release, that parameter will become mandatory.

This updates every call to `DartFormatter()` to pass in the latest language version.

* Update CHANGELOG and analysis_options.yaml.

* Require Dart SDK 3.5.0.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants