Skip to content

Commit e7a6489

Browse files
Connor ClarkDevtools-frontend LUCI CQ
authored andcommitted
Enable projectService for TypeScript files in eslint config
Enabling this is required for rules that need to use the types as resolved by the TypeScript compiler. The no-floating-promises rule was missing some stuff due to missing types, so this CL resolves that too. Also, return-await kicked up more stuff. A warm run of `npm run lint` went from ~23s to ~35s on my M1 Mac. Bug: 406518012 Change-Id: I0c413e2ca14ee903851fd8404e490335c7f8aae0 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6397499 Reviewed-by: Nikolay Vitkov <[email protected]> Reviewed-by: Benedikt Meurer <[email protected]> Reviewed-by: Jack Franklin <[email protected]> Commit-Queue: Nikolay Vitkov <[email protected]>
1 parent acf22bf commit e7a6489

File tree

50 files changed

+94
-88
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+94
-88
lines changed

eslint.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ export default [
6363
'front_end/third_party/puppeteer-replay/**/*.ts',
6464
// Third party code we did not author for extensions
6565
'extensions/cxx_debugging/third_party/**/*',
66+
// Not in tsconfig project.
67+
'extension-api/ExtensionAPI.d.ts',
6668

6769
'**/node_modules',
6870
'scripts/build/typescript/tests',
@@ -315,6 +317,7 @@ export default [
315317
parser: tsParser,
316318
parserOptions: {
317319
allowAutomaticSingleRunInference: true,
320+
projectService: true,
318321
project: join(
319322
import.meta.dirname,
320323
'config',

extensions/cxx_debugging/e2e/TestDriver.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ describe('CXX Debugging Extension Test Suite', function() {
8888
async () => ((await getPendingEvents(frontend, 'DevTools.DebuggerPaused')) || []).length > 0);
8989

9090
const stopped = await waitFor(PAUSE_INDICATOR_SELECTOR);
91-
const stoppedText = await waitForFunction(async () => stopped.evaluate(node => node.textContent));
91+
const stoppedText = await waitForFunction(async () => await stopped.evaluate(node => node.textContent));
9292

9393
assert.strictEqual(stoppedText, pausedReasonText(reason));
9494

@@ -148,7 +148,8 @@ describe('CXX Debugging Extension Test Suite', function() {
148148

149149
if (thread) {
150150
const threadElement = await waitFor(SELECTED_THREAD_SELECTOR);
151-
const threadText = await waitForFunction(async () => threadElement.evaluate(node => node.textContent));
151+
const threadText =
152+
await waitForFunction(async () => await threadElement.evaluate(node => node.textContent));
152153
assert.include(threadText, thread, 'selected thread is not as expected');
153154
}
154155

extensions/cxx_debugging/e2e/standalone/MemoryInspector_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ describe('LinearMemoryInspector', () => {
3939
await waitForFunction(async () => ((await getPendingEvents(frontend, 'DevTools.DebuggerPaused')) || []).length > 0);
4040

4141
const stopped = await waitFor(PAUSE_INDICATOR_SELECTOR);
42-
const stoppedText = await waitForFunction(async () => stopped.evaluate(node => node.textContent));
42+
const stoppedText = await waitForFunction(async () => await stopped.evaluate(node => node.textContent));
4343

4444
assert.strictEqual(stoppedText, 'Paused on breakpoint');
4545

test/e2e/ai_assistance/ai_assistance_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ STOP`,
547547
await openConversationFromHistory('aria/Change the background color for this element to blue, unchecked');
548548
await openConversationFromHistory('aria/Change the background color for this element to green, unchecked');
549549

550-
frontend.waitForSelector('aria/Canceled');
550+
await frontend.waitForSelector('aria/Canceled');
551551
});
552552

553553
it('modifies styles to a selector with high specificity', async () => {

test/e2e/console/alert-toString-exception_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe('The Console Tab', () => {
1414
await navigateToConsoleTab();
1515
const {target} = getBrowserAndPages();
1616

17-
target.reload();
17+
await target.reload();
1818

1919
const result = (await getConsoleMessages('alert-toString-exception'))[0];
2020
assert.strictEqual(result, 'Uncaught Exception in toString().');

test/e2e/elements/at-property-sections_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ describe('The styles pane', () => {
111111
const section = await click('pierceShadowText/@property', {root: stylesPane});
112112
await waitForFunction(async () => 'true' === await section.evaluate(e => e.ariaExpanded));
113113
const rule = await getStyleRule('--custom-prop-4');
114-
return rule.evaluate(e => !e.classList.contains('hidden'));
114+
return await rule.evaluate(e => !e.classList.contains('hidden'));
115115
});
116116
});
117117

test/e2e/elements/color-picker_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe('ColorPicker', () => {
3232

3333
await clickElement(palette);
3434
await waitForFunction(
35-
async () => (await waitFor('.spectrum-overlay'))
35+
async () => await (await waitFor('.spectrum-overlay'))
3636
.evaluate(e => e.computedStyleMap().get('visibility')?.toString() === 'hidden'));
3737

3838
await click('.spectrum-palette-switcher');

test/e2e/elements/sidebar-event-listeners-remove_test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ describe('Removing event listeners in the elements sidebar', () => {
2929
assert.include(firstListenerText, 'button#test-button');
3030
const removeButtonSelector = `${listenerSelector} devtools-button`;
3131
const removeButton = await waitFor(removeButtonSelector);
32-
removeButton.evaluate(n => {
32+
const buttonTitle = await removeButton.evaluate(n => {
3333
const button = n.shadowRoot?.querySelector('button');
34-
assert.strictEqual(button?.title, 'Delete event listener');
34+
return button?.title;
3535
});
36+
assert.strictEqual(buttonTitle, 'Delete event listener');
3637

3738
await click(removeButtonSelector);
3839

test/e2e/elements/style-pane-properties_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ describe('The Styles pane', () => {
501501
const nodeLabelName = await waitFor('.node-label-name', containerLink);
502502
const nodeLabelNameContent = await nodeLabelName.evaluate(node => node.textContent as string);
503503
assert.strictEqual(nodeLabelNameContent, 'body', 'container link name does not match');
504-
containerLink.hover();
504+
await containerLink.hover();
505505
const queriedSizeDetails = await waitFor('.queried-size-details');
506506
const queriedSizeDetailsContent = await queriedSizeDetails.evaluate(node => (node as HTMLElement).innerText);
507507
assert.strictEqual(

test/e2e/extensions/debugger-language-plugins_test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,7 +1106,7 @@ describe('The Debugger Language Plugins', () => {
11061106
await goToWasmResource('stepping.wasm', {autoLoadModule: true});
11071107
await openSourcesPanel();
11081108

1109-
installEventListener(frontend, DEBUGGER_PAUSED_EVENT);
1109+
await installEventListener(frontend, DEBUGGER_PAUSED_EVENT);
11101110
await locationLabels.setBreakpointInWasmAndRun('FIRST_PAUSE', 'window.Module.instance.exports.Main(16)');
11111111
await waitFor('.paused-status');
11121112
await locationLabels.checkLocationForLabel('FIRST_PAUSE');
@@ -1202,7 +1202,7 @@ describe('The Debugger Language Plugins', () => {
12021202

12031203
await waitFor('.paused-status');
12041204
await locationLabels.checkLocationForLabel('FIRST_PAUSE');
1205-
installEventListener(frontend, DEBUGGER_PAUSED_EVENT);
1205+
await installEventListener(frontend, DEBUGGER_PAUSED_EVENT);
12061206
await stepOver();
12071207
await locationLabels.checkLocationForLabel('SECOND_PAUSE');
12081208
await stepOver();

0 commit comments

Comments
 (0)