Skip to content

Commit

Permalink
chore(lint): Ensure EOL newlines (#34117)
Browse files Browse the repository at this point in the history
  • Loading branch information
agg23 authored Dec 20, 2024
1 parent 3bc72eb commit 8754368
Show file tree
Hide file tree
Showing 56 changed files with 39 additions and 55 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ test/assets/modernizr.js
/packages/*/lib/
*.js
/packages/playwright-core/src/generated/*
/packages/playwright-core/src/protocol/debug.ts
/packages/playwright-core/src/protocol/validator.ts
/packages/playwright-core/src/server/injected/recorder/clipPaths.ts
/packages/playwright-core/src/third_party/
/packages/playwright-core/types/*
/packages/playwright-ct-core/src/generated/*
Expand Down
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,15 @@ module.exports = {
"@typescript-eslint/type-annotation-spacing": 2,

// file whitespace
"no-multiple-empty-lines": [2, {"max": 2}],
"no-multiple-empty-lines": [2, {"max": 2, "maxEOF": 0}],
"no-mixed-spaces-and-tabs": 2,
"no-trailing-spaces": 2,
"linebreak-style": [ process.platform === "win32" ? 0 : 2, "unix" ],
"indent": [2, 2, { "SwitchCase": 1, "CallExpression": {"arguments": 2}, "MemberExpression": 2 }],
"key-spacing": [2, {
"beforeColon": false
}],
"eol-last": 2,

// copyright
"notice/notice": [2, {
Expand Down
2 changes: 1 addition & 1 deletion packages/html-reporter/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ export function bundle(): Plugin {
}
},
};
}
}
1 change: 0 additions & 1 deletion packages/html-reporter/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,3 @@ export function hashStringToInt(str: string) {
hash = str.charCodeAt(i) + ((hash << 8) - hash);
return Math.abs(hash % 6);
}

2 changes: 1 addition & 1 deletion packages/playwright-core/src/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ export type Rect = Size & Point;
export type Quad = [ Point, Point, Point, Point ];
export type TimeoutOptions = { timeout?: number };
export type NameValue = { name: string, value: string };
export type HeadersArray = NameValue[];
export type HeadersArray = NameValue[];
1 change: 0 additions & 1 deletion packages/playwright-core/src/image_tools/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,3 @@ export class FastStats implements Stats {
return (this._sum(this._partialSumMult, x1, y1, x2, y2) - this._sum(this._partialSumC1, x1, y1, x2, y2) * this._sum(this._partialSumC2, x1, y1, x2, y2) / N) / N;
}
}

2 changes: 0 additions & 2 deletions packages/playwright-core/src/server/android/android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -524,5 +524,3 @@ class ClankBrowserProcess implements BrowserProcess {
await this._browser.close();
}
}


2 changes: 1 addition & 1 deletion packages/playwright-core/src/server/fileUploadUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ export async function prepareFilesForUpload(frame: Frame, params: channels.Eleme
}));

return { localPaths, localDirectory, filePayloads };
}
}
1 change: 0 additions & 1 deletion packages/playwright-core/src/server/firefox/ffBrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,4 +436,3 @@ function toJugglerProxyOptions(proxy: types.ProxySettings) {
// Prefs for quick fixes that didn't make it to the build.
// Should all be moved to `playwright.cfg`.
const kBandaidFirefoxUserPrefs = {};

1 change: 0 additions & 1 deletion packages/playwright-core/src/server/firefox/firefox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,3 @@ class JugglerReadyState extends BrowserReadyState {
this._wsEndpoint.resolve(undefined);
}
}

1 change: 0 additions & 1 deletion packages/playwright-core/src/server/registry/nativeDeps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1104,4 +1104,3 @@ deps['debian12-arm64'] = {
...deps['debian12-x64'].lib2package,
},
};

Original file line number Diff line number Diff line change
Expand Up @@ -354,4 +354,4 @@ export function rewriteOpenSSLErrorIfNeeded(error: Error): Error {
'For more details, see https://github.com/openssl/openssl/blob/master/README-PROVIDERS.md#the-legacy-provider',
'You could probably modernize the certificate by following the steps at https://github.com/nodejs/node/issues/40672#issuecomment-1243648223',
].join('\n'));
}
}
1 change: 0 additions & 1 deletion packages/playwright-core/src/server/socksInterceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,3 @@ export class SocksInterceptor {
function tChannelForSocks(names: '*' | string[], arg: any, path: string, context: ValidatorContext) {
throw new ValidationError(`${path}: channels are not expected in SocksSupport`);
}

Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ export class WKProvisionalPage {
assert(!frameTree.frame.parentId);
this._mainFrameId = frameTree.frame.id;
}
}
}
2 changes: 1 addition & 1 deletion packages/playwright-core/src/utils/isomorphic/mimeType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ export function isJsonMimeType(mimeType: string) {

export function isTextualMimeType(mimeType: string) {
return !!mimeType.match(/^(text\/.*?|application\/(json|(x-)?javascript|xml.*?|ecmascript|graphql|x-www-form-urlencoded)|image\/svg(\+xml)?|application\/.*?(\+json|\+xml))(;\s*charset=.*)?$/);
}
}
1 change: 0 additions & 1 deletion packages/playwright-core/src/utils/linuxUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,3 @@ function parseOSReleaseText(osReleaseText: string): Map<string, string> {
}
return fields;
}

2 changes: 1 addition & 1 deletion packages/playwright-core/src/utils/sequence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ export function findRepeatedSubsequences(s: string[]): { sequence: string[]; cou
}

return result;
}
}
2 changes: 1 addition & 1 deletion packages/playwright/jsx-runtime.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ import jsxRuntime from './jsx-runtime.js';

export const jsx = jsxRuntime.jsx;
export const jsxs = jsxRuntime.jsxs;
export const Fragment = jsxRuntime.Fragment;
export const Fragment = jsxRuntime.Fragment;
2 changes: 1 addition & 1 deletion packages/playwright/src/common/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,4 +298,4 @@ const configInternalSymbol = Symbol('configInternalSymbol');

export function getProjectId(project: FullProject): string {
return (project as any).__projectId!;
}
}
2 changes: 1 addition & 1 deletion packages/playwright/src/runner/vcs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ export async function detectChangedTestFiles(baseCommit: string, configDir: stri
const trackedFilesWithChanges = gitFileList(`diff ${baseCommit} --name-only`).map(file => path.join(gitRoot, file));

return new Set(affectedTestFiles([...untrackedFiles, ...trackedFilesWithChanges]));
}
}
2 changes: 1 addition & 1 deletion packages/trace-viewer/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ export function bundle(): Plugin {
},
},
};
}
}
2 changes: 1 addition & 1 deletion packages/trace-viewer/src/sw/traceModelBackends.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,4 @@ export class TraceViewerServer {
return;
return response;
}
}
}
2 changes: 1 addition & 1 deletion packages/trace-viewer/src/third_party/devtools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,4 +282,4 @@ export async function generateFetchCall(resource: Entry, style: FetchStyle = Fet

async function fetchRequestPostData(resource: Entry) {
return resource.request.postData?._sha1 ? await fetch(`sha1/${resource.request.postData._sha1}`).then(r => r.text()) : resource.request.postData?.text;
}
}
2 changes: 1 addition & 1 deletion packages/trace-viewer/src/ui/actionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,4 @@ function excludeOrigin(url: string): string {
} catch (error) {
return url;
}
}
}
2 changes: 1 addition & 1 deletion packages/web/src/components/sourceChooser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ export function emptySource(): Source {
label: '',
highlight: []
};
}
}
1 change: 0 additions & 1 deletion packages/web/src/components/splitView.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,3 @@ test('drag resize', async ({ page, mount }) => {
expect.soft(mainBox).toEqual({ x: 0, y: 0, width: 500, height: 100 });
expect.soft(sidebarBox).toEqual({ x: 0, y: 101, width: 500, height: 399 });
});

2 changes: 1 addition & 1 deletion tests/android/webview.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ test('select webview from socketName', async function({ androidDevice }) {

await newPage.close();
await context.close();
});
});
2 changes: 1 addition & 1 deletion tests/bidi/csvReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ function csvEscape(str) {
return str;
}

export default CsvReporter;
export default CsvReporter;
2 changes: 1 addition & 1 deletion tests/bidi/expectationReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,4 @@ function getOutcome(test: TestCase): TestExpectation {
return 'unknown';
}

export default ExpectationReporter;
export default ExpectationReporter;
2 changes: 1 addition & 1 deletion tests/expect/toThrowMatchers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -588,4 +588,4 @@ for (const toThrow of ['toThrowError', 'toThrow'] as const) {
).toThrowErrorMatchingSnapshot();
});
});
}
}
2 changes: 1 addition & 1 deletion tests/library/browsercontext-har.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -556,4 +556,4 @@ it('should ignore aborted requests', async ({ contextFactory, server }) => {
const result = await Promise.race([evalPromise, page2.waitForTimeout(1000).then(() => 'timeout')]);
expect(result).toBe('timeout');
}
});
});
2 changes: 1 addition & 1 deletion tests/library/chromium/chromium.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -629,4 +629,4 @@ test.describe('PW_EXPERIMENTAL_SERVICE_WORKER_NETWORK_EVENTS=1', () => {
const req = await requestPromise;
expect(req.headers['x-custom-header']).toBe('custom!');
});
});
});
2 changes: 1 addition & 1 deletion tests/library/inspector/cli-codegen-test.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,4 @@ test('should generate routeFromHAR with --save-har and --save-har-glob', async (
await cli.waitForCleanExit();
const json = JSON.parse(fs.readFileSync(harFileName, 'utf-8'));
expect(json.log.creator.name).toBe('Playwright');
});
});
2 changes: 1 addition & 1 deletion tests/library/popup.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,4 +288,4 @@ async function waitForRafs(page: Page, count: number): Promise<void> {
};
window.builtinRequestAnimationFrame(onRaf);
}), count);
}
}
1 change: 0 additions & 1 deletion tests/page/frame-evaluate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,3 @@ it('evaluateHandle should work', async ({ page, server }) => {
const windowHandle = await mainFrame.evaluateHandle(() => window);
expect(windowHandle).toBeTruthy();
});

1 change: 0 additions & 1 deletion tests/page/locator-misc-2.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,3 @@ it('Locator.locator() and FrameLocator.locator() should accept locator', async (
expect(await divLocator.locator('input').inputValue()).toBe('outer');
expect(await page.frameLocator('iframe').locator(divLocator).locator('input').inputValue()).toBe('inner');
});

2 changes: 1 addition & 1 deletion tests/page/page-event-request.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,4 +272,4 @@ it('<picture> resource should have type image', async ({ page }) => {
`)
]);
expect(request.resourceType()).toBe('image');
});
});
1 change: 0 additions & 1 deletion tests/page/page-mouse.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,4 +309,3 @@ it('should dispatch mouse move after context menu was opened', async ({ page, br
}
}
});

1 change: 0 additions & 1 deletion tests/page/page-request-fulfill.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -485,4 +485,3 @@ it('should not go to the network for fulfilled requests body', {
expect(body).toBeTruthy();
expect(serverHit).toBe(false);
});

1 change: 0 additions & 1 deletion tests/page/selectors-react.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,3 @@ for (const [name, url] of Object.entries(reacts)) {
});
});
}

1 change: 0 additions & 1 deletion tests/page/selectors-vue.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,3 @@ for (const [name, url] of Object.entries(vues)) {
});
});
}

2 changes: 1 addition & 1 deletion tests/playwright-test/command-line-filter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,4 @@ test('should focus a single test suite', async ({ runInlineTest }) => {
expect(result.skipped).toBe(0);
expect(result.report.suites[0].suites[0].suites[0].specs[0].title).toEqual('pass2');
expect(result.report.suites[0].suites[0].suites[0].specs[1].title).toEqual('pass3');
});
});
1 change: 0 additions & 1 deletion tests/playwright-test/only-changed.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -427,4 +427,3 @@ test('exits successfully if there are no changes', async ({ runInlineTest, git,

expect(result.exitCode).toBe(0);
});

2 changes: 1 addition & 1 deletion tests/playwright-test/playwright.reuse.browser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,4 @@ test('should produce correct test steps', async ({ runInlineTest, runServer }) =
'onStepEnd fixture: context',
'onStepEnd After Hooks'
]);
});
});
2 changes: 1 addition & 1 deletion tests/playwright-test/reporter-blob.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2052,4 +2052,4 @@ test('project filter in report name', async ({ runInlineTest }) => {
const reportFiles = await fs.promises.readdir(reportDir);
expect(reportFiles.sort()).toEqual(['report-foo-b-r-6d9d49e-1.zip']);
}
});
});
2 changes: 1 addition & 1 deletion tests/playwright-test/reporter-dot.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,4 @@ for (const useIntermediateMergeReport of [false, true] as const) {
colors.green('·').repeat(3));
});
});
}
}
2 changes: 1 addition & 1 deletion tests/playwright-test/reporter-github.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,4 @@ for (const useIntermediateMergeReport of [false, true] as const) {
expect(result.exitCode).toBe(1);
});
});
}
}
2 changes: 1 addition & 1 deletion tests/playwright-test/reporter-junit.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -594,4 +594,4 @@ for (const useIntermediateMergeReport of [false, true] as const) {
expect(time).toBeGreaterThan(1);
});
});
}
}
2 changes: 1 addition & 1 deletion tests/playwright-test/reporter-line.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,4 @@ for (const useIntermediateMergeReport of [false, true] as const) {
expect(result.exitCode).toBe(1);
});
});
}
}
1 change: 0 additions & 1 deletion tests/playwright-test/reporter-list.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,4 +319,3 @@ function simpleAnsiRenderer(text, ttyWidth) {

return screenLines.map(line => line.join('')).join('\n');
}

2 changes: 1 addition & 1 deletion tests/playwright-test/reporter-markdown.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,4 @@ test('report with worker error', async ({ runInlineTest }) => {
**0 passed**
:heavy_check_mark::heavy_check_mark::heavy_check_mark:
`);
});
});
1 change: 0 additions & 1 deletion tests/playwright-test/snapshot-path-template.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,3 @@ test('arg should receive default arg', async ({ runInlineTest }, testInfo) => {
expect(result.output).toContain(`A snapshot doesn't exist at ${snapshotOutputPath}, writing actual`);
expect(fs.existsSync(snapshotOutputPath)).toBe(true);
});

2 changes: 1 addition & 1 deletion tests/playwright-test/test-ignore.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,4 +370,4 @@ test('should always work with unix separators', async ({ runInlineTest }) => {
expect(result.passed).toBe(1);
expect(result.report.suites.map(s => s.file).sort()).toEqual(['a.test.ts']);
expect(result.exitCode).toBe(0);
});
});
1 change: 0 additions & 1 deletion tests/playwright-test/test-use.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,4 +186,3 @@ test('test.use() should throw if called from beforeAll ', async ({ runInlineTest
expect(result.exitCode).toBe(1);
expect(result.output).toContain('Playwright Test did not expect test.use() to be called here');
});

1 change: 0 additions & 1 deletion tests/playwright-test/ui-mode-test-annotations.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,3 @@ test('should display annotations', async ({ runUITest }) => {
await expect(annotations.locator('.annotation-item').filter({ hasText: 'test repo' }).locator('a'))
.toHaveAttribute('href', 'https://github.com/microsoft/playwright');
});

1 change: 1 addition & 0 deletions utils/doclint/linting-code-snippets/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ class JSLintingService extends LintingService {
'@typescript-eslint/no-unused-vars': 'off',
'max-len': ['error', { code: 100 }],
'react/react-in-jsx-scope': 'off',
'eol-last': 'off',
},
}
});
Expand Down

0 comments on commit 8754368

Please sign in to comment.