Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions apps/dart_quotes/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ environment:
resolution: workspace

dependencies:
cloud_firestore: ^5.4.1
cloud_firestore: ^6.4.0
dart_firebase_admin: ^0.4.1
firebase_auth: ^5.2.1
firebase_core: ^3.4.1
firebase_auth: ^6.5.0
firebase_core: ^4.8.0
jaspr: ^0.23.0
jaspr_router: ^0.8.0

Expand Down
2 changes: 1 addition & 1 deletion examples/backend_serverpod/example_client/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,4 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.6.0 <4.0.0"
dart: ">=3.8.0 <4.0.0"
2 changes: 1 addition & 1 deletion examples/flutter_embedding/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ environment:
resolution: workspace

dependencies:
firebase_core: ^3.4.1
firebase_core: ^4.8.0
flutter:
sdk: flutter
flutter_riverpod: ^3.0.0
Expand Down
6 changes: 3 additions & 3 deletions examples/flutter_plugin_interop/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ environment:
resolution: workspace

dependencies:
cloud_firestore: ^5.4.1
firebase_auth: ^5.2.1
firebase_core: ^3.4.1
cloud_firestore: ^6.4.0
firebase_auth: ^6.5.0
firebase_core: ^4.8.0
jaspr: ^0.23.0
shared_preferences: ^2.3.2

Expand Down
4 changes: 4 additions & 0 deletions packages/jaspr/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Unreleased patch

- Support `analyzer` `^13.0.0`.

## 0.23.1

- Fixed expression compilation when debugging a client-side application with an AOT installed CLI.
Expand Down
2 changes: 1 addition & 1 deletion packages/jaspr_builder/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ topics:
- build-runner

dependencies:
analyzer: ^10.0.0
analyzer: ^13.0.0
build: ^4.0.0
collection: ^1.15.0
dart_style: ^3.0.0
Expand Down
2 changes: 1 addition & 1 deletion packages/jaspr_cli/lib/src/helpers/proxy_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ mixin ProxyHelper on BaseCommand {
}

