Skip to content

Commit d5d47f2

Browse files
authored
chore: organize imports in packages (#34681)
1 parent 4a7f6a6 commit d5d47f2

File tree

111 files changed

+639
-427
lines changed

Some content is hidden

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

111 files changed

+639
-427
lines changed

docs/src/auth.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Create `tests/auth.setup.ts` that will prepare authenticated browser state for a
4747

4848
```js title="tests/auth.setup.ts"
4949
import { test as setup, expect } from '@playwright/test';
50-
import path from 'path';
50+
import * as path from 'path';
5151

5252
const authFile = path.join(__dirname, '../playwright/.auth/user.json');
5353

@@ -143,8 +143,8 @@ Create `playwright/fixtures.ts` file that will [override `storageState` fixture]
143143

144144
```js title="playwright/fixtures.ts"
145145
import { test as baseTest, expect } from '@playwright/test';
146-
import fs from 'fs';
147-
import path from 'path';
146+
import * as fs from 'fs';
147+
import * as path from 'path';
148148

149149
export * from '@playwright/test';
150150
export const test = baseTest.extend<{}, { workerStorageState: string }>({
@@ -348,8 +348,8 @@ Alternatively, in a [worker fixture](#moderate-one-account-per-parallel-worker):
348348

349349
```js title="playwright/fixtures.ts"
350350
import { test as baseTest, request } from '@playwright/test';
351-
import fs from 'fs';
352-
import path from 'path';
351+
import * as fs from 'fs';
352+
import * as path from 'path';
353353

354354
export * from '@playwright/test';
355355
export const test = baseTest.extend<{}, { workerStorageState: string }>({

docs/src/chrome-extensions-js-python.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ First, add fixtures that will load the extension:
109109

110110
```js title="fixtures.ts"
111111
import { test as base, chromium, type BrowserContext } from '@playwright/test';
112-
import path from 'path';
112+
import * as path from 'path';
113113

114114
export const test = base.extend<{
115115
context: BrowserContext;

docs/src/evaluating.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ Next, add init script to the page.
389389

390390
```js
391391
import { test, expect } from '@playwright/test';
392-
import path from 'path';
392+
import * as path from 'path';
393393

394394
test.beforeEach(async ({ page }) => {
395395
// Add script for every test in the beforeEach hook.

docs/src/test-api/class-testconfig.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ Here is an example that uses [`method: TestInfo.outputPath`] to create a tempora
291291

292292
```js
293293
import { test, expect } from '@playwright/test';
294-
import fs from 'fs';
294+
import * as fs from 'fs';
295295

296296
test('example test', async ({}, testInfo) => {
297297
const file = testInfo.outputPath('temporary-file.txt');

docs/src/test-api/class-testinfo.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ Returns a path inside the [`property: TestInfo.outputDir`] where the test can sa
254254

255255
```js
256256
import { test, expect } from '@playwright/test';
257-
import fs from 'fs';
257+
import * as fs from 'fs';
258258

259259
test('example test', async ({}, testInfo) => {
260260
const file = testInfo.outputPath('dir', 'temporary-file.txt');

docs/src/test-api/class-testproject.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ Here is an example that uses [`method: TestInfo.outputPath`] to create a tempora
212212

213213
```js
214214
import { test, expect } from '@playwright/test';
215-
import fs from 'fs';
215+
import * as fs from 'fs';
216216

217217
test('example test', async ({}, testInfo) => {
218218
const file = testInfo.outputPath('temporary-file.txt');

docs/src/test-parameterize-js.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ To make environment variables easier to manage, consider something like `.env` f
262262
```js title="playwright.config.ts"
263263
import { defineConfig } from '@playwright/test';
264264
import dotenv from 'dotenv';
265-
import path from 'path';
265+
import * as path from 'path';
266266

267267
// Read from ".env" file.
268268
dotenv.config({ path: path.resolve(__dirname, '.env') });
@@ -309,8 +309,8 @@ See for example this CSV file, in our example `input.csv`:
309309
Based on this we'll generate some tests by using the [csv-parse](https://www.npmjs.com/package/csv-parse) library from NPM:
310310

311311
```js title="test.spec.ts"
312-
import fs from 'fs';
313-
import path from 'path';
312+
import * as fs from 'fs';
313+
import * as path from 'path';
314314
import { test } from '@playwright/test';
315315
import { parse } from 'csv-parse/sync';
316316

docs/src/webview2.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ Using the following, Playwright will run your WebView2 application as a sub-proc
7272

7373
```js title="webView2Test.ts"
7474
import { test as base } from '@playwright/test';
75-
import fs from 'fs';
76-
import os from 'os';
77-
import path from 'path';
75+
import * as fs from 'fs';
76+
import * as os from 'os';
77+
import * as path from 'path';
7878
import childProcess from 'child_process';
7979

8080
const EXECUTABLE_PATH = path.join(

eslint.config.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,9 @@ export default [{
233233
}],
234234
}
235235
}, {
236-
files: ['packages/playwright-core/**/*.ts'],
236+
files: [
237+
'packages/**/*.ts',
238+
],
237239
rules: {
238240
...importOrderRules
239241
},

packages/html-reporter/bundle.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
* limitations under the License.
1515
*/
1616

17-
import fs from 'fs';
18-
import path from 'path';
17+
import * as fs from 'fs';
18+
import * as path from 'path';
1919
import type { Plugin, UserConfig } from 'vite';
2020

2121
export function bundle(): Plugin {

0 commit comments

Comments
 (0)