Skip to content

Commit 3774cf8

Browse files
author
Anna Gringauze
authored
Add 'avoid_void_async' lint (#1977)
* Validate only needed summaries in expression_compiler_service * Add avoid_void_async lint
1 parent 705e0ac commit 3774cf8

File tree

15 files changed

+44
-39
lines changed

15 files changed

+44
-39
lines changed

dwds/analysis_options.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ linter:
1919
- directives_ordering
2020
- prefer_final_locals
2121
- unawaited_futures
22+
- avoid_void_async

dwds/debug_extension/tool/copy_builder.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class _CopyBuilder extends Builder {
2121
};
2222

2323
@override
24-
void build(BuildStep buildStep) async {
24+
Future<void> build(BuildStep buildStep) async {
2525
final inputAsset = buildStep.inputId;
2626
final allowedOutputs = buildStep.allowedOutputs;
2727

dwds/debug_extension/web/background.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ void _startDebugging(DebuggerTrigger debuggerTrigger) {
233233
}));
234234
}
235235

236-
void _attachDebuggerToTab(Tab currentTab) async {
236+
Future<void> _attachDebuggerToTab(Tab currentTab) async {
237237
if (!_debuggableTabs.contains(currentTab.id)) return;
238238

239239
if (_tabIdToWarning.containsKey(currentTab.id)) {
@@ -287,7 +287,7 @@ void _handleMessageFromPanelScript(Request request, MessageSender sender) {
287287
}
288288
}
289289

290-
void _maybeMarkTabAsDebuggable(
290+
Future<void> _maybeMarkTabAsDebuggable(
291291
Request request, MessageSender sender, Function sendResponse) async {
292292
// Register any warnings for the tab:
293293
if (request.warning != '') {
@@ -300,7 +300,7 @@ void _maybeMarkTabAsDebuggable(
300300
sendResponse(true);
301301
}
302302

303-
void _maybeAttachDebugSession(
303+
Future<void> _maybeAttachDebugSession(
304304
Debuggee source,
305305
String method,
306306
Object? params,
@@ -361,15 +361,15 @@ int _removeDebugSessionForTab(int tabId) {
361361
}
362362
}
363363

364-
void _maybeSaveDevToolsTabId(Tab tab) async {
364+
Future<void> _maybeSaveDevToolsTabId(Tab tab) async {
365365
// Remembers the ID of the DevTools tab.
366366
//
367367
// This assumes that the next launched tab after a session is created is the
368368
// DevTools tab.
369369
if (_debugSessions.isNotEmpty) _debugSessions.last.devtoolsTabId ??= tab.id;
370370
}
371371

372-
void _handleMessageFromExternalExtensions(
372+
Future<void> _handleMessageFromExternalExtensions(
373373
dynamic jsRequest, MessageSender sender, Function sendResponse) async {
374374
if (jsRequest == null) return;
375375
final request = jsRequest as Request;
@@ -408,7 +408,7 @@ void _handleMessageFromExternalExtensions(
408408
}
409409
}
410410

411-
void _forwardMessageToExternalExtensions(
411+
Future<void> _forwardMessageToExternalExtensions(
412412
Debuggee source, String method, Object? params) async {
413413
if (_allowedEvents.contains(method)) {
414414
sendMessageToExtensions(ExternalExtensionRequest(

dwds/debug_extension_mv3/tool/copy_builder.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class _CopyBuilder extends Builder {
1818
};
1919

2020
@override
21-
void build(BuildStep buildStep) async {
21+
Future<void> build(BuildStep buildStep) async {
2222
final inputAsset = buildStep.inputId;
2323
final allowedOutputs = buildStep.allowedOutputs;
2424

dwds/debug_extension_mv3/web/background.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void _registerListeners() {
5555
));
5656
}
5757

58-
void _handleRuntimeMessages(
58+
Future<void> _handleRuntimeMessages(
5959
dynamic jsRequest, MessageSender sender, Function sendResponse) async {
6060
if (jsRequest is! String) return;
6161

@@ -137,7 +137,8 @@ void _handleRuntimeMessages(
137137
});
138138
}
139139

140-
void _detectNavigationAwayFromDartApp(NavigationInfo navigationInfo) async {
140+
Future<void> _detectNavigationAwayFromDartApp(
141+
NavigationInfo navigationInfo) async {
141142
final tabId = navigationInfo.tabId;
142143
final debugInfo = await _fetchDebugInfo(navigationInfo.tabId);
143144
if (debugInfo == null) return;

dwds/debug_extension_mv3/web/cross_extension_communication.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@ final _eventsForAngularDartDevTools = {
2727
'dwds.encodedUri',
2828
};
2929

30-
void handleMessagesFromAngularDartDevTools(
30+
Future<void> handleMessagesFromAngularDartDevTools(
3131
dynamic jsRequest, MessageSender sender, Function sendResponse) async {
3232
if (jsRequest == null) return;
3333
final message = jsRequest as ExternalExtensionMessage;
3434
if (message.name == 'chrome.debugger.sendCommand') {
3535
_forwardCommandToChromeDebugger(message, sendResponse);
3636
} else if (message.name == 'dwds.encodedUri') {
37-
_respondWithEncodedUri(message.tabId, sendResponse);
37+
await _respondWithEncodedUri(message.tabId, sendResponse);
3838
} else if (message.name == 'dwds.startDebugging') {
39-
attachDebugger(message.tabId, trigger: Trigger.angularDartDevTools);
39+
await attachDebugger(message.tabId, trigger: Trigger.angularDartDevTools);
4040
sendResponse(true);
4141
} else {
4242
sendResponse(
@@ -83,7 +83,7 @@ void _respondWithChromeResult(Object? chromeResult, Function sendResponse) {
8383
}
8484
}
8585

86-
void _respondWithEncodedUri(int tabId, Function sendResponse) async {
86+
Future<void> _respondWithEncodedUri(int tabId, Function sendResponse) async {
8787
final encodedUri = await fetchStorageObject<String>(
8888
type: StorageObject.encodedUri, tabId: tabId);
8989
sendResponse(encodedUri ?? '');

dwds/debug_extension_mv3/web/debug_session.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ bool get existsActiveDebugSession => _debugSessions.isNotEmpty;
104104
int? get latestAppBeingDebugged =>
105105
existsActiveDebugSession ? _debugSessions.last.appTabId : null;
106106

107-
void attachDebugger(int dartAppTabId, {required Trigger trigger}) async {
107+
Future<void> attachDebugger(int dartAppTabId,
108+
{required Trigger trigger}) async {
108109
// Check if a debugger is already attached:
109110
final existingDebuggerLocation = _debuggerLocation(dartAppTabId);
110111
if (existingDebuggerLocation != null) {
@@ -372,7 +373,8 @@ void _forwardChromeDebuggerEventToDwds(
372373
}
373374
}
374375

375-
void _openDevTools(String devToolsUri, {required int dartAppTabId}) async {
376+
Future<void> _openDevTools(String devToolsUri,
377+
{required int dartAppTabId}) async {
376378
if (devToolsUri.isEmpty) {
377379
debugError('DevTools URI is empty.');
378380
return;

dwds/debug_extension_mv3/web/devtools.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ bool panelsExist = false;
1919

2020
void main() async {
2121
_registerListeners();
22-
_maybeCreatePanels();
22+
await _maybeCreatePanels();
2323
}
2424

2525
void _registerListeners() {
@@ -31,7 +31,7 @@ void _registerListeners() {
3131
}));
3232
}
3333

34-
void _maybeCreatePanels() async {
34+
Future<void> _maybeCreatePanels() async {
3535
if (panelsExist) return;
3636
final tabId = chrome.devtools.inspectedWindow.tabId;
3737
final debugInfo = await fetchStorageObject<DebugInfo>(

dwds/debug_extension_mv3/web/settings.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ void _registerListeners() {
2323
saveButton.addEventListener('click', _saveSettingsToStorage);
2424
}
2525

26-
void _updateSettingsFromStorage(Event _) async {
26+
Future<void> _updateSettingsFromStorage(Event _) async {
2727
final devToolsOpener = await fetchStorageObject<DevToolsOpener>(
2828
type: StorageObject.devToolsOpener);
2929
final openInNewWindow = devToolsOpener?.newWindow ?? false;
3030
_getRadioButton('windowOpt').checked = openInNewWindow;
3131
_getRadioButton('tabOpt').checked = !openInNewWindow;
3232
}
3333

34-
void _saveSettingsToStorage(Event event) async {
34+
Future<void> _saveSettingsToStorage(Event event) async {
3535
event.preventDefault();
3636
_maybeHideSavedMsg();
3737
final form = document.querySelector("form") as FormElement;

dwds/lib/src/debugging/debugger.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ class Debugger extends Domain {
213213
Future<void> resumeFromStart() => _resumeHandler(null);
214214

215215
/// Notify the debugger the [Isolate] is paused at the application start.
216-
void notifyPausedAtStart() async {
216+
void notifyPausedAtStart() {
217217
stackComputer = FrameComputer(this, []);
218218
}
219219

0 commit comments

Comments
 (0)