diff --git a/.eslintrc.js b/.eslintrc.js index 17d2d6c772b..0d054ee3502 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -185,6 +185,7 @@ module.exports = { '@typescript-eslint/explicit-function-return-type': 'off', // We allow non-null assertions if the value was asserted using `assert` API. '@typescript-eslint/no-non-null-assertion': 'off', + '@typescript-eslint/no-useless-template-literals': 'error', /** * This is the default options (as per * https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/docs/rules/ban-types.md), diff --git a/packages/puppeteer-core/src/node/ChromeLauncher.ts b/packages/puppeteer-core/src/node/ChromeLauncher.ts index f35bad0824d..389b2ed6064 100644 --- a/packages/puppeteer-core/src/node/ChromeLauncher.ts +++ b/packages/puppeteer-core/src/node/ChromeLauncher.ts @@ -324,7 +324,7 @@ export function getFeatures(flag: string, options: string[] = []): string[] { return s.startsWith(flag.endsWith('=') ? flag : `${flag}=`); }) .map(s => { - return s.split(new RegExp(`${flag}` + '=\\s*'))[1]?.trim(); + return s.split(new RegExp(`${flag}=\\s*`))[1]?.trim(); }) .filter(s => { return s; diff --git a/packages/puppeteer-core/src/node/ScreenRecorder.ts b/packages/puppeteer-core/src/node/ScreenRecorder.ts index 4096d1ca48f..761b5eb1846 100644 --- a/packages/puppeteer-core/src/node/ScreenRecorder.ts +++ b/packages/puppeteer-core/src/node/ScreenRecorder.ts @@ -99,11 +99,11 @@ export class ScreenRecorder extends PassThrough { // Reduces initial buffering while analyzing input fps and other stats. [ '-fpsprobesize', - `${0}`, + '0', '-probesize', - `${32}`, + '32', '-analyzeduration', - `${0}`, + '0', '-fflags', 'nobuffer', ], @@ -120,13 +120,13 @@ export class ScreenRecorder extends PassThrough { // Specifies the encoding and format we are using. this.#getFormatArgs(format ?? 'webm'), // Disable bitrate. - ['-b:v', `${0}`], + ['-b:v', '0'], // Filters to ensure the images are piped correctly. [ '-vf', `${ speed ? `setpts=${1 / speed}*PTS,` : '' - }crop='min(${width},iw):min(${height},ih):${0}:${0}',pad=${width}:${height}:${0}:${0}${ + }crop='min(${width},iw):min(${height},ih):0:0',pad=${width}:${height}:0:0${ crop ? `,crop=${crop.width}:${crop.height}:${crop.x}:${crop.y}` : '' }${scale ? `,scale=iw*${scale}:-1` : ''}`, ], @@ -204,7 +204,7 @@ export class ScreenRecorder extends PassThrough { // Sets the quality. Lower the better. ['-crf', `${CRF_VALUE}`], // Sets the quality and how efficient the compression will be. - ['-deadline', 'realtime', '-cpu-used', `${8}`], + ['-deadline', 'realtime', '-cpu-used', '8'], ].flat(); case 'gif': return [ diff --git a/packages/puppeteer-core/src/util/ErrorLike.ts b/packages/puppeteer-core/src/util/ErrorLike.ts index eec3218f282..afe8acbd47d 100644 --- a/packages/puppeteer-core/src/util/ErrorLike.ts +++ b/packages/puppeteer-core/src/util/ErrorLike.ts @@ -62,7 +62,7 @@ export function rewriteError( export function createProtocolErrorMessage(object: { error: {message: string; data: any; code: number}; }): string { - let message = `${object.error.message}`; + let message = object.error.message; // TODO: remove the type checks when we stop connecting to BiDi with a CDP // client. if (