Skip to content

Commit 506fef8

Browse files
authored
refactor: remove unused args in calls to getBuildSettings (#7182)
* refactor: remove unused args in calls to `getBuildSettings` * build: fix a few suppressed eslint errors * fix: undo nullish check regression
1 parent b3fd702 commit 506fef8

File tree

3 files changed

+10
-24
lines changed

3 files changed

+10
-24
lines changed

eslint_temporary_suppressions.js

-8
Original file line numberDiff line numberDiff line change
@@ -973,21 +973,13 @@ export default [
973973
files: ['src/utils/init/config-github.ts'],
974974
rules: {
975975
'@typescript-eslint/no-unsafe-assignment': 'off',
976-
'@typescript-eslint/restrict-template-expressions': 'off',
977976
'@typescript-eslint/prefer-optional-chain': 'off',
978977
'@typescript-eslint/no-unnecessary-condition': 'off',
979978
'@typescript-eslint/no-unsafe-call': 'off',
980979
'@typescript-eslint/no-unsafe-member-access': 'off',
981980
'@typescript-eslint/no-unsafe-return': 'off',
982981
},
983982
},
984-
{
985-
files: ['src/utils/init/config-manual.ts'],
986-
rules: {
987-
'@typescript-eslint/restrict-template-expressions': 'off',
988-
'@typescript-eslint/no-unsafe-assignment': 'off',
989-
},
990-
},
991983
{
992984
files: ['src/utils/init/config.ts'],
993985
rules: {

src/utils/init/config-github.ts

+3-8
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ const PAGE_SIZE = 100
1919
* Get a valid GitHub token
2020
*/
2121
export const getGitHubToken = async ({ globalConfig }: { globalConfig: GlobalConfigStore }): Promise<string> => {
22-
const userId = globalConfig.get('userId')
22+
const userId: string = globalConfig.get('userId')
2323

24-
const githubToken: Token = globalConfig.get(`users.${userId}.auth.github`)
24+
const githubToken: Token | undefined = globalConfig.get(`users.${userId}.auth.github`)
2525

26-
if (githubToken && githubToken.user && githubToken.token) {
26+
if (githubToken?.user && githubToken.token) {
2727
try {
2828
const octokit = getGitHubClient(githubToken.token)
2929
const { status } = await octokit.rest.users.getAuthenticated()
@@ -229,16 +229,11 @@ export const configGithub = async ({
229229
config,
230230
globalConfig,
231231
repositoryRoot,
232-
site: { root: siteRoot },
233232
} = netlify
234233

235234
const token = await getGitHubToken({ globalConfig })
236235

237236
const { baseDir, buildCmd, buildDir, functionsDir, pluginsToInstall } = await getBuildSettings({
238-
// @ts-expect-error -- XXX(serhalp): unused - removed in stacked PR
239-
repositoryRoot,
240-
// XXX(serhalp): unused - removed in stacked PR
241-
siteRoot,
242237
config,
243238
command,
244239
})

src/utils/init/config-manual.ts

+7-8
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,21 @@ import { createDeployKey, type DeployKey, getBuildSettings, saveNetlifyToml, set
1111
*/
1212
const addDeployKey = async (deployKey: DeployKey) => {
1313
log('\nGive this Netlify SSH public key access to your repository:\n')
14+
// FIXME(serhalp): Handle nullish `deployKey.public_key` by throwing user-facing error or fixing upstream type.
15+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
1416
log(`\n${deployKey.public_key}\n\n`)
1517

16-
const { sshKeyAdded } = await inquirer.prompt([
18+
const { sshKeyAdded } = (await inquirer.prompt([
1719
{
1820
type: 'confirm',
1921
name: 'sshKeyAdded',
2022
message: 'Continue?',
2123
default: true,
2224
},
23-
])
25+
])) as { sshKeyAdded: boolean }
2426

2527
if (!sshKeyAdded) {
26-
exit()
28+
return exit()
2729
}
2830
}
2931

@@ -43,6 +45,8 @@ const getRepoPath = async ({ repoData }: { repoData: RepoData }): Promise<string
4345

4446
const addDeployHook = async (deployHook: string | undefined): Promise<boolean> => {
4547
log('\nConfigure the following webhook for your repository:\n')
48+
// FIXME(serhalp): Handle nullish `deployHook` by throwing user-facing error or fixing upstream type.
49+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
4650
log(`\n${deployHook}\n\n`)
4751
const { deployHookAdded } = (await inquirer.prompt([
4852
{
@@ -71,14 +75,9 @@ export default async function configManual({
7175
cachedConfig: { configPath },
7276
config,
7377
repositoryRoot,
74-
site: { root: siteRoot },
7578
} = netlify
7679

7780
const { baseDir, buildCmd, buildDir, functionsDir, pluginsToInstall } = await getBuildSettings({
78-
// @ts-expect-error -- XXX(serhalp): unused - removed in stacked PR
79-
repositoryRoot,
80-
// XXX(serhalp): unused - removed in stacked PR
81-
siteRoot,
8281
config,
8382
command,
8483
})

0 commit comments

Comments
 (0)