Skip to content

chore: Fix linting errors #1441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion commands/account/clean.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import SpinniesManager from '../../lib/ui/SpinniesManager';
import { uiAccountDescription } from '../../lib/ui';
import { CommonArgs, ConfigArgs } from '../../types/Yargs';


export const command = 'clean';
export const describe = i18n(`commands.account.subcommands.clean.describe`);

Expand Down
30 changes: 23 additions & 7 deletions commands/account/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { i18n } from '../../lib/lang';
import { getTableContents } from '../../lib/ui/table';
import { CommonArgs, ConfigArgs } from '../../types/Yargs';


export const describe = i18n(`commands.account.subcommands.info.describe`);
export const command = 'info [account]';

Expand All @@ -32,24 +31,41 @@ export async function handler(
scopeGroups = response.scopeGroups.map(s => [s]);

logger.log(i18n(`commands.account.subcommands.info.name`, { name: name! }));
logger.log(i18n(`commands.account.subcommands.info.accountId`, { accountId: derivedAccountId }));
logger.log(
i18n(`commands.account.subcommands.info.accountId`, {
accountId: derivedAccountId,
})
);
logger.log(i18n(`commands.account.subcommands.info.scopeGroups`));
logger.log(getTableContents(scopeGroups, { border: { bodyLeft: ' ' } }));
} else {
logger.log(i18n(`commands.account.subcommands.info.errors.notUsingPersonalAccessKey`));
logger.log(
i18n(`commands.account.subcommands.info.errors.notUsingPersonalAccessKey`)
);
}
}

function accountInfoBuilder(yargs: Argv): Argv<AccountInfoArgs> {
yargs.positional('account', {
describe: i18n(`commands.account.subcommands.info.options.account.describe`),
describe: i18n(
`commands.account.subcommands.info.options.account.describe`
),
type: 'string',
});

yargs.example([
['$0 accounts info', i18n(`commands.account.subcommands.info.examples.default`)],
['$0 accounts info MyAccount', i18n(`commands.account.subcommands.info.examples.nameBased`)],
['$0 accounts info 1234567', i18n(`commands.account.subcommands.info.examples.idBased`)],
[
'$0 accounts info',
i18n(`commands.account.subcommands.info.examples.default`),
],
[
'$0 accounts info MyAccount',
i18n(`commands.account.subcommands.info.examples.nameBased`),
],
[
'$0 accounts info 1234567',
i18n(`commands.account.subcommands.info.examples.idBased`),
],
]);

return yargs as Argv<AccountInfoArgs>;
Expand Down
6 changes: 5 additions & 1 deletion commands/account/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ export async function handler(
])
);

