chore: enable no-useless-template-literals rule (#11573)

This commit is contained in:
Nikolay Vitkov 2024-01-02 13:35:01 +01:00 committed by GitHub
parent 66aa770038
commit 42b03a67d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 8 deletions

View File

@ -185,6 +185,7 @@ module.exports = {
'@typescript-eslint/explicit-function-return-type': 'off', '@typescript-eslint/explicit-function-return-type': 'off',
// We allow non-null assertions if the value was asserted using `assert` API. // We allow non-null assertions if the value was asserted using `assert` API.
'@typescript-eslint/no-non-null-assertion': 'off', '@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-useless-template-literals': 'error',
/** /**
* This is the default options (as per * This is the default options (as per
* https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/docs/rules/ban-types.md), * https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/docs/rules/ban-types.md),

View File

@ -324,7 +324,7 @@ export function getFeatures(flag: string, options: string[] = []): string[] {
return s.startsWith(flag.endsWith('=') ? flag : `${flag}=`); return s.startsWith(flag.endsWith('=') ? flag : `${flag}=`);
}) })
.map(s => { .map(s => {
return s.split(new RegExp(`${flag}` + '=\\s*'))[1]?.trim(); return s.split(new RegExp(`${flag}=\\s*`))[1]?.trim();
}) })
.filter(s => { .filter(s => {
return s; return s;

View File

@ -99,11 +99,11 @@ export class ScreenRecorder extends PassThrough {
// Reduces initial buffering while analyzing input fps and other stats. // Reduces initial buffering while analyzing input fps and other stats.
[ [
'-fpsprobesize', '-fpsprobesize',
`${0}`, '0',
'-probesize', '-probesize',
`${32}`, '32',
'-analyzeduration', '-analyzeduration',
`${0}`, '0',
'-fflags', '-fflags',
'nobuffer', 'nobuffer',
], ],
@ -120,13 +120,13 @@ export class ScreenRecorder extends PassThrough {
// Specifies the encoding and format we are using. // Specifies the encoding and format we are using.
this.#getFormatArgs(format ?? 'webm'), this.#getFormatArgs(format ?? 'webm'),
// Disable bitrate. // Disable bitrate.
['-b:v', `${0}`], ['-b:v', '0'],
// Filters to ensure the images are piped correctly. // Filters to ensure the images are piped correctly.
[ [
'-vf', '-vf',
`${ `${
speed ? `setpts=${1 / speed}*PTS,` : '' 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}` : '' crop ? `,crop=${crop.width}:${crop.height}:${crop.x}:${crop.y}` : ''
}${scale ? `,scale=iw*${scale}:-1` : ''}`, }${scale ? `,scale=iw*${scale}:-1` : ''}`,
], ],
@ -204,7 +204,7 @@ export class ScreenRecorder extends PassThrough {
// Sets the quality. Lower the better. // Sets the quality. Lower the better.
['-crf', `${CRF_VALUE}`], ['-crf', `${CRF_VALUE}`],
// Sets the quality and how efficient the compression will be. // Sets the quality and how efficient the compression will be.
['-deadline', 'realtime', '-cpu-used', `${8}`], ['-deadline', 'realtime', '-cpu-used', '8'],
].flat(); ].flat();
case 'gif': case 'gif':
return [ return [

View File

@ -62,7 +62,7 @@ export function rewriteError(
export function createProtocolErrorMessage(object: { export function createProtocolErrorMessage(object: {
error: {message: string; data: any; code: number}; error: {message: string; data: any; code: number};
}): string { }): 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 // TODO: remove the type checks when we stop connecting to BiDi with a CDP
// client. // client.
if ( if (