Skip to content

Commit e17ec62

Browse files
authored
Add recommended lints to DWDS (#1646)
1 parent 06ea298 commit e17ec62

File tree

6 files changed

+15
-13
lines changed

6 files changed

+15
-13
lines changed

dwds/analysis_options.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# This file contains the analysis options used for code in the webdev
22
# repository.
33

4+
include: package:lints/recommended.yaml
5+
46
analyzer:
57
exclude:
68
# Ignore generated files
@@ -9,4 +11,3 @@ analyzer:
911
linter:
1012
rules:
1113
- prefer_final_locals
12-

dwds/lib/src/handlers/dev_handler.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -613,12 +613,12 @@ extension<T> on Stream<T> {
613613
: StreamController<T>(sync: true);
614614

615615
StreamSubscription<T> subscription;
616-
Timer _gapTimer;
616+
Timer gapTimer;
617617
controller.onListen = () {
618618
subscription = listen((e) {
619619
controller.add(e);
620-
_gapTimer?.cancel();
621-
_gapTimer = Timer(gap, () {
620+
gapTimer?.cancel();
621+
gapTimer = Timer(gap, () {
622622
subscription.cancel();
623623
controller.close();
624624
});

dwds/lib/src/servers/extension_backend.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ class ExtensionBackend {
3737
Future<void> _closed;
3838

3939
ExtensionBackend._(
40-
SocketHandler _socketHandler, this.hostname, this.port, this._server)
41-
: connections = _socketHandler.connections;
40+
SocketHandler socketHandler, this.hostname, this.port, this._server)
41+
: connections = socketHandler.connections;
4242

4343
// Starts the backend on an open port.
4444
static Future<ExtensionBackend> start(
45-
SocketHandler _socketHandler, String hostname) async {
45+
SocketHandler socketHandler, String hostname) async {
4646
var cascade = Cascade();
4747
cascade = cascade.add((request) {
4848
if (request.url.path == authenticationPath) {
@@ -52,14 +52,14 @@ class ExtensionBackend {
5252
});
5353
}
5454
return Response.notFound('');
55-
}).add(_socketHandler.handler);
55+
}).add(socketHandler.handler);
5656
final server = await startHttpServer(hostname);
5757
serveHttpRequests(server, cascade.handler, (e, s) {
5858
_logger.warning('Error serving requests', e);
5959
emitEvent(DwdsEvent.httpRequestException('ExtensionBackend', '$e:$s'));
6060
});
6161
return ExtensionBackend._(
62-
_socketHandler, server.address.host, server.port, server);
62+
socketHandler, server.address.host, server.port, server);
6363
}
6464

6565
Future<void> close() => _closed ??= _server.close();

dwds/pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ dev_dependencies:
4949
frontend_server_common:
5050
path: ../frontend_server_common
5151
js: ^0.6.4
52+
lints: ^2.0.0
5253
pubspec_parse: ^1.2.0
5354
stream_channel: ^2.1.0
5455
test: ^1.21.1

dwds/test/chrome_proxy_service_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ void main() {
124124

125125
test('addBreakpointWithScriptUri absolute file URI', () async {
126126
final current = context.workingDirectory;
127-
final _test = path.join(path.dirname(current), '_test');
127+
final test = path.join(path.dirname(current), '_test');
128128
final scriptPath = Uri.parse(mainScript.uri).path.substring(1);
129-
final fullPath = path.join(_test, scriptPath);
129+
final fullPath = path.join(test, scriptPath);
130130
final fileUri = Uri.file(fullPath);
131131
final line = await context.findBreakpointLine(
132132
'printHelloWorld', isolate.id, mainScript);

dwds/test/readers/frontend_server_asset_reader_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ void main() {
2121
File jsonOriginal;
2222
File mapOriginal;
2323

24-
Future<void> _createTempFixtures() async {
24+
Future<void> createTempFixtures() async {
2525
final fixtures = p.join('test', 'fixtures');
2626
tempFixtures = await Directory.systemTemp.createTemp('dwds_test_fixtures');
2727
await tempFixtures.create();
@@ -37,7 +37,7 @@ void main() {
3737
});
3838

3939
setUp(() async {
40-
await _createTempFixtures();
40+
await createTempFixtures();
4141
assetReader = FrontendServerAssetReader(
4242
p.join(tempFixtures.path, 'main.dart.dill'),
4343
packagesDir,

0 commit comments

Comments
 (0)