跳转到内容

noPlaywrightWaitForNavigation

此内容尚不支持你的语言。

biome.json
{
"linter": {
"rules": {
"nursery": {
"noPlaywrightWaitForNavigation": "error"
}
}
}
}

Disallow using page.waitForNavigation().

Playwright’s page.waitForNavigation() is deprecated and should be replaced with more reliable alternatives like page.waitForURL() or page.waitForLoadState().

await page.waitForNavigation();
code-block.js:1:7 lint/nursery/noPlaywrightWaitForNavigation ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Unexpected use of page.waitForNavigation().

> 1 │ await page.waitForNavigation();
^^^^^^^^^^^^^^^^^^^^^^^^
2 │

waitForNavigation() is deprecated because it can be unreliable.

Use page.waitForURL() or page.waitForLoadState() instead.

This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

await page.click('button');
await page.waitForNavigation({ waitUntil: 'networkidle' });
code-block.js:2:7 lint/nursery/noPlaywrightWaitForNavigation ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Unexpected use of page.waitForNavigation().

1 │ await page.click(‘button’);
> 2 │ await page.waitForNavigation({ waitUntil: ‘networkidle’ });
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3 │

waitForNavigation() is deprecated because it can be unreliable.

Use page.waitForURL() or page.waitForLoadState() instead.

This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

await page.waitForURL('/home');
await page.waitForLoadState('networkidle');
await page.goto('/home');