Skip to content

Commit

Permalink
chore: update Prettier and other deps (#10555)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lightning00Blade authored Jul 17, 2023
1 parent cdd310f commit de09b05
Show file tree
Hide file tree
Showing 78 changed files with 2,559 additions and 942 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,5 @@ yarn-error.log*
# ESLint ignores.
assets/
third_party/
sandbox/
ng-schematics/src/**/files/
19 changes: 8 additions & 11 deletions .eslintplugin.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const prettier = require('prettier');
const prettier = require('@prettier/sync');
const prettierConfig = require('./.prettierrc.cjs');

const cleanupBlockComment = value => {
return value
Expand All @@ -18,12 +19,13 @@ const cleanupBlockComment = value => {
.trim();
};

const format = (value, offset, prettierOptions) => {
const format = (value, offset) => {
return prettier
.format(value, {
...prettierOptions,
...prettierConfig,
parser: 'markdown',
// This is the print width minus 3 (the length of ` * `) and the offset.
printWidth: prettierOptions.printWidth - (offset + 3),
printWidth: 80 - (offset + 3),
})
.trim();
};
Expand Down Expand Up @@ -57,17 +59,12 @@ const rule = {
},

create(context) {
const prettierOptions = {
printWidth: 80,
...prettier.resolveConfig.sync(context.getPhysicalFilename()),
parser: 'markdown',
};
for (const comment of context.getSourceCode().getAllComments()) {
for (const comment of context.sourceCode.getAllComments()) {
switch (comment.type) {
case 'Block': {
const offset = comment.loc.start.column;
const value = cleanupBlockComment(comment.value);
const formattedValue = format(value, offset, prettierOptions);
const formattedValue = format(value, offset);
if (formattedValue !== value) {
context.report({
node: comment,
Expand Down
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ module.exports = {
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/stylistic',
],
plugins: ['eslint-plugin-tsdoc', 'local'],
rules: {
Expand Down Expand Up @@ -211,6 +212,7 @@ module.exports = {
'error',
{ignoreVoid: true, ignoreIIFE: true},
],
'@typescript-eslint/prefer-ts-expect-error': 'error',
},
},
],
Expand Down
2 changes: 1 addition & 1 deletion docs/api/puppeteer.elementfor.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sidebar_label: ElementFor

```typescript
export type ElementFor<
TagName extends keyof HTMLElementTagNameMap | keyof SVGElementTagNameMap
TagName extends keyof HTMLElementTagNameMap | keyof SVGElementTagNameMap,
> = TagName extends keyof HTMLElementTagNameMap
? HTMLElementTagNameMap[TagName]
: TagName extends keyof SVGElementTagNameMap
Expand Down
2 changes: 1 addition & 1 deletion docs/api/puppeteer.elementhandle.__eval.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ElementHandle {
Func extends EvaluateFuncWith<
Array<NodeFor<Selector>>,
Params
> = EvaluateFuncWith<Array<NodeFor<Selector>>, Params>
> = EvaluateFuncWith<Array<NodeFor<Selector>>, Params>,
>(
selector: Selector,
pageFunction: Func | string,
Expand Down
2 changes: 1 addition & 1 deletion docs/api/puppeteer.elementhandle._eval.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ElementHandle {
Func extends EvaluateFuncWith<NodeFor<Selector>, Params> = EvaluateFuncWith<
NodeFor<Selector>,
Params
>
>,
>(
selector: Selector,
pageFunction: Func | string,
Expand Down
2 changes: 1 addition & 1 deletion docs/api/puppeteer.frame.__eval.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Frame {
Func extends EvaluateFuncWith<
Array<NodeFor<Selector>>,
Params
> = EvaluateFuncWith<Array<NodeFor<Selector>>, Params>
> = EvaluateFuncWith<Array<NodeFor<Selector>>, Params>,
>(
selector: Selector,
pageFunction: Func | string,
Expand Down
2 changes: 1 addition & 1 deletion docs/api/puppeteer.frame._eval.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Frame {
Func extends EvaluateFuncWith<NodeFor<Selector>, Params> = EvaluateFuncWith<
NodeFor<Selector>,
Params
>
>,
>(
selector: Selector,
pageFunction: Func | string,
Expand Down
2 changes: 1 addition & 1 deletion docs/api/puppeteer.frame.evaluate.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Behaves identically to [Page.evaluate()](./puppeteer.page.evaluate.md) except it
class Frame {
evaluate<
Params extends unknown[],
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
>(
pageFunction: Func | string,
...args: Params
Expand Down
2 changes: 1 addition & 1 deletion docs/api/puppeteer.frame.evaluatehandle.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Behaves identically to [Page.evaluateHandle()](./puppeteer.page.evaluatehandle.m
class Frame {
evaluateHandle<
Params extends unknown[],
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
>(
pageFunction: Func | string,
...args: Params
Expand Down
2 changes: 1 addition & 1 deletion docs/api/puppeteer.frame.waitforfunction.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ sidebar_label: Frame.waitForFunction
class Frame {
waitForFunction<
Params extends unknown[],
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
>(
pageFunction: Func | string,
options?: FrameWaitForFunctionOptions,
Expand Down
2 changes: 1 addition & 1 deletion docs/api/puppeteer.jshandle.evaluate.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Evaluates the given function with the current handle as its first argument.
class JSHandle {
evaluate<
Params extends unknown[],
Func extends EvaluateFuncWith<T, Params> = EvaluateFuncWith<T, Params>
Func extends EvaluateFuncWith<T, Params> = EvaluateFuncWith<T, Params>,
>(
pageFunction: Func | string,
...args: Params
Expand Down
2 changes: 1 addition & 1 deletion docs/api/puppeteer.jshandle.evaluatehandle.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Evaluates the given function with the current handle as its first argument.
class JSHandle {
evaluateHandle<
Params extends unknown[],
Func extends EvaluateFuncWith<T, Params> = EvaluateFuncWith<T, Params>
Func extends EvaluateFuncWith<T, Params> = EvaluateFuncWith<T, Params>,
>(
pageFunction: Func | string,
...args: Params
Expand Down
2 changes: 1 addition & 1 deletion docs/api/puppeteer.page.__eval.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Page {
Func extends EvaluateFuncWith<
Array<NodeFor<Selector>>,
Params
> = EvaluateFuncWith<Array<NodeFor<Selector>>, Params>
> = EvaluateFuncWith<Array<NodeFor<Selector>>, Params>,
>(
selector: Selector,
pageFunction: Func | string,
Expand Down
2 changes: 1 addition & 1 deletion docs/api/puppeteer.page._eval.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Page {
Func extends EvaluateFuncWith<NodeFor<Selector>, Params> = EvaluateFuncWith<
NodeFor<Selector>,
Params
>
>,
>(
selector: Selector,
pageFunction: Func | string,
Expand Down
2 changes: 1 addition & 1 deletion docs/api/puppeteer.page.evaluate.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ If the function passed to `page.evaluate` returns a Promise, the function will w
class Page {
evaluate<
Params extends unknown[],
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
>(
pageFunction: Func | string,
...args: Params
Expand Down
2 changes: 1 addition & 1 deletion docs/api/puppeteer.page.evaluatehandle.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ sidebar_label: Page.evaluateHandle
class Page {
evaluateHandle<
Params extends unknown[],
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
>(
pageFunction: Func | string,
...args: Params
Expand Down
2 changes: 1 addition & 1 deletion docs/api/puppeteer.page.evaluateonnewdocument.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The function is invoked after the document was created but before any of its scr
class Page {
evaluateOnNewDocument<
Params extends unknown[],
Func extends (...args: Params) => unknown = (...args: Params) => unknown
Func extends (...args: Params) => unknown = (...args: Params) => unknown,
>(
pageFunction: Func | string,
...args: Params
Expand Down
2 changes: 1 addition & 1 deletion docs/api/puppeteer.page.waitforfunction.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Waits for a function to finish evaluating in the page's context.
class Page {
waitForFunction<
Params extends unknown[],
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
>(
pageFunction: Func | string,
options?: FrameWaitForFunctionOptions,
Expand Down
2 changes: 1 addition & 1 deletion docs/api/puppeteer.webworker.evaluate.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ If the function passed to the `worker.evaluate` returns a Promise, then `worker.
class WebWorker {
evaluate<
Params extends unknown[],
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
>(
pageFunction: Func | string,
...args: Params
Expand Down
2 changes: 1 addition & 1 deletion docs/api/puppeteer.webworker.evaluatehandle.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The only difference between `worker.evaluate` and `worker.evaluateHandle` is tha
class WebWorker {
evaluateHandle<
Params extends unknown[],
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
>(
pageFunction: Func | string,
...args: Params
Expand Down
18 changes: 10 additions & 8 deletions docs/browsers-api/browsers.installedbrowser.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@
sidebar_label: InstalledBrowser
---

# InstalledBrowser type
# InstalledBrowser interface

#### Signature:

```typescript
export type InstalledBrowser = {
path: string;
browser: Browser;
buildId: string;
platform: BrowserPlatform;
};
export interface InstalledBrowser
```

**References:** [Browser](./browsers.browser.md), [BrowserPlatform](./browsers.browserplatform.md)
## Properties

| Property | Modifiers | Type | Description | Default |
| -------- | --------- | ------------------------------------------------ | ----------- | ------- |
| browser | | [Browser](./browsers.browser.md) | | |
| buildId | | string | | |
| path | | string | | |
| platform | | [BrowserPlatform](./browsers.browserplatform.md) | | |
30 changes: 17 additions & 13 deletions docs/browsers-api/browsers.launchoptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,25 @@
sidebar_label: LaunchOptions
---

# LaunchOptions type
# LaunchOptions interface

#### Signature:

```typescript
export type LaunchOptions = {
executablePath: string;
pipe?: boolean;
dumpio?: boolean;
args?: string[];
env?: Record<string, string | undefined>;
handleSIGINT?: boolean;
handleSIGTERM?: boolean;
handleSIGHUP?: boolean;
detached?: boolean;
onExit?: () => Promise<void>;
};
export interface LaunchOptions
```

## Properties

| Property | Modifiers | Type | Description | Default |
| -------------- | --------------------- | ----------------------------------------- | ----------- | ------- |
| args | <code>optional</code> | string\[\] | | |
| detached | <code>optional</code> | boolean | | |
| dumpio | <code>optional</code> | boolean | | |
| env | <code>optional</code> | Record&lt;string, string \| undefined&gt; | | |
| executablePath | | string | | |
| handleSIGHUP | <code>optional</code> | boolean | | |
| handleSIGINT | <code>optional</code> | boolean | | |
| handleSIGTERM | <code>optional</code> | boolean | | |
| onExit | <code>optional</code> | () =&gt; Promise&lt;void&gt; | | |
| pipe | <code>optional</code> | boolean | | |
9 changes: 2 additions & 7 deletions docs/browsers-api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ The programmatic API allows installing and launching browsers from your code. Se
| Interface | Description |
| ------------------------------------------------------------------------ | ----------- |
| [GetInstalledBrowsersOptions](./browsers.getinstalledbrowsersoptions.md) | |
| [InstalledBrowser](./browsers.installedbrowser.md) | |
| [InstallOptions](./browsers.installoptions.md) | |
| [LaunchOptions](./browsers.launchoptions.md) | |
| [Options](./browsers.options.md) | |
| [ProfileOptions](./browsers.profileoptions.md) | |
| [SystemOptions](./browsers.systemoptions.md) | |
Expand All @@ -80,10 +82,3 @@ The programmatic API allows installing and launching browsers from your code. Se
| ------------------------------------------------------------------------------------------------ | ----------- |
| [CDP_WEBSOCKET_ENDPOINT_REGEX](./browsers.cdp_websocket_endpoint_regex.md) | |
| [WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX](./browsers.webdriver_bidi_websocket_endpoint_regex.md) | |

## Type Aliases

| Type Alias | Description |
| -------------------------------------------------- | ----------- |
| [InstalledBrowser](./browsers.installedbrowser.md) | |
| [LaunchOptions](./browsers.launchoptions.md) | |
2 changes: 2 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,11 @@ The following example searches [developer.chrome.com](https://developer.chrome.c
import puppeteer from 'puppeteer';

(async () => {
// Launch the browser and open a new blank page
const browser = await puppeteer.launch();
const page = await browser.newPage();

// Navigate the page to a URL
await page.goto('https://developer.chrome.com/');

// Set screen size
Expand Down
Loading

0 comments on commit de09b05

Please sign in to comment.