logger.log(i18n('commands.account.subcommands.list.configPath', { configPath: configPath! }));
logger.log(
i18n('commands.account.subcommands.list.configPath', {
configPath: configPath!,
})
);
logger.log(
i18n('commands.account.subcommands.list.defaultAccount', {
account: getConfigDefaultAccount()!,
Expand Down
19 changes: 14 additions & 5 deletions commands/account/remove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { selectAccountFromConfig } from '../../lib/prompts/accountsPrompt';
import { addConfigOptions } from '../../lib/commonOpts';
import { CommonArgs, ConfigArgs } from '../../types/Yargs';


export const command = 'remove [account]';
export const describe = i18n(`commands.account.subcommands.remove.describe`);

Expand Down Expand Up @@ -64,7 +63,9 @@ export async function handler(

if (accountToRemove === currentDefaultAccount) {
logger.log();
logger.log(i18n(`commands.account.subcommands.remove.logs.replaceDefaultAccount`));
logger.log(
i18n(`commands.account.subcommands.remove.logs.replaceDefaultAccount`)
);
const newDefaultAccount = await selectAccountFromConfig();
updateDefaultAccount(newDefaultAccount);
}
Expand All @@ -74,13 +75,21 @@ export function builder(yargs: Argv): Argv<AccountRemoveArgs> {
addConfigOptions(yargs);

yargs.positional('account', {
describe: i18n(`commands.account.subcommands.remove.options.account.describe`),
describe: i18n(
`commands.account.subcommands.remove.options.account.describe`
),
type: 'string',
});

yargs.example([
['$0 accounts remove', i18n(`commands.account.subcommands.remove.examples.default`)],
['$0 accounts remove MyAccount', i18n(`commands.account.subcommands.remove.examples.byName`)],
[
'$0 accounts remove',
i18n(`commands.account.subcommands.remove.examples.default`),
],
[
'$0 accounts remove MyAccount',
i18n(`commands.account.subcommands.remove.examples.byName`),
],
]);

return yargs as Argv<AccountRemoveArgs>;
Expand Down
9 changes: 6 additions & 3 deletions commands/account/rename.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { CommonArgs, ConfigArgs } from '../../types/Yargs';
import { logError } from '../../lib/errorHandlers';
import { EXIT_CODES } from '../../lib/enums/exitCodes';


export const command = 'rename <account-name> <new-name>';
export const describe = i18n(`commands.account.subcommands.rename.describe`);

Expand Down Expand Up @@ -46,11 +45,15 @@ export function builder(yargs: Argv): Argv<AccountRenameArgs> {
addAccountOptions(yargs);

yargs.positional('account-name', {
describe: i18n(`commands.account.subcommands.rename.positionals.accountName.describe`),
describe: i18n(
`commands.account.subcommands.rename.positionals.accountName.describe`
),
type: 'string',
});
yargs.positional('new-name', {
describe: i18n(`commands.account.subcommands.rename.positionals.newName.describe`),
describe: i18n(
`commands.account.subcommands.rename.positionals.newName.describe`
),
type: 'string',
});

Expand Down
15 changes: 12 additions & 3 deletions commands/account/use.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,18 @@ export function builder(yargs: Argv): Argv<AccountUseArgs> {
});

yargs.example([
['$0 accounts use', i18n('commands.account.subcommands.use.examples.default')],
['$0 accounts use MyAccount', i18n('commands.account.subcommands.use.examples.nameBased')],
['$0 accounts use 1234567', i18n('commands.account.subcommands.use.examples.idBased')],
[
'$0 accounts use',
i18n('commands.account.subcommands.use.examples.default'),
],
[
'$0 accounts use MyAccount',
i18n('commands.account.subcommands.use.examples.nameBased'),
],
[
'$0 accounts use 1234567',
i18n('commands.account.subcommands.use.examples.idBased'),
],
]);

return yargs as Argv<AccountUseArgs>;
Expand Down
13 changes: 9 additions & 4 deletions commands/cms/getReactModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const { trackCommandUsage } = require('../../lib/usageTracking');
const { listPrompt } = require('../../lib/prompts/promptUtils');
const { EXIT_CODES } = require('../../lib/enums/exitCodes');


exports.command = 'get-react-module [name] [dest]';
exports.describe = i18n(`commands.cms.subcommands.getReactModule.describe`);

Expand Down Expand Up @@ -62,7 +61,9 @@ exports.handler = async options => {
);
} catch (e) {
if (e.cause && e.cause.code === 'ERR_BAD_REQUEST') {
logger.error(i18n(`commands.cms.subcommands.getReactModule.errors.invalidName`));
logger.error(
i18n(`commands.cms.subcommands.getReactModule.errors.invalidName`)
);
} else {
logError(e);
}
Expand All @@ -72,11 +73,15 @@ exports.handler = async options => {

exports.builder = yargs => {
yargs.positional('name', {
describe: i18n(`commands.cms.subcommands.getReactModule.positionals.name.describe`),
describe: i18n(
`commands.cms.subcommands.getReactModule.positionals.name.describe`
),
type: 'string',
});
yargs.positional('dest', {
describe: i18n(`commands.cms.subcommands.getReactModule.positionals.dest.describe`),
describe: i18n(
`commands.cms.subcommands.getReactModule.positionals.dest.describe`
),
type: 'string',
});
return yargs;
Expand Down
70 changes: 55 additions & 15 deletions commands/cms/lighthouseScore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const { HUBSPOT_FOLDER, MARKETPLACE_FOLDER } = require('../../lib/constants');
const { uiLink } = require('../../lib/ui');
const { EXIT_CODES } = require('../../lib/enums/exitCodes');


const DEFAULT_TABLE_HEADER = [
'Accessibility',
'Best practices',
Expand All @@ -37,7 +36,9 @@ const selectTheme = async accountId => {
type: 'list',
look: false,
name: 'theme',
message: i18n(`commands.cms.subcommands.lighthouseScore.info.promptMessage`),
message: i18n(
`commands.cms.subcommands.lighthouseScore.info.promptMessage`
),
choices: async () => {
try {
const { data: result } = await fetchThemes(accountId, {
Expand All @@ -54,7 +55,11 @@ const selectTheme = async accountId => {
);
}
} catch (err) {
logger.error(i18n(`commands.cms.subcommands.lighthouseScore.errors.failedToFetchThemes`));
logger.error(
i18n(
`commands.cms.subcommands.lighthouseScore.errors.failedToFetchThemes`
)
);
process.exit(EXIT_CODES.ERROR);
}
},
Expand Down Expand Up @@ -83,7 +88,9 @@ exports.handler = async options => {
}
if (!isValidTheme) {
logger.error(
i18n(`commands.cms.subcommands.lighthouseScore.errors.themeNotFound`, { theme: themeToCheck })
i18n(`commands.cms.subcommands.lighthouseScore.errors.themeNotFound`, {
theme: themeToCheck,
})
);
process.exit(EXIT_CODES.ERROR);
}
Expand All @@ -104,7 +111,11 @@ exports.handler = async options => {
}

if (!requestResult || !requestResult.mobileId || !requestResult.desktopId) {
logger.error(i18n(`commands.cms.subcommands.lighthouseScore.errors.failedToGetLighthouseScore`));
logger.error(
i18n(
`commands.cms.subcommands.lighthouseScore.errors.failedToGetLighthouseScore`
)
);
process.exit(EXIT_CODES.ERROR);
}

Expand All @@ -113,7 +124,10 @@ exports.handler = async options => {
SpinniesManager.init();

SpinniesManager.add('lighthouseScore', {
text: i18n(`commands.cms.subcommands.lighthouseScore.info.generatingScore`, { theme: themeToCheck }),
text: i18n(
`commands.cms.subcommands.lighthouseScore.info.generatingScore`,
{ theme: themeToCheck }
),
});

const checkScoreStatus = async () => {
Expand Down Expand Up @@ -183,7 +197,11 @@ exports.handler = async options => {
verboseViewAverageScoreResult = data;
}
} catch (err) {
logger.error(i18n(`commands.cms.subcommands.lighthouseScore.errors.failedToGetLighthouseScore`));
logger.error(
i18n(
`commands.cms.subcommands.lighthouseScore.errors.failedToGetLighthouseScore`
)
);
process.exit(EXIT_CODES.ERROR);
}

Expand All @@ -209,7 +227,11 @@ exports.handler = async options => {
border: { bodyLeft: ' ' },
})
);
logger.log(i18n(`commands.cms.subcommands.lighthouseScore.info.pageTemplateScoreTitle`));
logger.log(
i18n(
`commands.cms.subcommands.lighthouseScore.info.pageTemplateScoreTitle`
)
);

const table2Header = getTableHeader([
'Template path',
Expand All @@ -236,22 +258,32 @@ exports.handler = async options => {
})
);

logger.log(i18n(`commands.cms.subcommands.lighthouseScore.info.lighthouseLinksTitle`));
logger.log(
i18n(`commands.cms.subcommands.lighthouseScore.info.lighthouseLinksTitle`)
);

scoreResult.scores.forEach(score => {
logger.log(' ', uiLink(score.templatePath, score.link));
});

if (scoreResult.failedTemplatePaths.length) {
logger.log();
logger.error(i18n(`commands.cms.subcommands.lighthouseScore.info.failedTemplatePathsTitle`));
logger.error(
i18n(
`commands.cms.subcommands.lighthouseScore.info.failedTemplatePathsTitle`
)
);
scoreResult.failedTemplatePaths.forEach(failedTemplatePath => {
logger.log(' ', failedTemplatePath);
});
}

logger.log();
logger.info(i18n(`commands.cms.subcommands.lighthouseScore.info.targetDeviceNote`, { target }));
logger.info(
i18n(`commands.cms.subcommands.lighthouseScore.info.targetDeviceNote`, {
target,
})
);
} else {
logger.log(`Theme: ${themeToCheck}`);
const tableHeader = getTableHeader(['Target', ...DEFAULT_TABLE_HEADER]);
Expand Down Expand Up @@ -279,7 +311,9 @@ exports.handler = async options => {
})
);

logger.info(i18n(`commands.cms.subcommands.lighthouseScore.info.verboseOptionNote`));
logger.info(
i18n(`commands.cms.subcommands.lighthouseScore.info.verboseOptionNote`)
);
}

logger.log();
Expand All @@ -295,17 +329,23 @@ exports.handler = async options => {

exports.builder = yargs => {
yargs.option('theme', {
describe: i18n(`commands.cms.subcommands.lighthouseScore.options.theme.describe`),
describe: i18n(
`commands.cms.subcommands.lighthouseScore.options.theme.describe`
),
type: 'string',
});
yargs.option('target', {
describe: i18n(`commands.cms.subcommands.lighthouseScore.options.target.describe`),
describe: i18n(
`commands.cms.subcommands.lighthouseScore.options.target.describe`
),
type: 'string',
choices: ['desktop', 'mobile'],
default: 'desktop',
});
yargs.option('verbose', {
describe: i18n(`commands.cms.subcommands.lighthouseScore.options.verbose.describe`),
describe: i18n(
`commands.cms.subcommands.lighthouseScore.options.verbose.describe`
),
boolean: true,
default: false,
});
Expand Down
Loading