From ff46ffaef7a81f5a1f48b4eecb5ee52c4de758c8 Mon Sep 17 00:00:00 2001 From: Alex Li Date: Sun, 3 Dec 2023 20:42:58 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A8=20Add=20`dart=20fix`=20configurati?= =?UTF-8?q?ons=20(#2049)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ![image](https://github.com/cfug/dio/assets/15884415/a5ce8c75-5fcc-4063-b77d-b022de6cc819) ### New Pull Request Checklist - [x] I have read the [Documentation](https://pub.dev/documentation/dio/latest/) - [x] I have searched for a similar pull request in the [project](https://github.com/cfug/dio/pulls) and found none - [x] I have updated this branch with the latest `main` branch to avoid conflicts (via merge from master or rebase) - [ ] I have added the required tests to prove the fix/feature I'm adding - [ ] I have updated the documentation (if necessary) - [ ] I have run the tests without failures - [x] I have updated the `CHANGELOG.md` in the corresponding package ### Additional context and info (if any) https://github.com/flutter/flutter/wiki/Data-driven-Fixes There are some limitations with `dart fix` data, such as we cannot modify a method parameter's arguments in a constructor (`onHttpClientCreate: (client)` to `createHttpClient: ()`, `stream` to `() => stream`). --- dio/CHANGELOG.md | 2 +- dio/lib/fix_data/fix.yaml | 75 +++++++++++++++++++ plugins/native_dio_adapter/CHANGELOG.md | 2 +- .../native_dio_adapter/lib/fix_data/fix.yaml | 17 +++++ 4 files changed, 94 insertions(+), 2 deletions(-) create mode 100644 dio/lib/fix_data/fix.yaml create mode 100644 plugins/native_dio_adapter/lib/fix_data/fix.yaml diff --git a/dio/CHANGELOG.md b/dio/CHANGELOG.md index a39a21f1d..255ac7e7e 100644 --- a/dio/CHANGELOG.md +++ b/dio/CHANGELOG.md @@ -5,7 +5,7 @@ See the [Migration Guide][] for the complete breaking changes list.** ## Unreleased -*None.* +- Provide fix suggestions for `dart fix`. ## 5.4.0 diff --git a/dio/lib/fix_data/fix.yaml b/dio/lib/fix_data/fix.yaml new file mode 100644 index 000000000..7cf78e8e9 --- /dev/null +++ b/dio/lib/fix_data/fix.yaml @@ -0,0 +1,75 @@ +version: 1 + +transforms: + # Changes made in https://github.com/cfug/diox/pull/14 + - title: "Migrate to 'IOHttpClientAdapter'" + date: 2022-11-07 + element: + uris: ['dio.dart', 'src/adapter.dart', 'src/adapters/io_adapter.dart'] + class: 'DefaultHttpClientAdapter' + changes: + - kind: 'rename' + newName: 'IOHttpClientAdapter' + + # Changes made in https://github.com/cfug/diox/pull/62 + - title: "Migrate to 'BackgroundTransformer'" + date: 2023-01-31 + element: + uris: ['dio.dart', 'src/transformer.dart'] + class: 'DefaultTransformer' + changes: + - kind: 'rename' + newName: 'BackgroundTransformer' + + # Changes made in https://github.com/cfug/dio/pull/1812 + - title: "Migrate to 'CreateHttpClient'" + date: 2023-05-14 + element: + uris: ['dio.dart', 'src/adapters/io_adapter.dart'] + typedef: 'OnHttpClientCreate' + changes: + - kind: 'rename' + newName: 'CreateHttpClient' + - kind: 'removeParameter' + index: 0 + - title: "Migrate to 'createHttpClient'" + date: 2023-05-14 + element: + uris: ['dio.dart', 'src/adapters/io_adapter.dart'] + constructor: '' + inClass: 'IOHttpClientAdapter' + changes: + - kind: 'renameParameter' + oldName: 'onHttpClientCreate' + newName: 'createHttpClient' + + # Changes made in https://github.com/cfug/dio/pull/1803 + - title: "Migrate to 'DioException'" + date: 2023-05-15 + element: + uris: ['dio.dart', 'src/dio_exception.dart', 'src/dio_error.dart'] + class: 'DioError' + changes: + - kind: 'rename' + newName: 'DioException' + + # Changes made in https://github.com/cfug/dio/pull/1803 + - title: "Migrate to 'DioExceptionType'" + date: 2023-05-15 + element: + uris: ['dio.dart', 'src/dio_exception.dart', 'src/dio_error.dart'] + class: 'DioErrorType' + changes: + - kind: 'rename' + newName: 'DioExceptionType' + + # Changes made in https://github.com/cfug/dio/pull/1903 + - title: "Migrate to 'MultipartFile.fromStream'" + date: 2023-06-25 + element: + uris: ['dio.dart', 'src/multipart_file.dart'] + constructor: '' + inClass: 'MultipartFile' + changes: + - kind: 'rename' + newName: 'fromStream' diff --git a/plugins/native_dio_adapter/CHANGELOG.md b/plugins/native_dio_adapter/CHANGELOG.md index 077499bd1..edfcbc728 100644 --- a/plugins/native_dio_adapter/CHANGELOG.md +++ b/plugins/native_dio_adapter/CHANGELOG.md @@ -2,7 +2,7 @@ ## Unreleased -*None.* +- Provide fix suggestions for `dart fix`. ## 1.2.0 diff --git a/plugins/native_dio_adapter/lib/fix_data/fix.yaml b/plugins/native_dio_adapter/lib/fix_data/fix.yaml new file mode 100644 index 000000000..af64bb201 --- /dev/null +++ b/plugins/native_dio_adapter/lib/fix_data/fix.yaml @@ -0,0 +1,17 @@ +version: 1 + +transforms: + # Changes made in https://github.com/cfug/dio/pull/2040 + - title: "Migrate to create configuration" + date: 2023-11-25 + element: + uris: ['native_dio_adapter.dart', 'src/native_adapter.dart'] + constructor: '' + inClass: 'NativeAdapter' + changes: + - kind: 'renameParameter' + oldName: 'androidCronetEngine' + newName: 'createCronetEngine' + - kind: 'renameParameter' + oldName: 'cupertinoConfiguration' + newName: 'createCupertinoConfiguration'