From 358d82592c3204630234c18ad8f9df7c2c4f3cd7 Mon Sep 17 00:00:00 2001 From: woogi <38851229+fnql@users.noreply.github.com> Date: Mon, 30 Dec 2024 00:50:20 +0900 Subject: [PATCH 1/5] Fix typo in the documentation (#3896) ## Related Issues X, It's just a typo fix. ## Checklist Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (`[x]`). - [X] I have updated the `CHANGELOG.md` of the relevant packages. Changelog files must be edited under the form: ```md ## Unreleased fix/major/minor - Fix typo in the documentation ``` - [x] If this contains new features or behavior changes, I have updated the documentation to match those changes. ## Summary by CodeRabbit - **Documentation** - Fixed a typo in the Riverpod package changelog - Corrected a minor text error in the Korean documentation for hooks --------- Co-authored-by: Remi Rousselet --- .../current/concepts/about_hooks.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/i18n/ko/docusaurus-plugin-content-docs/current/concepts/about_hooks.mdx b/website/i18n/ko/docusaurus-plugin-content-docs/current/concepts/about_hooks.mdx index aab39806d..c8a2bd17c 100644 --- a/website/i18n/ko/docusaurus-plugin-content-docs/current/concepts/about_hooks.mdx +++ b/website/i18n/ko/docusaurus-plugin-content-docs/current/concepts/about_hooks.mdx @@ -38,7 +38,7 @@ Riverpod 때문에 훅(hooks)을 사용해서는 안됩니다. 오히려 훅(hoo 이상적으로 향후에 Flutter를 위해 특별히 설계된 훅(hooks)이 해결하는 문제에 대한 솔루션이 있을 것입니다. Riverpod의 provider가 "전역(Global)" 애플리케이션 상태(State)를 위한 것이라면, 훅(Hooks)은 로컬 위젯 상태를 위한 것입니다. -훅(Hooks)dms 일반적으로 상태 저장형 UI 객체를 처리하는 데 사용됩니다, +훅(Hooks)은 일반적으로 상태 저장형 UI 객체를 처리하는 데 사용됩니다, [TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html), [AnimationController](https://api.flutter.dev/flutter/animation/AnimationController-class.html). 또한 "빌더(Builder)" 패턴을 대체하는 역할도 수행할 수 있는데, From d7dffaea3ca6f7e4564dab5ef3333ec759284edf Mon Sep 17 00:00:00 2001 From: Zachary Muranaka Date: Mon, 30 Dec 2024 14:16:07 -0700 Subject: [PATCH 2/5] Fix typo in missing_provider_scope.dart (#3898) No related issue. It just fixes a typo I saw in a comment. ## Summary by CodeRabbit - **Documentation** - Fixed a minor typographical error in a code comment for the `AddProviderScope` class. --- .../riverpod_lint/lib/src/lints/missing_provider_scope.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/riverpod_lint/lib/src/lints/missing_provider_scope.dart b/packages/riverpod_lint/lib/src/lints/missing_provider_scope.dart index c401225fe..eb1fba1fb 100644 --- a/packages/riverpod_lint/lib/src/lints/missing_provider_scope.dart +++ b/packages/riverpod_lint/lib/src/lints/missing_provider_scope.dart @@ -61,7 +61,7 @@ class AddProviderScope extends DartFix { List others, ) { context.registry.addMethodInvocation((node) { - // The method is not impacte by this analysis error + // The method is not impacted by this analysis error if (!node.sourceRange.intersects(analysisError.sourceRange)) return; final changeBuilder = reporter.createChangeBuilder( From 06efa8d03b495bcc2b29f101821918169815a616 Mon Sep 17 00:00:00 2001 From: Blin Qipa Date: Wed, 8 Jan 2025 15:49:05 +0100 Subject: [PATCH 3/5] Docs typo fix (#3903) ## Related Issues Docs typo fix on `UncontrolledProviderScope`. ## Checklist ```md ## Unreleased fix/major/minor - Docs typo fix on `UncontrolledProviderScope`. (thanks to @bqubique) ``` ## Summary by CodeRabbit - **Documentation** - Minor documentation comment update for `UncontrolledProviderScope` class - Improved clarity by correcting formatting in comment text --- packages/flutter_riverpod/lib/src/framework.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/flutter_riverpod/lib/src/framework.dart b/packages/flutter_riverpod/lib/src/framework.dart index 5cd81488c..2889afbb6 100644 --- a/packages/flutter_riverpod/lib/src/framework.dart +++ b/packages/flutter_riverpod/lib/src/framework.dart @@ -269,7 +269,7 @@ class ProviderScopeState extends State { /// {@template riverpod.UncontrolledProviderScope} /// Expose a [ProviderContainer] to the widget tree. /// -/// This is what makes `ref.watch(`/`Consumer`/`ref.read` work. +/// This is what makes `ref.watch`/`Consumer`/`ref.read` work. /// {@endtemplate} @sealed class UncontrolledProviderScope extends InheritedWidget { From d50001b5e6c1a876bbd0eda0740d20853ca3e4cb Mon Sep 17 00:00:00 2001 From: Remi Rousselet Date: Wed, 8 Jan 2025 19:19:00 +0100 Subject: [PATCH 4/5] Bump dependencies (#3913) --- analysis_options.yaml | 1 + examples/marvel/analysis_options.yaml | 3 ++- packages/riverpod/pubspec.yaml | 2 +- packages/riverpod/pubspec_overrides.yaml | 2 +- packages/riverpod_analyzer_utils/CHANGELOG.md | 4 ++++ .../lib/src/riverpod_ast/ref_invocation.dart | 3 +-- .../lib/src/riverpod_ast/widget_ref_invocation.dart | 3 +-- packages/riverpod_analyzer_utils/pubspec.yaml | 2 +- packages/riverpod_analyzer_utils_tests/pubspec.yaml | 2 +- packages/riverpod_generator/CHANGELOG.md | 4 ++++ packages/riverpod_generator/pubspec.yaml | 4 ++-- packages/riverpod_graph/lib/src/analyze.dart | 5 +---- packages/riverpod_graph/pubspec.yaml | 2 +- packages/riverpod_lint/CHANGELOG.md | 4 ++++ .../src/assists/convert_to_stateful_base_widget.dart | 5 +---- .../src/assists/convert_to_stateless_base_widget.dart | 5 +---- .../lib/src/lints/provider_parameters.dart | 10 +++------- packages/riverpod_lint/pubspec.yaml | 4 ++-- .../riverpod_lint_flutter_test/pubspec_overrides.yaml | 3 +++ website/pubspec_overrides.yaml | 4 ---- 20 files changed, 35 insertions(+), 37 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index 4905ebee9..5fa2c6604 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -14,6 +14,7 @@ analyzer: # I prefer specifying a parameter on a widget even if they are unused (such as Key) # for the sake of consistency. unused_element_parameter: false + unrecognized_error_code: ignore linter: rules: diff --git a/examples/marvel/analysis_options.yaml b/examples/marvel/analysis_options.yaml index 611834f1a..0b3205522 100644 --- a/examples/marvel/analysis_options.yaml +++ b/examples/marvel/analysis_options.yaml @@ -8,4 +8,5 @@ analyzer: asset_does_not_exist: ignore # I prefer specifying a parameter on a widget even if they are unused (such as Key) # for the sake of consistency. - unused_element_parameter: false \ No newline at end of file + unused_element_parameter: false + unrecognized_error_code: ignore diff --git a/packages/riverpod/pubspec.yaml b/packages/riverpod/pubspec.yaml index 6c4c4f0cd..64bce22f8 100644 --- a/packages/riverpod/pubspec.yaml +++ b/packages/riverpod/pubspec.yaml @@ -19,7 +19,7 @@ dependencies: state_notifier: ">=0.7.2 <2.0.0" dev_dependencies: - analyzer: ^6.7.0 + analyzer: ^7.0.0 expect_error: ^1.0.0 mockito: ^5.0.0 test: ^1.16.0 diff --git a/packages/riverpod/pubspec_overrides.yaml b/packages/riverpod/pubspec_overrides.yaml index 607c9fadd..ae6e56d7d 100644 --- a/packages/riverpod/pubspec_overrides.yaml +++ b/packages/riverpod/pubspec_overrides.yaml @@ -1,3 +1,3 @@ dependency_overrides: # necessary for mockito - analyzer: ^6.7.0 + analyzer: ^7.0.0 diff --git a/packages/riverpod_analyzer_utils/CHANGELOG.md b/packages/riverpod_analyzer_utils/CHANGELOG.md index 170b918f4..d0bfc73c7 100644 --- a/packages/riverpod_analyzer_utils/CHANGELOG.md +++ b/packages/riverpod_analyzer_utils/CHANGELOG.md @@ -1,3 +1,7 @@ +## Unreleased patch + +Support latest analyzer + ## 0.5.8 - 2024-11-18 - Fixed analyzer to correctly detect nested RefInvocations when used as parameters (e.g., ref.watch(provider(ref.watch(...)))). This improves the accuracy of the analyzer's error detection for complex provider compositions. (thanks to @josh-burton) diff --git a/packages/riverpod_analyzer_utils/lib/src/riverpod_ast/ref_invocation.dart b/packages/riverpod_analyzer_utils/lib/src/riverpod_ast/ref_invocation.dart index ef82f5525..44adc4c45 100644 --- a/packages/riverpod_analyzer_utils/lib/src/riverpod_ast/ref_invocation.dart +++ b/packages/riverpod_analyzer_utils/lib/src/riverpod_ast/ref_invocation.dart @@ -21,8 +21,7 @@ abstract class RefInvocation extends RiverpodAst final functionOwner = function.staticElement .cast() ?.declaration - // ignore: deprecated_member_use, necessary to support older versions of analyzer - .enclosingElement; + .enclosingElement3; if (functionOwner == null || // Since Ref is sealed, checking that the function is from the package:riverpod diff --git a/packages/riverpod_analyzer_utils/lib/src/riverpod_ast/widget_ref_invocation.dart b/packages/riverpod_analyzer_utils/lib/src/riverpod_ast/widget_ref_invocation.dart index 63a0f0979..79b3ce5d8 100644 --- a/packages/riverpod_analyzer_utils/lib/src/riverpod_ast/widget_ref_invocation.dart +++ b/packages/riverpod_analyzer_utils/lib/src/riverpod_ast/widget_ref_invocation.dart @@ -26,8 +26,7 @@ abstract class WidgetRefInvocation extends RiverpodAst final functionOwner = function.staticElement .cast() ?.declaration - // ignore: deprecated_member_use, necessary to support older versions of analyzer - .enclosingElement; + .enclosingElement3; if (functionOwner == null || // Since Ref is sealed, checking that the function is from the package:riverpod diff --git a/packages/riverpod_analyzer_utils/pubspec.yaml b/packages/riverpod_analyzer_utils/pubspec.yaml index c49e0d1c4..8666f1fe4 100644 --- a/packages/riverpod_analyzer_utils/pubspec.yaml +++ b/packages/riverpod_analyzer_utils/pubspec.yaml @@ -10,7 +10,7 @@ environment: sdk: ">=3.0.0 <4.0.0" dependencies: - analyzer: ^6.7.0 + analyzer: ^7.0.0 collection: ^1.16.0 crypto: ^3.0.2 custom_lint_core: ^0.7.0 diff --git a/packages/riverpod_analyzer_utils_tests/pubspec.yaml b/packages/riverpod_analyzer_utils_tests/pubspec.yaml index 36c99a4bf..abbcdc592 100644 --- a/packages/riverpod_analyzer_utils_tests/pubspec.yaml +++ b/packages/riverpod_analyzer_utils_tests/pubspec.yaml @@ -6,7 +6,7 @@ environment: sdk: ">=2.18.0 <4.0.0" dependencies: - analyzer: ^6.7.0 + analyzer: ^7.0.0 collection: ^1.16.0 freezed_annotation: ^2.2.0 meta: ^1.7.0 diff --git a/packages/riverpod_generator/CHANGELOG.md b/packages/riverpod_generator/CHANGELOG.md index 925ca4ea6..d4630484a 100644 --- a/packages/riverpod_generator/CHANGELOG.md +++ b/packages/riverpod_generator/CHANGELOG.md @@ -1,3 +1,7 @@ +## Unreleased patch + +Support latest analyzer + ## 2.6.3 - 2024-11-18 - `riverpod_analyzer_utils` upgraded to `0.5.8` diff --git a/packages/riverpod_generator/pubspec.yaml b/packages/riverpod_generator/pubspec.yaml index a37b209b0..7921de7a9 100644 --- a/packages/riverpod_generator/pubspec.yaml +++ b/packages/riverpod_generator/pubspec.yaml @@ -10,7 +10,7 @@ environment: sdk: ">=2.17.0 <4.0.0" dependencies: - analyzer: ^6.7.0 + analyzer: ^7.0.0 build: ^2.0.0 build_config: ^1.0.0 collection: ^1.15.0 @@ -19,7 +19,7 @@ dependencies: path: ^1.8.0 riverpod_analyzer_utils: 0.5.8 riverpod_annotation: 2.6.1 - source_gen: ^1.2.0 + source_gen: ^2.0.0 dev_dependencies: build_runner: ^2.1.7 diff --git a/packages/riverpod_graph/lib/src/analyze.dart b/packages/riverpod_graph/lib/src/analyze.dart index 85ccd68b2..b65d298e7 100644 --- a/packages/riverpod_graph/lib/src/analyze.dart +++ b/packages/riverpod_graph/lib/src/analyze.dart @@ -683,10 +683,7 @@ class _ProviderName { /// Returns the name of the provider. _ProviderName _displayNameForProvider(VariableElement provider) { final providerName = provider.name; - final enclosingElementName = provider - // ignore: deprecated_member_use, necessary to support older versions of analyzer - .enclosingElement - ?.displayName; + final enclosingElementName = provider.enclosingElement3?.displayName; return _ProviderName( providerName: providerName, enclosingElementName: enclosingElementName ?? '', diff --git a/packages/riverpod_graph/pubspec.yaml b/packages/riverpod_graph/pubspec.yaml index dee6aa7a5..eb8efbcbe 100644 --- a/packages/riverpod_graph/pubspec.yaml +++ b/packages/riverpod_graph/pubspec.yaml @@ -11,7 +11,7 @@ environment: sdk: ">=2.15.0 <4.0.0" dependencies: - analyzer: ^6.7.0 + analyzer: ^7.0.0 args: ^2.4.0 collection: ^1.0.0 path: ^1.8.2 diff --git a/packages/riverpod_lint/CHANGELOG.md b/packages/riverpod_lint/CHANGELOG.md index 8867b6510..9c044a27d 100644 --- a/packages/riverpod_lint/CHANGELOG.md +++ b/packages/riverpod_lint/CHANGELOG.md @@ -1,3 +1,7 @@ +## Unreleased patch + +Support latest analyzer + ## 2.6.3 - 2024-11-18 - provider_dependencies now correctly detects nested ref invocations where a dependency is used as a parameter of another dependency (thanks to @josh-burton) diff --git a/packages/riverpod_lint/lib/src/assists/convert_to_stateful_base_widget.dart b/packages/riverpod_lint/lib/src/assists/convert_to_stateful_base_widget.dart index c6af2373b..8647482b9 100644 --- a/packages/riverpod_lint/lib/src/assists/convert_to_stateful_base_widget.dart +++ b/packages/riverpod_lint/lib/src/assists/convert_to_stateful_base_widget.dart @@ -291,10 +291,7 @@ class _ReplacementEditBuilder extends RecursiveAstVisitor { } final element = node.staticElement; if (element is ExecutableElement && - element - // ignore: deprecated_member_use, necessary to support older versions of analyzer - .enclosingElement == - widgetClassElement && + element.enclosingElement3 == widgetClassElement && !elementsToMove.contains(element)) { final offset = node.offset; final qualifier = diff --git a/packages/riverpod_lint/lib/src/assists/convert_to_stateless_base_widget.dart b/packages/riverpod_lint/lib/src/assists/convert_to_stateless_base_widget.dart index d4878a5e5..372d0e0d1 100644 --- a/packages/riverpod_lint/lib/src/assists/convert_to_stateless_base_widget.dart +++ b/packages/riverpod_lint/lib/src/assists/convert_to_stateless_base_widget.dart @@ -333,10 +333,7 @@ class _ReplacementEditBuilder extends RecursiveAstVisitor { } final element = node.staticElement; if (element is ExecutableElement && - element - // ignore: deprecated_member_use, necessary to support older versions of analyzer - .enclosingElement == - widgetClassElement && + element.enclosingElement3 == widgetClassElement && !elementsToMove.contains(element)) { final parent = node.parent; if (parent is PrefixedIdentifier) { diff --git a/packages/riverpod_lint/lib/src/lints/provider_parameters.dart b/packages/riverpod_lint/lib/src/lints/provider_parameters.dart index 80f4cc6ab..c16911a5b 100644 --- a/packages/riverpod_lint/lib/src/lints/provider_parameters.dart +++ b/packages/riverpod_lint/lib/src/lints/provider_parameters.dart @@ -45,14 +45,10 @@ class ProviderParameters extends RiverpodLintRule { final instantiatedObject = value.constructorName.staticElement ?.applyRedirectedConstructors(); - final operatorEqual = instantiatedObject - // ignore: deprecated_member_use, necessary to support older versions of analyzer - ?.enclosingElement - .recursiveGetMethod('=='); + final operatorEqual = + instantiatedObject?.enclosingElement3.recursiveGetMethod('=='); - final isEqualFromObjectMethod = operatorEqual - // ignore: deprecated_member_use, necessary to support older versions of analyzer - ?.enclosingElement + final isEqualFromObjectMethod = operatorEqual?.enclosingElement3 .safeCast() ?.thisType .isDartCoreObject; diff --git a/packages/riverpod_lint/pubspec.yaml b/packages/riverpod_lint/pubspec.yaml index b1e0877b6..151aa997e 100644 --- a/packages/riverpod_lint/pubspec.yaml +++ b/packages/riverpod_lint/pubspec.yaml @@ -11,8 +11,8 @@ environment: sdk: ">=2.17.0 <4.0.0" dependencies: - analyzer: ^6.7.0 - analyzer_plugin: ^0.11.2 + analyzer: ^7.0.0 + analyzer_plugin: ^0.12.0 collection: ^1.16.0 custom_lint_builder: ^0.7.0 meta: ^1.7.0 diff --git a/packages/riverpod_lint_flutter_test/pubspec_overrides.yaml b/packages/riverpod_lint_flutter_test/pubspec_overrides.yaml index 56aa97964..46fe485d4 100644 --- a/packages/riverpod_lint_flutter_test/pubspec_overrides.yaml +++ b/packages/riverpod_lint_flutter_test/pubspec_overrides.yaml @@ -14,3 +14,6 @@ dependency_overrides: path: ../riverpod_annotation riverpod_lint: path: ../riverpod_lint + + # Fix flutter_test conflict for now + test_api: ^0.7.4 \ No newline at end of file diff --git a/website/pubspec_overrides.yaml b/website/pubspec_overrides.yaml index 5b4484fd3..3d1c069a5 100644 --- a/website/pubspec_overrides.yaml +++ b/website/pubspec_overrides.yaml @@ -12,7 +12,3 @@ dependency_overrides: path: ../packages/riverpod_generator riverpod_analyzer_utils: path: ../packages/riverpod_analyzer_utils - - ## Needed due to Flutter not supporting 6.0.0 yet - analyzer: ^6.7.0 - analyzer_plugin: ^0.11.3 From d987f3d350a01cccd12e5ded8c4a4b1a4520b0ce Mon Sep 17 00:00:00 2001 From: Remi Rousselet Date: Wed, 8 Jan 2025 19:19:54 +0100 Subject: [PATCH 5/5] riverpod_analyzer_utils : 0.5.8 -> 0.5.9 riverpod_generator : 2.6.3 -> 2.6.4 riverpod_lint : 2.6.3 -> 2.6.4 --- packages/riverpod_analyzer_utils/CHANGELOG.md | 2 +- packages/riverpod_analyzer_utils/pubspec.yaml | 2 +- packages/riverpod_generator/CHANGELOG.md | 2 +- packages/riverpod_generator/pubspec.yaml | 4 ++-- packages/riverpod_lint/CHANGELOG.md | 2 +- packages/riverpod_lint/pubspec.yaml | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/riverpod_analyzer_utils/CHANGELOG.md b/packages/riverpod_analyzer_utils/CHANGELOG.md index d0bfc73c7..17d565315 100644 --- a/packages/riverpod_analyzer_utils/CHANGELOG.md +++ b/packages/riverpod_analyzer_utils/CHANGELOG.md @@ -1,4 +1,4 @@ -## Unreleased patch +## 0.5.9 - 2025-01-08 Support latest analyzer diff --git a/packages/riverpod_analyzer_utils/pubspec.yaml b/packages/riverpod_analyzer_utils/pubspec.yaml index 8666f1fe4..1b6b25573 100644 --- a/packages/riverpod_analyzer_utils/pubspec.yaml +++ b/packages/riverpod_analyzer_utils/pubspec.yaml @@ -4,7 +4,7 @@ repository: https://github.com/rrousselGit/river_pod issue_tracker: https://github.com/rrousselGit/riverpod/issues funding: - https://github.com/sponsors/rrousselGit/ -version: 0.5.8 +version: 0.5.9 environment: sdk: ">=3.0.0 <4.0.0" diff --git a/packages/riverpod_generator/CHANGELOG.md b/packages/riverpod_generator/CHANGELOG.md index d4630484a..1e7d05149 100644 --- a/packages/riverpod_generator/CHANGELOG.md +++ b/packages/riverpod_generator/CHANGELOG.md @@ -1,4 +1,4 @@ -## Unreleased patch +## 2.6.4 - 2025-01-08 Support latest analyzer diff --git a/packages/riverpod_generator/pubspec.yaml b/packages/riverpod_generator/pubspec.yaml index 7921de7a9..b39923c4f 100644 --- a/packages/riverpod_generator/pubspec.yaml +++ b/packages/riverpod_generator/pubspec.yaml @@ -1,6 +1,6 @@ name: riverpod_generator description: A code generator for Riverpod. This both simplifies the syntax empowers it, such as allowing stateful hot-reload. -version: 2.6.3 +version: 2.6.4 repository: https://github.com/rrousselGit/riverpod issue_tracker: https://github.com/rrousselGit/riverpod/issues funding: @@ -17,7 +17,7 @@ dependencies: crypto: ^3.0.2 meta: ^1.7.0 path: ^1.8.0 - riverpod_analyzer_utils: 0.5.8 + riverpod_analyzer_utils: 0.5.9 riverpod_annotation: 2.6.1 source_gen: ^2.0.0 diff --git a/packages/riverpod_lint/CHANGELOG.md b/packages/riverpod_lint/CHANGELOG.md index 9c044a27d..9d9294c27 100644 --- a/packages/riverpod_lint/CHANGELOG.md +++ b/packages/riverpod_lint/CHANGELOG.md @@ -1,4 +1,4 @@ -## Unreleased patch +## 2.6.4 - 2025-01-08 Support latest analyzer diff --git a/packages/riverpod_lint/pubspec.yaml b/packages/riverpod_lint/pubspec.yaml index 151aa997e..612e09e3b 100644 --- a/packages/riverpod_lint/pubspec.yaml +++ b/packages/riverpod_lint/pubspec.yaml @@ -1,6 +1,6 @@ name: riverpod_lint description: Riverpod_lint is a developer tool for users of Riverpod, designed to help stop common issues and simplify repetitive tasks. -version: 2.6.3 +version: 2.6.4 homepage: https://riverpod.dev repository: https://github.com/rrousselGit/river_pod issue_tracker: https://github.com/rrousselGit/riverpod/issues @@ -18,7 +18,7 @@ dependencies: meta: ^1.7.0 path: ^1.8.1 riverpod: 2.6.1 - riverpod_analyzer_utils: 0.5.8 + riverpod_analyzer_utils: 0.5.9 source_span: ^1.8.0 yaml: ^3.1.1