Skip to content

Commit

Permalink
Update to package:lints v3 (#2261)
Browse files Browse the repository at this point in the history
  • Loading branch information
parlough authored Nov 2, 2023
1 parent 36f943e commit 927c70e
Show file tree
Hide file tree
Showing 11 changed files with 55 additions and 87 deletions.
2 changes: 1 addition & 1 deletion dwds/lib/src/debugging/remote_debugger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart';

class TargetCrashedEvent extends WipEvent {
TargetCrashedEvent(Map<String, dynamic> json) : super(json);
TargetCrashedEvent(super.json);
}

/// A generic debugger used in remote debugging.
Expand Down
2 changes: 2 additions & 0 deletions dwds/lib/src/utilities/conversions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// BSD-style license that can be found in the LICENSE file.

/// Functions for converting between the different object references we use.
library;

import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart';

/// Convert [argument] to a form usable in WIP evaluation calls.
Expand Down
7 changes: 5 additions & 2 deletions dwds/lib/src/utilities/objects.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

/// A library for WebKit mirror objects and support code. These probably should
/// get migrated into webkit_inspection_protocol over time.
/// A library for WebKit mirror objects and support code.
///
/// These probably should get migrated into
/// `package:webkit_inspection_protocol` over time.
library;

import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart';

Expand Down
2 changes: 1 addition & 1 deletion dwds/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ dev_dependencies:
frontend_server_common:
path: ../frontend_server_common
js: ^0.6.4
lints: ^2.0.0
lints: ^3.0.0
pubspec_parse: ^1.2.0
puppeteer: ^3.0.0
stream_channel: ^2.1.0
Expand Down
5 changes: 2 additions & 3 deletions dwds/test/dart_uri_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
@TestOn('vm')
@Timeout(Duration(minutes: 2))

import 'package:dwds/asset_reader.dart';
import 'package:dwds/src/utilities/dart_uri.dart';
import 'package:path/path.dart' as p;
import 'package:test/test.dart';
Expand All @@ -15,7 +14,7 @@ import 'fixtures/fakes.dart';
import 'fixtures/utilities.dart';

class TestStrategy extends FakeStrategy {
TestStrategy(AssetReader assetReader) : super(assetReader);
TestStrategy(super.assetReader);

@override
String? serverPathForAppUri(String appUrl) {
Expand All @@ -34,7 +33,7 @@ class TestStrategy extends FakeStrategy {
}

class G3TestStrategy extends FakeStrategy {
G3TestStrategy(AssetReader assetReader) : super(assetReader);
G3TestStrategy(super.assetReader);

@override
String? g3RelativePath(String absolutePath) =>
Expand Down
5 changes: 1 addition & 4 deletions dwds/test/debugger_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
@Timeout(Duration(minutes: 2))
import 'dart:async';

import 'package:dwds/asset_reader.dart';
import 'package:dwds/src/debugging/debugger.dart';
import 'package:dwds/src/debugging/frame_computer.dart';
import 'package:dwds/src/debugging/inspector.dart';
Expand All @@ -30,9 +29,7 @@ late Locations locations;
late SkipLists skipLists;

class TestStrategy extends FakeStrategy {
TestStrategy(
AssetReader assetReader,
) : super(assetReader);
TestStrategy(super.assetReader);

@override
Future<String> moduleForServerPath(String entrypoint, String appUri) async =>
Expand Down
2 changes: 2 additions & 0 deletions dwds/test/fixtures/debugger_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// BSD-style license that can be found in the LICENSE file.

/// Contains hard-coded test data usable for tests.
library;

import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart';

// ignore_for_file: prefer_single_quotes
Expand Down
9 changes: 4 additions & 5 deletions dwds/test/fixtures/fakes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -323,14 +323,13 @@ class FakeStrategy extends LoadStrategy {
final BuildSettings _buildSettings;

FakeStrategy(
AssetReader assetReader, {
String? packageConfigPath,
super.assetReader, {
super.packageConfigPath,
BuildSettings? buildSettings,
}) : _buildSettings = buildSettings ??
}) : _buildSettings = buildSettings ??
TestBuildSettings.dart(
appEntrypoint: Uri.parse('package:myapp/main.dart'),
),
super(assetReader, packageConfigPath: packageConfigPath);
);

@override
Future<String> bootstrapFor(String entrypoint) async => 'dummy_bootstrap';
Expand Down
101 changes: 35 additions & 66 deletions dwds/test/fixtures/utilities.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import 'package:build_daemon/client.dart';
import 'package:build_daemon/constants.dart';
import 'package:build_daemon/data/server_log.dart';
import 'package:dds/devtools_server.dart';
import 'package:dwds/asset_reader.dart';
import 'package:dwds/src/config/tool_configuration.dart';
import 'package:dwds/src/loaders/strategy.dart';
import 'package:dwds/src/servers/devtools.dart';
Expand Down Expand Up @@ -117,33 +116,20 @@ class TestDebugSettings extends DebugSettings {

const TestDebugSettings.noDevTools() : super(enableDevToolsLaunch: false);

const TestDebugSettings._({
required bool enableDebugging,
required bool enableDebugExtension,
required bool useSseForDebugBackend,
required bool useSseForDebugProxy,
required bool useSseForInjectedClient,
required bool spawnDds,
required bool enableDevToolsLaunch,
required bool launchDevToolsInNewWindow,
required bool emitDebugEvents,
required DevToolsLauncher? devToolsLauncher,
required ExpressionCompiler? expressionCompiler,
required UrlEncoder? urlEncoder,
}) : super(
enableDebugging: enableDebugging,
enableDebugExtension: enableDebugExtension,
useSseForDebugBackend: useSseForDebugBackend,
useSseForDebugProxy: useSseForDebugProxy,
useSseForInjectedClient: useSseForInjectedClient,
spawnDds: spawnDds,
enableDevToolsLaunch: enableDevToolsLaunch,
launchDevToolsInNewWindow: launchDevToolsInNewWindow,
emitDebugEvents: emitDebugEvents,
devToolsLauncher: devToolsLauncher,
expressionCompiler: expressionCompiler,
urlEncoder: urlEncoder,
);
TestDebugSettings._({
required super.enableDebugging,
required super.enableDebugExtension,
required super.useSseForDebugBackend,
required super.useSseForDebugProxy,
required super.useSseForInjectedClient,
required super.spawnDds,
required super.enableDevToolsLaunch,
required super.launchDevToolsInNewWindow,
required super.emitDebugEvents,
required super.devToolsLauncher,
required super.expressionCompiler,
required super.urlEncoder,
});

TestDebugSettings copyWith({
bool? enableDebugging,
Expand Down Expand Up @@ -177,20 +163,16 @@ class TestDebugSettings extends DebugSettings {

class TestAppMetadata extends AppMetadata {
const TestAppMetadata({
bool isInternalBuild = false,
String? workspaceName,
String hostname = 'localhost',
}) : super(
isInternalBuild: isInternalBuild,
workspaceName: workspaceName,
hostname: hostname,
);
super.isInternalBuild,
super.workspaceName,
super.hostname = 'localhost',
});

TestAppMetadata copyWith({
bool? isFlutterApp,
bool? isInternalBuild,
String? workspaceName,
String? hostname = 'localhost',
String? hostname,
}) =>
TestAppMetadata(
isInternalBuild: isInternalBuild ?? this.isInternalBuild,
Expand All @@ -205,24 +187,20 @@ class TestAppMetadata extends AppMetadata {

class TestToolConfiguration extends ToolConfiguration {
TestToolConfiguration.withDefaultLoadStrategy({
TestAppMetadata appMetadata = const TestAppMetadata.externalApp(),
TestDebugSettings debugSettings = const TestDebugSettings.noDevTools(),
TestAppMetadata super.appMetadata = const TestAppMetadata.externalApp(),
TestDebugSettings super.debugSettings =
const TestDebugSettings.noDevTools(),
TestBuildSettings buildSettings = const TestBuildSettings.dart(),
}) : super(
loadStrategy: TestStrategy(const FakeAssetReader(), buildSettings),
debugSettings: debugSettings,
appMetadata: appMetadata,
);

TestToolConfiguration.withLoadStrategy({
TestAppMetadata appMetadata = const TestAppMetadata.externalApp(),
TestDebugSettings debugSettings = const TestDebugSettings.noDevTools(),
required LoadStrategy loadStrategy,
}) : super(
loadStrategy: loadStrategy,
debugSettings: debugSettings,
appMetadata: appMetadata,
);
TestAppMetadata super.appMetadata = const TestAppMetadata.externalApp(),
TestDebugSettings super.debugSettings =
const TestDebugSettings.noDevTools(),
required super.loadStrategy,
});
}

void setGlobalsForTesting({
Expand All @@ -242,12 +220,9 @@ void setGlobalsForTestingFromBuild({

class TestStrategy extends FakeStrategy {
TestStrategy(
AssetReader assetReader,
super.assetReader,
BuildSettings buildSettings,
) : super(
assetReader,
buildSettings: buildSettings,
);
) : super(buildSettings: buildSettings);

@override
String serverPathForAppUri(String appUri) {
Expand Down Expand Up @@ -290,16 +265,11 @@ class TestSettings {
/// App build settings for tests.
class TestBuildSettings extends BuildSettings {
const TestBuildSettings({
Uri? appEntrypoint,
bool canaryFeatures = false,
bool isFlutterApp = true,
List<String> experiments = const <String>[],
}) : super(
appEntrypoint: appEntrypoint,
canaryFeatures: canaryFeatures,
isFlutterApp: isFlutterApp,
experiments: experiments,
);
super.appEntrypoint,
super.canaryFeatures,
super.isFlutterApp,
super.experiments,
});

const TestBuildSettings.dart({Uri? appEntrypoint})
: this(appEntrypoint: appEntrypoint, isFlutterApp: false);
Expand All @@ -324,12 +294,11 @@ class TestBuildSettings extends BuildSettings {
class TestCompilerOptions extends CompilerOptions {
TestCompilerOptions({
required NullSafety nullSafety,
required bool canaryFeatures,
required super.canaryFeatures,
required List<String> experiments,
}) : super(
moduleFormat: 'amd',
soundNullSafety: nullSafety == NullSafety.sound,
canaryFeatures: canaryFeatures,
experiments: const <String>[],
);
}
5 changes: 1 addition & 4 deletions dwds/test/location_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

@Timeout(Duration(minutes: 2))

import 'package:dwds/asset_reader.dart';
import 'package:dwds/src/debugging/location.dart';
import 'package:dwds/src/utilities/dart_uri.dart';
import 'package:test/test.dart';
Expand Down Expand Up @@ -188,9 +187,7 @@ const _serverPath = 'web/main.dart';
const _sourceMapPath = 'packages/module.js.map';

class MockLoadStrategy extends FakeStrategy {
MockLoadStrategy(
AssetReader assetReader,
) : super(assetReader);
MockLoadStrategy(super.assetReader);

@override
Future<String?> moduleForServerPath(
Expand Down
2 changes: 1 addition & 1 deletion test_common/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ dependencies:
test: ^1.21.1

dev_dependencies:
lints: ^2.0.0
lints: ^3.0.0
pubspec_parse: ^1.2.2
pub_semver: ^2.1.1

0 comments on commit 927c70e

Please sign in to comment.