if (res.statusCode == 404 && redirectNotFound && path.extension(req.url.path).isEmpty) {
return webdevHandler(
return await webdevHandler(
Request(
req.method,
req.requestedUri.replace(path: '/'),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:math';

import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:io/ansi.dart';

Expand Down Expand Up @@ -283,8 +284,8 @@ class BuilderVisitor extends RecursiveAstVisitor<void> {
@override
void visitBlockFunctionBody(BlockFunctionBody node) {
if (node.parent case FunctionExpression(
parent: NamedExpression(
name: Label(label: SimpleIdentifier(name: 'builder')),
parent: NamedArgument(
name: Token(lexeme: 'builder'),
parent: ArgumentList(
parent: MethodInvocation(
methodName: SimpleIdentifier(
Expand All @@ -304,8 +305,8 @@ class BuilderVisitor extends RecursiveAstVisitor<void> {
}

if (node.parent case FunctionExpression(
parent: NamedExpression(
name: Label(label: SimpleIdentifier(name: 'builder')),
parent: NamedArgument(
name: Token(lexeme: 'builder'),
parent: ArgumentList(parent: final MethodInvocation m),
),
)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,10 @@ class ComponentFactoryMigration implements Migration {
for (final (node, arguments) in fragments) {
builder.replace(node.offset, node.length, 'Component.fragment');
final childrenArg =
arguments.arguments
.where((arg) => arg is NamedExpression && arg.name.label.name == 'children')
.firstOrNull
as NamedExpression?;
arguments.arguments.where((arg) => arg is NamedArgument && arg.name.lexeme == 'children').firstOrNull
as NamedArgument?;
if (childrenArg != null) {
final end = childrenArg.expression.offset;
final end = childrenArg.argumentExpression.offset;
builder.delete(childrenArg.name.offset, end - childrenArg.name.offset);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ class HelperVisitor extends RecursiveAstVisitor<void> {
if (args.arguments.isEmpty) return false;
if (args.arguments.length == 1) return true;
if (args.arguments.length == 2) {
final named = args.arguments.whereType<NamedExpression>().toList();
return named.length == 1 && named.first.name.label.name == 'key';
final named = args.arguments.whereType<NamedArgument>().toList();
return named.length == 1 && named.first.name.lexeme == 'key';
}
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/jaspr_cli/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ executables:
jaspr:

dependencies:
analyzer: ^10.0.0
analyzer: ^13.0.0
ansi_styles: ^0.3.2
args: ^2.3.0
async: ^2.13.0
Expand Down
7 changes: 4 additions & 3 deletions packages/jaspr_cli/test/integration/variants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import 'file_matchers.dart';
final allVariants = [
for (var mode in RenderingMode.values)
for (var routing in RoutingOption.values)
for (var flutter in FlutterOption.values)
for (var backend in BackendOption.valuesFor(mode))
TestVariant(mode: mode, routing: routing, flutter: flutter, backend: backend),
if (mode != RenderingMode.client || routing != RoutingOption.multiPage)
for (var flutter in FlutterOption.values)
for (var backend in BackendOption.valuesFor(mode))
TestVariant(mode: mode, routing: routing, flutter: flutter, backend: backend),
];

class TestVariant {
Expand Down
4 changes: 4 additions & 0 deletions packages/jaspr_lints/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Unreleased patch

- Support `analyzer` `^13.0.0`.

## 0.7.1

- Fixed stack overflow error when analyzing cyclic dependencies.
Expand Down
21 changes: 10 additions & 11 deletions packages/jaspr_lints/lib/src/assists/css_assist.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,17 @@ class AddStyles extends ResolvedCorrectionProducer {
return;
}

final idArg = argumentList.arguments
.whereType<NamedExpression>()
.where((e) => e.name.label.name == 'id')
.firstOrNull;
final idVal = idArg?.expression is StringLiteral ? (idArg!.expression as StringLiteral).stringValue : null;
final idArg = argumentList.arguments.whereType<NamedArgument>().where((e) => e.name.lexeme == 'id').firstOrNull;
final idVal = idArg?.argumentExpression is StringLiteral
? (idArg!.argumentExpression as StringLiteral).stringValue
: null;

final classesArg = argumentList.arguments
.whereType<NamedExpression>()
.where((e) => e.name.label.name == 'classes')
.whereType<NamedArgument>()
.where((e) => e.name.lexeme == 'classes')
.firstOrNull;
final classesVal = classesArg?.expression is StringLiteral
? (classesArg!.expression as StringLiteral).stringValue?.split(' ').first
final classesVal = classesArg?.argumentExpression is StringLiteral
? (classesArg!.argumentExpression as StringLiteral).stringValue?.split(' ').first
: null;

final styles = comp.$1.body.childEntities
Expand Down Expand Up @@ -98,12 +97,12 @@ class AddStyles extends ResolvedCorrectionProducer {

if (idVal == null && classesVal == null) {
if (classesArg != null) {
builder.addInsertion(classesArg.expression.offset, (edit) {
builder.addInsertion(classesArg.argumentExpression.offset, (edit) {
edit.write("'");
edit.addSimpleLinkedEdit('className', 'myclass');
edit.write(' \${');
});
builder.addInsertion(classesArg.expression.end, (edit) {
builder.addInsertion(classesArg.argumentExpression.end, (edit) {
edit.write("}'");
});
} else {
Expand Down
10 changes: 5 additions & 5 deletions packages/jaspr_lints/lib/src/assists/tree_assist.dart
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ class RemoveComponent extends ResolvedCorrectionProducer {

final children = <AstNode>[
for (final arg in node.argumentList.arguments)
if (arg is NamedExpression)
if (arg.name.label.name == 'child' && isComponentType(arg.staticType))
arg.expression
else if (arg.name.label.name == 'children' && arg.expression is ListLiteral)
...(arg.expression as ListLiteral).elements
if (arg is NamedArgument)
if (arg.name.lexeme == 'child' && isComponentType(arg.argumentExpression.staticType))
arg.argumentExpression
else if (arg.name.lexeme == 'children' && arg.argumentExpression is ListLiteral)
...(arg.argumentExpression as ListLiteral).elements
else
...[]
else if (arg is ListLiteral)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ class _HtmlComponentVisitor extends SimpleAstVisitor<void> {
}
if (node.constructorName.name?.name == 'element') {
final tag = node.argumentList.arguments
.whereType<NamedExpression>()
.where((n) => n.name.label.name == 'tag')
.map((n) => n.expression)
.whereType<NamedArgument>()
.where((n) => n.name.lexeme == 'tag')
.map((n) => n.argumentExpression)
.whereType<SimpleStringLiteral>()
.firstOrNull
?.value;
Expand Down Expand Up @@ -90,9 +90,9 @@ class ConvertHtmlComponentFix extends ResolvedCorrectionProducer {
Future<void> compute(ChangeBuilder builder) async {
if (node case ConstructorName(parent: final InstanceCreationExpression node)) {
final tag = node.argumentList.arguments
.whereType<NamedExpression>()
.where((n) => n.name.label.name == 'tag')
.map((n) => n.expression)
.whereType<NamedArgument>()
.where((n) => n.name.lexeme == 'tag')
.map((n) => n.argumentExpression)
.whereType<SimpleStringLiteral>()
.firstOrNull
?.value;
Expand All @@ -103,8 +103,8 @@ class ConvertHtmlComponentFix extends ResolvedCorrectionProducer {

await builder.addDartFileEdit(file, (builder) {
for (final argument in node.argumentList.arguments) {
if (argument is NamedExpression) {
final name = argument.name.label.name;
if (argument is NamedArgument) {
final name = argument.name.lexeme;
if (name == 'tag') {
int end;
if (argument.endToken.next case final next? when next.lexeme == ',') {
Expand All @@ -114,7 +114,7 @@ class ConvertHtmlComponentFix extends ResolvedCorrectionProducer {
}
builder.addDeletion(SourceRange(argument.offset, end - argument.offset));
} else if (name == 'children') {
final end = argument.name.endToken.next?.offset ?? argument.end;
final end = argument.argumentExpression.offset;
builder.addDeletion(SourceRange(argument.name.offset, end - argument.name.offset));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class _HtmlComponentVisitor extends SimpleAstVisitor<void> {
for (final argument in node.argumentList.arguments) {
if (argument is ListLiteral && isComponentListType(argument.staticType)) {
childrenArg = argument;
} else if (childrenArg != null && argument is NamedExpression) {
} else if (childrenArg != null && argument is NamedArgument) {
violatesLint = true;
}
}
Expand Down
14 changes: 7 additions & 7 deletions packages/jaspr_lints/lib/src/rules/styles_ordering_rule.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ class _StylesVisitor extends SimpleAstVisitor<void> {
}
}

static Expression? checkOrder(NodeList<Expression> args, List<String?> params) {
static Argument? checkOrder(NodeList<Argument> args, List<String?> params) {
int lastSeenParam = -1;

for (final argument in args) {
if (argument is! NamedExpression) {
if (argument is! NamedArgument) {
continue;
}
final paramIndex = params.indexOf(argument.name.label.name);
final paramIndex = params.indexOf(argument.name.lexeme);
if (paramIndex == -1) {
continue;
}
Expand Down Expand Up @@ -119,7 +119,7 @@ class OrderStylesFix extends ResolvedCorrectionProducer {

@override
Future<void> compute(ChangeBuilder builder) async {
if (node case NamedExpression(parent: final ArgumentList arguments)) {
if (node case NamedArgument(parent: final ArgumentList arguments)) {
if (arguments.parent case final InstanceCreationExpression node) {
final constructor = node.constructorName.element;
if (constructor == null) {
Expand Down Expand Up @@ -148,7 +148,7 @@ class OrderStylesFix extends ResolvedCorrectionProducer {
}
}

Future<void> _sortStyles(ChangeBuilder builder, NodeList<Expression> arguments, List<String?> params) async {
Future<void> _sortStyles(ChangeBuilder builder, NodeList<Argument> arguments, List<String?> params) async {
await builder.addDartFileEdit(file, (builder) {
final start = arguments.beginToken!.offset;
final end = arguments.endToken!.end;
Expand All @@ -161,8 +161,8 @@ class OrderStylesFix extends ResolvedCorrectionProducer {

final args = [...arguments]
..sort((a, b) {
if (a is NamedExpression && b is NamedExpression) {
return params.indexOf(a.name.label.name).compareTo(params.indexOf(b.name.label.name));
if (a is NamedArgument && b is NamedArgument) {
return params.indexOf(a.name.lexeme).compareTo(params.indexOf(b.name.lexeme));
}
return 0;
});
Expand Down
8 changes: 3 additions & 5 deletions packages/jaspr_lints/lib/src/utils/scope_tree.dart
Original file line number Diff line number Diff line change
Expand Up @@ -349,16 +349,14 @@ class ScopeTreeNode {

final libConfigurations = configuration.where(
(c) =>
c.name.components.length == 3 &&
c.name.components[0].name == 'dart' &&
c.name.components[1].name == 'library',
c.name.tokens.length == 5 && c.name.tokens[0].lexeme == 'dart' && c.name.tokens[2].lexeme == 'library',
);

final clientConfiguration = libConfigurations
.where((c) => clientLibs.contains(c.name.components.last.name))
.where((c) => clientLibs.contains(c.name.tokens.last.lexeme))
.firstOrNull;
final serverConfiguration = libConfigurations
.where((c) => serverLibs.contains(c.name.components.last.name))
.where((c) => serverLibs.contains(c.name.tokens.last.lexeme))
.firstOrNull;

final baseLib = getBaseLibraryForDirective(directive);
Expand Down
4 changes: 2 additions & 2 deletions packages/jaspr_lints/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ resolution: workspace

dependencies:
analysis_server_plugin: ^0.3.0
analyzer: ^10.0.0
analyzer: ^13.0.0
analyzer_plugin: any
dart_data_home: ^0.1.0
path: ^1.9.0
yaml: ^3.1.2

dev_dependencies:
analyzer_testing: ^0.1.9
analyzer_testing: ^0.2.5
test: ^1.29.0
test_reflective_loader: ^0.4.0
Loading
Loading