Skip to content

Commit

Permalink
Merge pull request #3796 from rrousselGit:support-stable
Browse files Browse the repository at this point in the history
Support stable
  • Loading branch information
rrousselGit authored Oct 22, 2024
2 parents 305b92d + 1944682 commit 2876c7f
Show file tree
Hide file tree
Showing 29 changed files with 64 additions and 36 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ jobs:
strategy:
matrix:
channel:
# Waiting for WidgetStateProperty to be stable
# - stable
- stable
- master
package_path:
- examples/counter
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/riverpod_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
matrix:
channel:
- master
- stable
package_path:
- packages/riverpod_analyzer_utils
- packages/riverpod_analyzer_utils_tests
Expand Down
2 changes: 1 addition & 1 deletion examples/counter/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies:

dev_dependencies:
build_runner: ^2.3.3
custom_lint: ^0.6.5
custom_lint: ^0.6.0
flutter_test:
sdk: flutter
freezed: ^2.3.2
Expand Down
2 changes: 1 addition & 1 deletion examples/marvel/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dependencies:

dev_dependencies:
build_runner: ^2.0.0
custom_lint: ^0.6.5
custom_lint: ^0.6.0
flutter_test:
sdk: flutter
freezed: ^2.1.0
Expand Down
2 changes: 1 addition & 1 deletion examples/pub/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies:

dev_dependencies:
build_runner: ^2.0.0
custom_lint: ^0.6.5
custom_lint: ^0.6.0
flutter_test:
sdk: flutter
freezed: ^2.1.0
Expand Down
2 changes: 1 addition & 1 deletion examples/random_number/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies:
mockito: ^5.0.13

dev_dependencies:
custom_lint: ^0.6.5
custom_lint: ^0.6.0
flutter_lints: ^1.0.0
flutter_test:
sdk: flutter
Expand Down
2 changes: 1 addition & 1 deletion examples/stackoverflow/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies:

dev_dependencies:
build_runner: ^2.0.0
custom_lint: ^0.6.5
custom_lint: ^0.6.0
flutter_test:
sdk: flutter
freezed: ^2.1.0
Expand Down
2 changes: 1 addition & 1 deletion examples/todos/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies:

dev_dependencies:
build_runner: ^2.0.0
custom_lint: ^0.6.5
custom_lint: ^0.6.0
flutter_test:
sdk: flutter
riverpod_lint:
Expand Down
2 changes: 1 addition & 1 deletion packages/riverpod/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies:
state_notifier: ">=0.7.2 <2.0.0"

dev_dependencies:
analyzer: ">=5.12.0 <7.0.0"
analyzer: ^6.7.0
expect_error: ^1.0.0
mockito: ^5.0.0
test: ^1.16.0
Expand Down
2 changes: 1 addition & 1 deletion packages/riverpod/pubspec_overrides.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
dependency_overrides:
# necessary for mockito
analyzer: ^6.0.0
analyzer: ^6.7.0
7 changes: 6 additions & 1 deletion packages/riverpod_analyzer_utils/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## Unreleased patch

- Support analyzer >=6.7.0 <7.0.0
This should make it compatible with Flutter's stable channel.

## 0.5.5 - 2024-10-12

Bumped minimum analyzer to 6.9.0
Expand All @@ -22,7 +27,7 @@ Bump custom_lint

- **Breaking** `LegacyProviderDeclarationElement.providerType` is now nullable.
- Fix crash when parsing classes with a `ProviderBase` field.

## 0.4.3 - 2023-10-28

- `GeneratorProviderDeclaration.createdTypeDisplayString` now always
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ abstract class RefInvocation extends RiverpodAst
final functionOwner = function.staticElement
.cast<MethodElement>()
?.declaration
.enclosingElement3;
// ignore: deprecated_member_use, necessary to support older versions of analyzer
.enclosingElement;

if (functionOwner == null ||
// Since Ref is sealed, checking that the function is from the package:riverpod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ abstract class WidgetRefInvocation extends RiverpodAst
final functionOwner = function.staticElement
.cast<MethodElement>()
?.declaration
.enclosingElement3;
// ignore: deprecated_member_use, necessary to support older versions of analyzer
.enclosingElement;

if (functionOwner == null ||
// Since Ref is sealed, checking that the function is from the package:riverpod
Expand Down
4 changes: 2 additions & 2 deletions packages/riverpod_analyzer_utils/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ environment:
sdk: ">=3.0.0 <4.0.0"

dependencies:
analyzer: ^6.9.0
analyzer: ^6.7.0
collection: ^1.16.0
crypto: ^3.0.2
custom_lint_core: ^0.6.5
custom_lint_core: ^0.6.0
freezed_annotation: ^2.2.0
meta: ^1.7.0
path: ^1.8.0
Expand Down
2 changes: 1 addition & 1 deletion packages/riverpod_analyzer_utils_tests/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ environment:
sdk: ">=2.18.0 <4.0.0"

dependencies:
analyzer: ">=5.12.0 <7.0.0"
analyzer: ^6.7.0
collection: ^1.16.0
freezed_annotation: ^2.2.0
meta: ^1.7.0
Expand Down
5 changes: 5 additions & 0 deletions packages/riverpod_generator/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## Unreleased 2.6.1

- Support analyzer >=6.7.0 <7.0.0
This should make it compatible with Flutter's stable channel.

## 2.6.0 - 2024-10-20

- Deprecated the generated `Ref` subclasses.
Expand Down
2 changes: 1 addition & 1 deletion packages/riverpod_generator/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ environment:
sdk: ">=2.17.0 <4.0.0"

dependencies:
analyzer: ^6.5.0
analyzer: ^6.7.0
build: ^2.0.0
build_config: ^1.0.0
collection: ^1.15.0
Expand Down
5 changes: 4 additions & 1 deletion packages/riverpod_graph/lib/src/analyze.dart
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,10 @@ class _ProviderName {
/// Returns the name of the provider.
_ProviderName _displayNameForProvider(VariableElement provider) {
final providerName = provider.name;
final enclosingElementName = provider.enclosingElement3?.displayName;
final enclosingElementName = provider
// ignore: deprecated_member_use, necessary to support older versions of analyzer
.enclosingElement
?.displayName;
return _ProviderName(
providerName: providerName,
enclosingElementName: enclosingElementName ?? '',
Expand Down
2 changes: 1 addition & 1 deletion packages/riverpod_graph/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ environment:
sdk: ">=2.15.0 <4.0.0"

dependencies:
analyzer: "6.9.0"
analyzer: ^6.7.0
args: ^2.4.0
collection: ^1.0.0
path: ^1.8.2
Expand Down
5 changes: 5 additions & 0 deletions packages/riverpod_lint/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## Unreleased 2.6.1

- Support analyzer >=6.7.0 <7.0.0
This should make it compatible with Flutter's stable channel.

## 2.4.0 - 2024-10-20

- `functional_ref` and its quick-fix now expect:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,10 @@ class _ReplacementEditBuilder extends RecursiveAstVisitor<void> {
}
final element = node.staticElement;
if (element is ExecutableElement &&
element.enclosingElement3 == widgetClassElement &&
element
// ignore: deprecated_member_use, necessary to support older versions of analyzer
.enclosingElement ==
widgetClassElement &&
!elementsToMove.contains(element)) {
final offset = node.offset;
final qualifier =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,10 @@ class _ReplacementEditBuilder extends RecursiveAstVisitor<void> {
}
final element = node.staticElement;
if (element is ExecutableElement &&
element.enclosingElement3 == widgetClassElement &&
element
// ignore: deprecated_member_use, necessary to support older versions of analyzer
.enclosingElement ==
widgetClassElement &&
!elementsToMove.contains(element)) {
final parent = node.parent;
if (parent is PrefixedIdentifier) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class AvoidManualProvidersAsGeneratedProviderDependency
if (dependencyElement is! GeneratorProviderDeclarationElement) {
reporter.atNode(
dependency.provider.provider ?? dependency.provider.node,
code,
_code,
);
}
}
Expand Down
16 changes: 10 additions & 6 deletions packages/riverpod_lint/lib/src/lints/provider_parameters.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,29 @@ class ProviderParameters extends RiverpodLintRule {

if (value is TypedLiteral && !value.isConst) {
// Non-const literals always return a new instance and don't override ==
reporter.atNode(value, code);
reporter.atNode(value, _code);
} else if (value is FunctionExpression) {
// provider(() => 42) is bad because a new function will always be created
reporter.atNode(value, code);
reporter.atNode(value, _code);
} else if (value is InstanceCreationExpression && !value.isConst) {
final instantiatedObject = value.constructorName.staticElement
?.applyRedirectedConstructors();

final operatorEqual =
instantiatedObject?.enclosingElement3.recursiveGetMethod('==');
final operatorEqual = instantiatedObject
// ignore: deprecated_member_use, necessary to support older versions of analyzer
?.enclosingElement
.recursiveGetMethod('==');

final isEqualFromObjectMethod = operatorEqual?.enclosingElement3
final isEqualFromObjectMethod = operatorEqual
// ignore: deprecated_member_use, necessary to support older versions of analyzer
?.enclosingElement
.safeCast<ClassElement>()
?.thisType
.isDartCoreObject;

if (operatorEqual == null || (isEqualFromObjectMethod ?? true)) {
// Doing `provider(new Class())` is bad if the class does not override ==
reporter.atNode(value, code);
reporter.atNode(value, _code);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class ScopedProvidersShouldSpecifyDependencies extends RiverpodLintRule {
if (provider is! GeneratorProviderDeclarationElement) continue;

if (!provider.isScoped) {
reporter.atNode(override.expression, code);
reporter.atNode(override.expression, _code);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/riverpod_lint/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ environment:
sdk: ">=2.17.0 <4.0.0"

dependencies:
analyzer: ^6.9.0
analyzer: ^6.7.0
analyzer_plugin: ^0.11.2
collection: ^1.16.0
custom_lint_builder: ^0.6.5
custom_lint_builder: ^0.6.0
meta: ^1.7.0
path: ^1.8.1
riverpod: 2.6.0
Expand Down
2 changes: 0 additions & 2 deletions packages/riverpod_lint/pubspec_overrides.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@ dependency_overrides:
path: ../riverpod
riverpod_analyzer_utils:
path: ../riverpod_analyzer_utils
# necessary due to outdated mockito dependency
analyzer: ^6.0.0
4 changes: 2 additions & 2 deletions packages/riverpod_lint_flutter_test/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ dependencies:

dev_dependencies:
build_runner: ^2.4.6
custom_lint: ^0.6.5
custom_lint_core: ^0.6.5
custom_lint: ^0.6.0
custom_lint_core: ^0.6.0
freezed: ^2.3.2
json_serializable: ^6.6.1
riverpod_lint:
Expand Down
2 changes: 1 addition & 1 deletion website/pubspec_overrides.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ dependency_overrides:
path: ../packages/riverpod_analyzer_utils

## Needed due to Flutter not supporting 6.0.0 yet
analyzer: ^6.0.0
analyzer: ^6.7.0
analyzer_plugin: ^0.11.3

0 comments on commit 2876c7f

Please sign in to comment.