diff --git a/.prettierignore b/.prettierignore index a712d06c958..fdffc5394d3 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,2 +1,3 @@ node_modules src/**/*.mjs +src/**/*.d.mts diff --git a/package.json b/package.json index 1baa4c3b293..4be6acf05e3 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,7 @@ }, "config": { "eslint": "--cache --format=codeframe --max-warnings=0 \"{src,scripts,tests,.github}/**/*.{mjs,cjs,js,md,html}\" \"*.{mjs,cjs,js,md,html}\" \".*.{mjs,cjs,js,md,html}\"", - "prettier": "--ignore-path .eslintignore --loglevel=warn \"{src,tools,scripts,tests,.github}/**/*.{mjs,cjs,js,md,yml,json,html}\" \"*.{mjs,cjs,js,yml,json,html}\" \".*.{mjs,cjs,js,yml,json,html}\" \"!CHANGELOG.md\" \"!**/*/package-lock.json\" \"!.github/**/*.md\"" + "prettier": "--ignore-path .eslintignore --loglevel=warn \"{src,tools,scripts,tests,.github}/**/*.{mjs,cjs,js,mts,md,yml,json,html}\" \"*.{mjs,cjs,js,mts,yml,json,html}\" \".*.{mjs,cjs,js,yml,json,html}\" \"!CHANGELOG.md\" \"!**/*/package-lock.json\" \"!.github/**/*.md\"" }, "dependencies": { "@bugsnag/js": "7.20.2", diff --git a/src/commands/addons/addons-auth.mts b/src/commands/addons/addons-auth.mts index 5845cddd36a..2e317e11cf6 100644 --- a/src/commands/addons/addons-auth.mts +++ b/src/commands/addons/addons-auth.mts @@ -1,4 +1,3 @@ - import { ADDON_VALIDATION, prepareAddonCommand } from '../../utils/addons/prepare.mjs' import { exit, log } from '../../utils/command-helpers.mjs' import openBrowser from '../../utils/open-browser.mjs' diff --git a/src/commands/addons/addons-config.mts b/src/commands/addons/addons-config.mts index ea9f6754aca..cc5d718306c 100644 --- a/src/commands/addons/addons-config.mts +++ b/src/commands/addons/addons-config.mts @@ -1,4 +1,3 @@ - import inquirer from 'inquirer' import isEmpty from 'lodash/isEmpty.js' diff --git a/src/commands/addons/addons-create.mts b/src/commands/addons/addons-create.mts index 5dc9520a6d2..30272f552b6 100644 --- a/src/commands/addons/addons-create.mts +++ b/src/commands/addons/addons-create.mts @@ -1,4 +1,3 @@ - import inquirer from 'inquirer' import isEmpty from 'lodash/isEmpty.js' diff --git a/src/commands/addons/addons-delete.mts b/src/commands/addons/addons-delete.mts index 71967918636..16859156541 100644 --- a/src/commands/addons/addons-delete.mts +++ b/src/commands/addons/addons-delete.mts @@ -1,4 +1,3 @@ - import inquirer from 'inquirer' import { ADDON_VALIDATION, prepareAddonCommand } from '../../utils/addons/prepare.mjs' diff --git a/src/commands/addons/addons-list.mts b/src/commands/addons/addons-list.mts index f3d1726d127..4e8e642a3de 100644 --- a/src/commands/addons/addons-list.mts +++ b/src/commands/addons/addons-list.mts @@ -1,5 +1,3 @@ - - import AsciiTable from 'ascii-table' import { prepareAddonCommand } from '../../utils/addons/prepare.mjs' diff --git a/src/commands/addons/addons.mts b/src/commands/addons/addons.mts index 307787b3ea7..089c2f714be 100644 --- a/src/commands/addons/addons.mts +++ b/src/commands/addons/addons.mts @@ -1,4 +1,3 @@ - import { createAddonsAuthCommand } from './addons-auth.mjs' import { createAddonsConfigCommand } from './addons-config.mjs' import { createAddonsCreateCommand } from './addons-create.mjs' diff --git a/src/commands/api/api.mts b/src/commands/api/api.mts index a4a2f72f010..eb59e0b2151 100644 --- a/src/commands/api/api.mts +++ b/src/commands/api/api.mts @@ -1,5 +1,3 @@ - - import AsciiTable from 'ascii-table' import { methods } from 'netlify' diff --git a/src/commands/build/build.mts b/src/commands/build/build.mts index 2195df3b665..f06a8edaa1d 100644 --- a/src/commands/build/build.mts +++ b/src/commands/build/build.mts @@ -1,4 +1,3 @@ - import process from 'process' import { getBuildOptions, runBuild } from '../../lib/build.mjs' diff --git a/src/commands/completion/completion.mts b/src/commands/completion/completion.mts index bb0d68b3dff..fa9e1c9afc9 100644 --- a/src/commands/completion/completion.mts +++ b/src/commands/completion/completion.mts @@ -52,12 +52,14 @@ export const createCompletionCommand = (program) => { }) }) - return program - .command('completion') - .description('Generate shell completion script\nRun this command to see instructions for your shell.') - .addExamples(['netlify completion:install']) - // @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type. - .action((options, command) => { - command.help() - }) + return ( + program + .command('completion') + .description('Generate shell completion script\nRun this command to see instructions for your shell.') + .addExamples(['netlify completion:install']) + // @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type. + .action((options, command) => { + command.help() + }) + ) } diff --git a/src/commands/dev/dev.mts b/src/commands/dev/dev.mts index a06670bf808..2a5a765b3c3 100644 --- a/src/commands/dev/dev.mts +++ b/src/commands/dev/dev.mts @@ -1,4 +1,3 @@ - import process from 'process' import { Option } from 'commander' @@ -249,107 +248,109 @@ const dev = async (options, command) => { export const createDevCommand = (program) => { createDevExecCommand(program) - return program - .command('dev') - .alias('develop') - .description( - `Local dev server\nThe dev command will run a local dev server with Netlify's proxy and redirect rules`, - ) - .option('-c ,--command ', 'command to run') - .option( - '--context ', - 'Specify a deploy context or branch for environment variables (contexts: "production", "deploy-preview", "branch-deploy", "dev")', - normalizeContext, - ) - // @ts-expect-error TS(7006) FIXME: Parameter 'value' implicitly has an 'any' type. - .option('-p ,--port ', 'port of netlify dev', (value) => Number.parseInt(value)) - .addOption( - new Option('--targetPort ', 'Old, prefer --target-port. Port of target app server') - .argParser((value) => Number.parseInt(value)) - .hideHelp(true), - ) - .addOption(new Option('--no-open', 'disables the automatic opening of a browser window')) - // @ts-expect-error TS(7006) FIXME: Parameter 'value' implicitly has an 'any' type. - .option('--target-port ', 'port of target app server', (value) => Number.parseInt(value)) - .option('--framework ', 'framework to use. Defaults to #auto which automatically detects a framework') - .option('-d ,--dir ', 'dir with static files') - .option('-f ,--functions ', 'specify a functions folder to serve') - .option('-o ,--offline', 'disables any features that require network access') - .option( - '-l, --live [subdomain]', - 'start a public live session; optionally, supply a subdomain to generate a custom URL', - false, - ) - .addOption( - new Option('--functionsPort ', 'Old, prefer --functions-port. Port of functions server') - .argParser((value) => Number.parseInt(value)) - .hideHelp(true), - ) - // @ts-expect-error TS(7006) FIXME: Parameter 'value' implicitly has an 'any' type. - .option('--functions-port ', 'port of functions server', (value) => Number.parseInt(value)) - .addOption( - new Option( - '--geo ', - 'force geolocation data to be updated, use cached data from the last 24h if found, or use a mock location', + return ( + program + .command('dev') + .alias('develop') + .description( + `Local dev server\nThe dev command will run a local dev server with Netlify's proxy and redirect rules`, ) - .choices(['cache', 'mock', 'update']) - .default('cache'), - ) - .addOption( - new Option( - '--country ', - 'Two-letter country code (https://ntl.fyi/country-codes) to use as mock geolocation (enables --geo=mock automatically)', - ).argParser(getGeoCountryArgParser('netlify dev --geo=mock --country=FR')), - ) - .addOption( - new Option('--staticServerPort ', 'port of the static app server used when no framework is detected') - .argParser((value) => Number.parseInt(value)) - .hideHelp(), - ) - .addOption( - new Option( - '-e, --edgeInspect [address]', - 'Old, prefer --edge-inspect. Enable the V8 Inspector Protocol for Edge Functions, with an optional address in the host:port format', + .option('-c ,--command ', 'command to run') + .option( + '--context ', + 'Specify a deploy context or branch for environment variables (contexts: "production", "deploy-preview", "branch-deploy", "dev")', + normalizeContext, ) - .conflicts('edgeInspectBrk') - .argParser(validateShortFlagArgs) - .hideHelp(true), - ) - .addOption( - new Option( - '-e, --edge-inspect [address]', - 'enable the V8 Inspector Protocol for Edge Functions, with an optional address in the host:port format', + // @ts-expect-error TS(7006) FIXME: Parameter 'value' implicitly has an 'any' type. + .option('-p ,--port ', 'port of netlify dev', (value) => Number.parseInt(value)) + .addOption( + new Option('--targetPort ', 'Old, prefer --target-port. Port of target app server') + .argParser((value) => Number.parseInt(value)) + .hideHelp(true), ) - .conflicts('edgeInspectBrk') - .argParser(validateShortFlagArgs), - ) - .addOption( - new Option( - '-E, --edgeInspectBrk [address]', - 'Old, prefer --edge-inspect-brk. Enable the V8 Inspector Protocol for Edge Functions and pause execution on the first line of code, with an optional address in the host:port format', + .addOption(new Option('--no-open', 'disables the automatic opening of a browser window')) + // @ts-expect-error TS(7006) FIXME: Parameter 'value' implicitly has an 'any' type. + .option('--target-port ', 'port of target app server', (value) => Number.parseInt(value)) + .option('--framework ', 'framework to use. Defaults to #auto which automatically detects a framework') + .option('-d ,--dir ', 'dir with static files') + .option('-f ,--functions ', 'specify a functions folder to serve') + .option('-o ,--offline', 'disables any features that require network access') + .option( + '-l, --live [subdomain]', + 'start a public live session; optionally, supply a subdomain to generate a custom URL', + false, ) - .conflicts('edgeInspect') - .hideHelp(true) - .argParser(validateShortFlagArgs), - ) - .addOption( - new Option( - '-E, --edge-inspect-brk [address]', - 'enable the V8 Inspector Protocol for Edge Functions and pause execution on the first line of code, with an optional address in the host:port format', + .addOption( + new Option('--functionsPort ', 'Old, prefer --functions-port. Port of functions server') + .argParser((value) => Number.parseInt(value)) + .hideHelp(true), ) - .conflicts('edgeInspect') - .argParser(validateShortFlagArgs), - ) - .addExamples([ - 'netlify dev', - 'netlify dev -d public', - 'netlify dev -c "hugo server -w" --target-port 1313', - 'netlify dev --context production', - 'netlify dev --edge-inspect', - 'netlify dev --edge-inspect=127.0.0.1:9229', - 'netlify dev --edge-inspect-brk', - 'netlify dev --edge-inspect-brk=127.0.0.1:9229', - 'BROWSER=none netlify dev # disable browser auto opening', - ]) - .action(dev) + // @ts-expect-error TS(7006) FIXME: Parameter 'value' implicitly has an 'any' type. + .option('--functions-port ', 'port of functions server', (value) => Number.parseInt(value)) + .addOption( + new Option( + '--geo ', + 'force geolocation data to be updated, use cached data from the last 24h if found, or use a mock location', + ) + .choices(['cache', 'mock', 'update']) + .default('cache'), + ) + .addOption( + new Option( + '--country ', + 'Two-letter country code (https://ntl.fyi/country-codes) to use as mock geolocation (enables --geo=mock automatically)', + ).argParser(getGeoCountryArgParser('netlify dev --geo=mock --country=FR')), + ) + .addOption( + new Option('--staticServerPort ', 'port of the static app server used when no framework is detected') + .argParser((value) => Number.parseInt(value)) + .hideHelp(), + ) + .addOption( + new Option( + '-e, --edgeInspect [address]', + 'Old, prefer --edge-inspect. Enable the V8 Inspector Protocol for Edge Functions, with an optional address in the host:port format', + ) + .conflicts('edgeInspectBrk') + .argParser(validateShortFlagArgs) + .hideHelp(true), + ) + .addOption( + new Option( + '-e, --edge-inspect [address]', + 'enable the V8 Inspector Protocol for Edge Functions, with an optional address in the host:port format', + ) + .conflicts('edgeInspectBrk') + .argParser(validateShortFlagArgs), + ) + .addOption( + new Option( + '-E, --edgeInspectBrk [address]', + 'Old, prefer --edge-inspect-brk. Enable the V8 Inspector Protocol for Edge Functions and pause execution on the first line of code, with an optional address in the host:port format', + ) + .conflicts('edgeInspect') + .hideHelp(true) + .argParser(validateShortFlagArgs), + ) + .addOption( + new Option( + '-E, --edge-inspect-brk [address]', + 'enable the V8 Inspector Protocol for Edge Functions and pause execution on the first line of code, with an optional address in the host:port format', + ) + .conflicts('edgeInspect') + .argParser(validateShortFlagArgs), + ) + .addExamples([ + 'netlify dev', + 'netlify dev -d public', + 'netlify dev -c "hugo server -w" --target-port 1313', + 'netlify dev --context production', + 'netlify dev --edge-inspect', + 'netlify dev --edge-inspect=127.0.0.1:9229', + 'netlify dev --edge-inspect-brk', + 'netlify dev --edge-inspect-brk=127.0.0.1:9229', + 'BROWSER=none netlify dev # disable browser auto opening', + ]) + .action(dev) + ) } diff --git a/src/commands/env/env-clone.mts b/src/commands/env/env-clone.mts index 74b475f11fc..16065847815 100644 --- a/src/commands/env/env-clone.mts +++ b/src/commands/env/env-clone.mts @@ -1,4 +1,3 @@ - import { chalk, error as logError, log } from '../../utils/command-helpers.mjs' import { translateFromEnvelopeToMongo, translateFromMongoToEnvelope } from '../../utils/env/index.mjs' diff --git a/src/commands/env/env-import.mts b/src/commands/env/env-import.mts index b017e180dc3..9685a43ee85 100644 --- a/src/commands/env/env-import.mts +++ b/src/commands/env/env-import.mts @@ -1,7 +1,5 @@ - import { readFile } from 'fs/promises' - import AsciiTable from 'ascii-table' import { Option } from 'commander' import dotenv from 'dotenv' diff --git a/src/commands/env/env-set.mts b/src/commands/env/env-set.mts index 7b2bc0878a5..4cbaa4c1e8e 100644 --- a/src/commands/env/env-set.mts +++ b/src/commands/env/env-set.mts @@ -1,4 +1,3 @@ - import { Option } from 'commander' import { chalk, error, log, logJson } from '../../utils/command-helpers.mjs' diff --git a/src/commands/env/env-unset.mts b/src/commands/env/env-unset.mts index c5ab1f41671..999cc540947 100644 --- a/src/commands/env/env-unset.mts +++ b/src/commands/env/env-unset.mts @@ -1,4 +1,3 @@ - import { chalk, error, log, logJson } from '../../utils/command-helpers.mjs' import { AVAILABLE_CONTEXTS, normalizeContext, translateFromEnvelopeToMongo } from '../../utils/env/index.mjs' diff --git a/src/commands/env/env.mts b/src/commands/env/env.mts index d89e6c687b5..10e71db844e 100644 --- a/src/commands/env/env.mts +++ b/src/commands/env/env.mts @@ -1,4 +1,3 @@ - import { createEnvCloneCommand } from './env-clone.mjs' import { createEnvGetCommand } from './env-get.mjs' import { createEnvImportCommand } from './env-import.mjs' diff --git a/src/commands/functions/functions-build.mts b/src/commands/functions/functions-build.mts index 1ee96b123a8..8aa2fef56bd 100644 --- a/src/commands/functions/functions-build.mts +++ b/src/commands/functions/functions-build.mts @@ -1,4 +1,3 @@ - import { mkdir } from 'fs/promises' import { zipFunctions } from '@netlify/zip-it-and-ship-it' diff --git a/src/commands/functions/functions-create.mts b/src/commands/functions/functions-create.mts index 09927b58612..7d6c52b84e3 100644 --- a/src/commands/functions/functions-create.mts +++ b/src/commands/functions/functions-create.mts @@ -1,4 +1,3 @@ - import cp from 'child_process' import fs from 'fs' import { mkdir, readdir, unlink } from 'fs/promises' @@ -88,17 +87,21 @@ const filterRegistry = function (registry, input) { const filteredTemplateNames = new Set( filteredTemplates.map((filteredTemplate) => (input ? filteredTemplate.string : filteredTemplate)), ) - return registry - // @ts-expect-error TS(7006) FIXME: Parameter 't' implicitly has an 'any' type. - .filter((t) => filteredTemplateNames.has(t.name + t.description)) - // @ts-expect-error TS(7006) FIXME: Parameter 't' implicitly has an 'any' type. - .map((t) => { - // add the score - // @ts-expect-error TS(2339) FIXME: Property 'score' does not exist on type 'FilterRes... Remove this comment to see the full error message - const { score } = filteredTemplates.find((filteredTemplate) => filteredTemplate.string === t.name + t.description) - t.score = score - return t - }) + return ( + registry + // @ts-expect-error TS(7006) FIXME: Parameter 't' implicitly has an 'any' type. + .filter((t) => filteredTemplateNames.has(t.name + t.description)) + // @ts-expect-error TS(7006) FIXME: Parameter 't' implicitly has an 'any' type. + .map((t) => { + // add the score + // @ts-expect-error TS(2339) FIXME: Property 'score' does not exist on type 'FilterRes... Remove this comment to see the full error message + const { score } = filteredTemplates.find( + (filteredTemplate) => filteredTemplate.string === t.name + t.description, + ) + t.score = score + return t + }) + ) } /** @@ -177,8 +180,8 @@ const pickTemplate = async function ({ language: languageFromFlag }, funcType) { if (language === undefined) { const langs = funcType === 'edge' - // @ts-expect-error TS(2339) FIXME: Property 'value' does not exist on type 'false | {... Remove this comment to see the full error message - ? languages.filter((lang) => lang.value === 'javascript' || lang.value === 'typescript') + ? // @ts-expect-error TS(2339) FIXME: Property 'value' does not exist on type 'false | {... Remove this comment to see the full error message + languages.filter((lang) => lang.value === 'javascript' || lang.value === 'typescript') : languages.filter(Boolean) const { language: languageFromPrompt } = await inquirer.prompt({ diff --git a/src/commands/functions/functions-invoke.mts b/src/commands/functions/functions-invoke.mts index cd270098b3c..4eec9b36dec 100644 --- a/src/commands/functions/functions-invoke.mts +++ b/src/commands/functions/functions-invoke.mts @@ -1,4 +1,3 @@ - import fs from 'fs' import { createRequire } from 'module' import path from 'path' diff --git a/src/commands/functions/functions-serve.mts b/src/commands/functions/functions-serve.mts index 4c56c9d8aff..271fd95f852 100644 --- a/src/commands/functions/functions-serve.mts +++ b/src/commands/functions/functions-serve.mts @@ -1,4 +1,3 @@ - import { join } from 'path' import { startFunctionsServer } from '../../lib/functions/server.mjs' diff --git a/src/commands/functions/functions.mts b/src/commands/functions/functions.mts index f24daca4a09..e2ac1e58818 100644 --- a/src/commands/functions/functions.mts +++ b/src/commands/functions/functions.mts @@ -1,4 +1,3 @@ - import { chalk } from '../../utils/command-helpers.mjs' import { createFunctionsBuildCommand } from './functions-build.mjs' diff --git a/src/commands/init/init.mts b/src/commands/init/init.mts index e5e03667ff5..ee228403ea1 100644 --- a/src/commands/init/init.mts +++ b/src/commands/init/init.mts @@ -1,4 +1,3 @@ - import { Option } from 'commander' import inquirer from 'inquirer' import isEmpty from 'lodash/isEmpty.js' diff --git a/src/commands/integration/deploy.mts b/src/commands/integration/deploy.mts index 984bbd80ce7..20e2daa6abf 100644 --- a/src/commands/integration/deploy.mts +++ b/src/commands/integration/deploy.mts @@ -163,7 +163,7 @@ export async function registerIntegration(workingDir, siteId, accountId, localIn scopes: formatScopesForRemote(scopes), integrationLevel, }), - // @ts-expect-error TS(7006) FIXME: Parameter 'res' implicitly has an 'any' type. + // @ts-expect-error TS(7006) FIXME: Parameter 'res' implicitly has an 'any' type. }).then(async (res) => { const response = await res.json() return { body: response, statusCode: res.status } @@ -288,7 +288,7 @@ export async function updateIntegration( integrationLevel, }), }, - // @ts-expect-error TS(7006) FIXME: Parameter 'res' implicitly has an 'any' type. + // @ts-expect-error TS(7006) FIXME: Parameter 'res' implicitly has an 'any' type. ).then(async (res) => { const response = await res.json() return { updateResponse: response, statusCode: res.status } @@ -431,7 +431,7 @@ const deploy = async (options, command) => { 'netlify-token': token, }, }, - // @ts-expect-error TS(7006) FIXME: Parameter 'res' implicitly has an 'any' type. + // @ts-expect-error TS(7006) FIXME: Parameter 'res' implicitly has an 'any' type. ).then(async (res) => { const body = await res.json() return { body, statusCode: res.status } diff --git a/src/commands/link/link.mts b/src/commands/link/link.mts index b1c1270ee11..621fd63c3cc 100644 --- a/src/commands/link/link.mts +++ b/src/commands/link/link.mts @@ -1,4 +1,3 @@ - import { Option } from 'commander' import inquirer from 'inquirer' import isEmpty from 'lodash/isEmpty.js' diff --git a/src/commands/lm/lm-info.mts b/src/commands/lm/lm-info.mts index 052670a8b4f..4114278344e 100644 --- a/src/commands/lm/lm-info.mts +++ b/src/commands/lm/lm-info.mts @@ -1,4 +1,3 @@ - import { Listr } from 'listr2' import { diff --git a/src/commands/lm/lm-install.mts b/src/commands/lm/lm-install.mts index 6bf6b17edeb..6e5ef7bbcec 100644 --- a/src/commands/lm/lm-install.mts +++ b/src/commands/lm/lm-install.mts @@ -1,4 +1,3 @@ - import { installPlatform } from '../../utils/lm/install.mjs' import { printBanner } from '../../utils/lm/ui.mjs' diff --git a/src/commands/lm/lm-setup.mts b/src/commands/lm/lm-setup.mts index de1df6fc2b0..6cc81d229e3 100644 --- a/src/commands/lm/lm-setup.mts +++ b/src/commands/lm/lm-setup.mts @@ -1,4 +1,3 @@ - import { Listr } from 'listr2' import { error } from '../../utils/command-helpers.mjs' diff --git a/src/commands/lm/lm-uninstall.mts b/src/commands/lm/lm-uninstall.mts index c62e22c23d8..723ad3028c9 100644 --- a/src/commands/lm/lm-uninstall.mts +++ b/src/commands/lm/lm-uninstall.mts @@ -1,4 +1,3 @@ - import { uninstall } from '../../utils/lm/install.mjs' /** diff --git a/src/commands/lm/lm.mts b/src/commands/lm/lm.mts index 992464d669e..609ffb17cee 100644 --- a/src/commands/lm/lm.mts +++ b/src/commands/lm/lm.mts @@ -1,4 +1,3 @@ - import { createLmInfoCommand } from './lm-info.mjs' import { createLmInstallCommand } from './lm-install.mjs' import { createLmSetupCommand } from './lm-setup.mjs' diff --git a/src/commands/login/login.mts b/src/commands/login/login.mts index 73451e51fe3..e7ffe39abe3 100644 --- a/src/commands/login/login.mts +++ b/src/commands/login/login.mts @@ -1,4 +1,3 @@ - import { chalk, exit, getToken, log } from '../../utils/command-helpers.mjs' // @ts-expect-error TS(7006) FIXME: Parameter 'location' implicitly has an 'any' type. diff --git a/src/commands/logout/logout.mts b/src/commands/logout/logout.mts index d7efe299063..32e6fb9ac14 100644 --- a/src/commands/logout/logout.mts +++ b/src/commands/logout/logout.mts @@ -1,4 +1,3 @@ - import { exit, getToken, log } from '../../utils/command-helpers.mjs' import { track } from '../../utils/telemetry/index.mjs' diff --git a/src/commands/recipes/recipes-list.mts b/src/commands/recipes/recipes-list.mts index d10aa8b9a2b..ec42dc76a76 100644 --- a/src/commands/recipes/recipes-list.mts +++ b/src/commands/recipes/recipes-list.mts @@ -1,5 +1,3 @@ - - import AsciiTable from 'ascii-table' import { listRecipes } from './common.mjs' diff --git a/src/commands/recipes/recipes.mts b/src/commands/recipes/recipes.mts index c64d32ef883..60df86946e7 100644 --- a/src/commands/recipes/recipes.mts +++ b/src/commands/recipes/recipes.mts @@ -1,4 +1,3 @@ - import { basename } from 'path' import { closest } from 'fastest-levenshtein' diff --git a/src/commands/serve/serve.mts b/src/commands/serve/serve.mts index 5fb31ba10f5..f05e28b73e1 100644 --- a/src/commands/serve/serve.mts +++ b/src/commands/serve/serve.mts @@ -1,4 +1,3 @@ - import process from 'process' import { Option } from 'commander' @@ -71,7 +70,7 @@ const serve = async (options, command) => { // Netlify Build are loaded. await getInternalFunctionsDir({ base: site.root, ensureExists: true }) - let settings = /** @type {import('../../utils/types.js').ServerSettings} */ ({}) + let settings = /** @type {import('../../utils/types.js').ServerSettings} */ {} try { settings = await detectServerSettings(devConfig, options, command) diff --git a/src/commands/sites/sites-create-template.mts b/src/commands/sites/sites-create-template.mts index 90b7977c8d7..6d9e2bce049 100644 --- a/src/commands/sites/sites-create-template.mts +++ b/src/commands/sites/sites-create-template.mts @@ -1,5 +1,3 @@ - - import inquirer from 'inquirer' import pick from 'lodash/pick.js' // @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'pars... Remove this comment to see the full error message @@ -21,15 +19,17 @@ import { getSiteNameInput } from './sites-create.mjs' export const fetchTemplates = async (token) => { const templatesFromGithubOrg = await getTemplatesFromGitHub(token) - return templatesFromGithubOrg - // @ts-expect-error TS(7006) FIXME: Parameter 'repo' implicitly has an 'any' type. - .filter((repo) => !repo.archived && !repo.disabled) - // @ts-expect-error TS(7006) FIXME: Parameter 'template' implicitly has an 'any' type. - .map((template) => ({ - name: template.name, - sourceCodeUrl: template.html_url, - slug: template.full_name, - })) + return ( + templatesFromGithubOrg + // @ts-expect-error TS(7006) FIXME: Parameter 'repo' implicitly has an 'any' type. + .filter((repo) => !repo.archived && !repo.disabled) + // @ts-expect-error TS(7006) FIXME: Parameter 'template' implicitly has an 'any' type. + .map((template) => ({ + name: template.name, + sourceCodeUrl: template.html_url, + slug: template.full_name, + })) + ) } // @ts-expect-error TS(7031) FIXME: Binding element 'ghToken' implicitly has an 'any' ... Remove this comment to see the full error message diff --git a/src/commands/sites/sites-create.mts b/src/commands/sites/sites-create.mts index 26d1403f515..f1612355106 100644 --- a/src/commands/sites/sites-create.mts +++ b/src/commands/sites/sites-create.mts @@ -1,4 +1,3 @@ - import { InvalidArgumentError } from 'commander' import inquirer from 'inquirer' import pick from 'lodash/pick.js' diff --git a/src/commands/sites/sites-delete.mts b/src/commands/sites/sites-delete.mts index 9d600324724..4826d7e57c6 100644 --- a/src/commands/sites/sites-delete.mts +++ b/src/commands/sites/sites-delete.mts @@ -1,4 +1,3 @@ - import inquirer from 'inquirer' import { chalk, error, exit, log } from '../../utils/command-helpers.mjs' diff --git a/src/commands/sites/sites-list.mts b/src/commands/sites/sites-list.mts index a3edbef24fc..5fe44f16ab7 100644 --- a/src/commands/sites/sites-list.mts +++ b/src/commands/sites/sites-list.mts @@ -1,4 +1,3 @@ - import { listSites } from '../../lib/api.mjs' import { startSpinner, stopSpinner } from '../../lib/spinner.mjs' import { chalk, log, logJson } from '../../utils/command-helpers.mjs' diff --git a/src/commands/sites/sites.mts b/src/commands/sites/sites.mts index 69728fa3f21..9a9c486334a 100644 --- a/src/commands/sites/sites.mts +++ b/src/commands/sites/sites.mts @@ -1,4 +1,3 @@ - import { createSitesFromTemplateCommand } from './sites-create-template.mjs' import { createSitesCreateCommand } from './sites-create.mjs' import { createSitesDeleteCommand } from './sites-delete.mjs' diff --git a/src/commands/status/status-hooks.mts b/src/commands/status/status-hooks.mts index 633a303f267..86fbc497396 100644 --- a/src/commands/status/status-hooks.mts +++ b/src/commands/status/status-hooks.mts @@ -1,4 +1,3 @@ - import prettyjson from 'prettyjson' import { log } from '../../utils/command-helpers.mjs' diff --git a/src/commands/switch/switch.mts b/src/commands/switch/switch.mts index b7a2ca702b7..767bed7183b 100644 --- a/src/commands/switch/switch.mts +++ b/src/commands/switch/switch.mts @@ -1,4 +1,3 @@ - import inquirer from 'inquirer' import { chalk, log } from '../../utils/command-helpers.mjs' diff --git a/src/commands/unlink/unlink.mts b/src/commands/unlink/unlink.mts index fa330fbffc9..2bddebf5ff7 100644 --- a/src/commands/unlink/unlink.mts +++ b/src/commands/unlink/unlink.mts @@ -1,4 +1,3 @@ - import { exit, log } from '../../utils/command-helpers.mjs' import { track } from '../../utils/telemetry/index.mjs' diff --git a/src/commands/watch/watch.mts b/src/commands/watch/watch.mts index 36074c30b0d..9b83c96908c 100644 --- a/src/commands/watch/watch.mts +++ b/src/commands/watch/watch.mts @@ -1,4 +1,3 @@ - import pWaitFor from 'p-wait-for' import prettyjson from 'prettyjson' diff --git a/src/lib/account.mts b/src/lib/account.mts index f9ab875b908..5d455b64813 100644 --- a/src/lib/account.mts +++ b/src/lib/account.mts @@ -1,5 +1,3 @@ - - /** * @param {any} account * @param {string} capability diff --git a/src/lib/completion/constants.mts b/src/lib/completion/constants.mts index 8a6b6113f60..bc6b101293d 100644 --- a/src/lib/completion/constants.mts +++ b/src/lib/completion/constants.mts @@ -1,4 +1,3 @@ - import { getPathInHome } from '../settings.mjs' export const AUTOCOMPLETION_FILE = getPathInHome(['autocompletion.json']) diff --git a/src/lib/completion/generate-autocompletion.mts b/src/lib/completion/generate-autocompletion.mts index 8f00ae94a34..c90dc066506 100644 --- a/src/lib/completion/generate-autocompletion.mts +++ b/src/lib/completion/generate-autocompletion.mts @@ -1,4 +1,3 @@ - import fs from 'fs' import { dirname } from 'path' diff --git a/src/lib/completion/get-autocompletion.mts b/src/lib/completion/get-autocompletion.mts index d1d932f6c8c..a596502d04a 100644 --- a/src/lib/completion/get-autocompletion.mts +++ b/src/lib/completion/get-autocompletion.mts @@ -1,5 +1,3 @@ - - /** * @typedef CompletionItem * @type import('tabtab').CompletionItem diff --git a/src/lib/completion/script.mts b/src/lib/completion/script.mts index 8b8565bcc45..f6ca897ccde 100755 --- a/src/lib/completion/script.mts +++ b/src/lib/completion/script.mts @@ -1,5 +1,4 @@ #!/usr/bin/env node - // This script is run by the completion (every log output will be displayed on tab) // src/commands/completion/completion.mjs -> dynamically references this file diff --git a/src/lib/edge-functions/deploy.mts b/src/lib/edge-functions/deploy.mts index 60eeaf463d2..3e513018717 100644 --- a/src/lib/edge-functions/deploy.mts +++ b/src/lib/edge-functions/deploy.mts @@ -1,4 +1,3 @@ - import { stat } from 'fs/promises' import { join } from 'path' diff --git a/src/lib/edge-functions/headers.mts b/src/lib/edge-functions/headers.mts index 139d4fdff04..6e721c82913 100644 --- a/src/lib/edge-functions/headers.mts +++ b/src/lib/edge-functions/headers.mts @@ -1,4 +1,3 @@ - import { Buffer } from 'buffer' export const headers = { diff --git a/src/lib/edge-functions/internal.mts b/src/lib/edge-functions/internal.mts index bdac806f02f..a5369fbfee3 100644 --- a/src/lib/edge-functions/internal.mts +++ b/src/lib/edge-functions/internal.mts @@ -1,4 +1,3 @@ - import { readFile, stat } from 'fs/promises' import { dirname, join, resolve } from 'path' diff --git a/src/lib/edge-functions/proxy.mts b/src/lib/edge-functions/proxy.mts index 49a889dc0b6..5d017e15d39 100644 --- a/src/lib/edge-functions/proxy.mts +++ b/src/lib/edge-functions/proxy.mts @@ -1,4 +1,3 @@ - import { Buffer } from 'buffer' import { rm } from 'fs/promises' import { join, resolve } from 'path' diff --git a/src/lib/edge-functions/registry.mts b/src/lib/edge-functions/registry.mts index 2b28a636f87..6c851f3bb83 100644 --- a/src/lib/edge-functions/registry.mts +++ b/src/lib/edge-functions/registry.mts @@ -1,4 +1,3 @@ - import { fileURLToPath } from 'url' import { diff --git a/src/lib/exec-fetcher.mts b/src/lib/exec-fetcher.mts index 8180f17fc63..91d3d2b3d46 100644 --- a/src/lib/exec-fetcher.mts +++ b/src/lib/exec-fetcher.mts @@ -1,4 +1,3 @@ - import path from 'path' import process from 'process' @@ -126,10 +125,10 @@ export const fetchLatestVersion = async ({ destination, execName, extension, lat const options = getOptions() const fetch = latestVersion - // @ts-expect-error TS(2345) FIXME: Argument of type '{ headers: { Authorization: stri... Remove this comment to see the full error message - ? fetchVersion({ ...release, version: latestVersion }, options) - // @ts-expect-error TS(2345) FIXME: Argument of type '{ repository: string; package: s... Remove this comment to see the full error message - : fetchLatest(release, options) + ? // @ts-expect-error TS(2345) FIXME: Argument of type '{ headers: { Authorization: stri... Remove this comment to see the full error message + fetchVersion({ ...release, version: latestVersion }, options) + : // @ts-expect-error TS(2345) FIXME: Argument of type '{ repository: string; package: s... Remove this comment to see the full error message + fetchLatest(release, options) try { await fetch diff --git a/src/lib/fs.mts b/src/lib/fs.mts index 212c3db2fcd..c1a7272e8d8 100644 --- a/src/lib/fs.mts +++ b/src/lib/fs.mts @@ -1,4 +1,3 @@ - import { constants } from 'fs' import { access, stat } from 'fs/promises' diff --git a/src/lib/functions/form-submissions-handler.mts b/src/lib/functions/form-submissions-handler.mts index a801fdf177b..42de08131ae 100644 --- a/src/lib/functions/form-submissions-handler.mts +++ b/src/lib/functions/form-submissions-handler.mts @@ -1,4 +1,3 @@ - import { Readable } from 'stream' // @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'cont... Remove this comment to see the full error message @@ -71,7 +70,7 @@ export const createFormSubmissionHandler = function ({ functionsRegistry, siteUr fields = Object.fromEntries(new URLSearchParams(bodyData.toString())) } else if (ct.type === 'multipart/form-data') { try { - [fields, files] = await new Promise((resolve, reject) => { + ;[fields, files] = await new Promise((resolve, reject) => { const form = new multiparty.Form({ encoding: ct.parameters.charset || 'utf8' }) // @ts-expect-error TS(7006) FIXME: Parameter 'err' implicitly has an 'any' type. form.parse(fakeRequest, (err, Fields, Files) => { diff --git a/src/lib/functions/local-proxy.mts b/src/lib/functions/local-proxy.mts index 53576c4deeb..69f0b63d6c5 100644 --- a/src/lib/functions/local-proxy.mts +++ b/src/lib/functions/local-proxy.mts @@ -1,4 +1,3 @@ - import { stdout } from 'process' // @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module '@net... Remove this comment to see the full error message diff --git a/src/lib/functions/registry.mts b/src/lib/functions/registry.mts index b5b87cfc7b5..3ab0fabf395 100644 --- a/src/lib/functions/registry.mts +++ b/src/lib/functions/registry.mts @@ -1,4 +1,3 @@ - import { mkdir, stat } from 'fs/promises' import { createRequire } from 'module' import { basename, extname, isAbsolute, join, resolve } from 'path' diff --git a/src/lib/functions/runtimes/go/index.mts b/src/lib/functions/runtimes/go/index.mts index e79b16c5638..197c87aa284 100644 --- a/src/lib/functions/runtimes/go/index.mts +++ b/src/lib/functions/runtimes/go/index.mts @@ -1,4 +1,3 @@ - import { dirname, extname } from 'path' import { platform } from 'process' diff --git a/src/lib/functions/runtimes/js/builders/netlify-lambda.mts b/src/lib/functions/runtimes/js/builders/netlify-lambda.mts index b9247837e36..5cab517ef27 100644 --- a/src/lib/functions/runtimes/js/builders/netlify-lambda.mts +++ b/src/lib/functions/runtimes/js/builders/netlify-lambda.mts @@ -1,4 +1,3 @@ - import { readFile } from 'fs/promises' import { resolve } from 'path' diff --git a/src/lib/functions/runtimes/rust/index.mts b/src/lib/functions/runtimes/rust/index.mts index e304f13933b..40bfb22daff 100644 --- a/src/lib/functions/runtimes/rust/index.mts +++ b/src/lib/functions/runtimes/rust/index.mts @@ -1,4 +1,3 @@ - import { readFile } from 'fs/promises' import { dirname, extname, join, resolve } from 'path' import { platform } from 'process' @@ -38,9 +37,11 @@ const build = async ({ func }) => { export const getBuildFunction = // @ts-expect-error TS(7031) FIXME: Binding element 'func' implicitly has an 'any' typ... Remove this comment to see the full error message - ({ func }) => - () => - build({ func }) + + + ({ func }) => + () => + build({ func }) // @ts-expect-error TS(7006) FIXME: Parameter 'cwd' implicitly has an 'any' type. const getCrateName = async (cwd) => { diff --git a/src/lib/functions/synchronous.mts b/src/lib/functions/synchronous.mts index 862151972c6..26fd03c2add 100644 --- a/src/lib/functions/synchronous.mts +++ b/src/lib/functions/synchronous.mts @@ -1,4 +1,3 @@ - import { Buffer } from 'buffer' import { isStream } from 'is-stream' diff --git a/src/lib/functions/utils.mts b/src/lib/functions/utils.mts index 8830ff10dc4..c8f42fdaab2 100644 --- a/src/lib/functions/utils.mts +++ b/src/lib/functions/utils.mts @@ -1,4 +1,3 @@ - import { chalk, warn } from '../../utils/command-helpers.mjs' import { MISSING_AWS_SDK_WARNING } from '../log.mjs' diff --git a/src/lib/geo-location.mts b/src/lib/geo-location.mts index 2253eabeb4a..8b84137b487 100644 --- a/src/lib/geo-location.mts +++ b/src/lib/geo-location.mts @@ -1,4 +1,3 @@ - // @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'node... Remove this comment to see the full error message import fetch from 'node-fetch' diff --git a/src/lib/http-agent.mts b/src/lib/http-agent.mts index 65c8a5a355f..098d5994784 100644 --- a/src/lib/http-agent.mts +++ b/src/lib/http-agent.mts @@ -1,4 +1,3 @@ - import { readFile } from 'fs/promises' import HttpsProxyAgent from 'https-proxy-agent' diff --git a/src/lib/spinner.mts b/src/lib/spinner.mts index a8573d47a9b..fb02a2665f8 100644 --- a/src/lib/spinner.mts +++ b/src/lib/spinner.mts @@ -1,4 +1,3 @@ - import logSymbols from 'log-symbols' import ora from 'ora' diff --git a/src/recipes/vscode/index.mts b/src/recipes/vscode/index.mts index f8753a16558..4b6e716f248 100644 --- a/src/recipes/vscode/index.mts +++ b/src/recipes/vscode/index.mts @@ -1,4 +1,3 @@ - import { join } from 'path' import { DenoBridge } from '@netlify/edge-bundler' diff --git a/src/utils/addons/diffs/index.mts b/src/utils/addons/diffs/index.mts index d9032c828f8..fb1c309516a 100644 --- a/src/utils/addons/diffs/index.mts +++ b/src/utils/addons/diffs/index.mts @@ -1,4 +1,3 @@ - // @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'conc... Remove this comment to see the full error message import concordance from 'concordance' diff --git a/src/utils/addons/diffs/options.mts b/src/utils/addons/diffs/options.mts index 0c61fdc1be3..549871b223a 100644 --- a/src/utils/addons/diffs/options.mts +++ b/src/utils/addons/diffs/options.mts @@ -1,4 +1,3 @@ - import ansiStyles from 'ansi-styles' // eslint-disable-next-line no-restricted-imports import { Chalk } from 'chalk' diff --git a/src/utils/addons/prepare.mts b/src/utils/addons/prepare.mts index 0d0c8f1f6e3..7caf94a7ab5 100644 --- a/src/utils/addons/prepare.mts +++ b/src/utils/addons/prepare.mts @@ -1,4 +1,3 @@ - import { chalk, error, exit, log, warn } from '../command-helpers.mjs' export const ADDON_VALIDATION = { diff --git a/src/utils/addons/prompts.mts b/src/utils/addons/prompts.mts index 58110c53094..a9f62d65050 100644 --- a/src/utils/addons/prompts.mts +++ b/src/utils/addons/prompts.mts @@ -1,4 +1,3 @@ - import { chalk } from '../command-helpers.mjs' /* programmatically generate CLI prompts */ diff --git a/src/utils/addons/render.mts b/src/utils/addons/render.mts index b1b3f1483f9..9593fad2579 100644 --- a/src/utils/addons/render.mts +++ b/src/utils/addons/render.mts @@ -1,5 +1,3 @@ - - import AsciiTable from 'ascii-table' import { chalk } from '../command-helpers.mjs' diff --git a/src/utils/banner.mts b/src/utils/banner.mts index 69130685843..e3d4e9aaa41 100644 --- a/src/utils/banner.mts +++ b/src/utils/banner.mts @@ -1,4 +1,3 @@ - import boxen from 'boxen' import { chalk, log, NETLIFYDEVLOG } from './command-helpers.mjs' diff --git a/src/utils/build-info.mts b/src/utils/build-info.mts index afb4a2bf059..3e38c198312 100644 --- a/src/utils/build-info.mts +++ b/src/utils/build-info.mts @@ -1,5 +1,3 @@ - - import fuzzy from 'fuzzy' import inquirer from 'inquirer' @@ -97,15 +95,17 @@ command = "${chosenSettings.devCommand}" export const detectBuildSettings = async (command) => { const { project, workspacePackage } = command const buildSettings = await project.getBuildSettings(project.workspace ? workspacePackage : '') - return buildSettings - // @ts-expect-error TS(7006) FIXME: Parameter 'setting' implicitly has an 'any' type. - .filter((setting) => { - if (project.workspace && project.relativeBaseDirectory && setting.packagePath) { - return project.relativeBaseDirectory.startsWith(setting.packagePath) - } + return ( + buildSettings + // @ts-expect-error TS(7006) FIXME: Parameter 'setting' implicitly has an 'any' type. + .filter((setting) => { + if (project.workspace && project.relativeBaseDirectory && setting.packagePath) { + return project.relativeBaseDirectory.startsWith(setting.packagePath) + } - return true - }) - // @ts-expect-error TS(7006) FIXME: Parameter 'setting' implicitly has an 'any' type. - .filter((setting) => setting.devCommand) + return true + }) + // @ts-expect-error TS(7006) FIXME: Parameter 'setting' implicitly has an 'any' type. + .filter((setting) => setting.devCommand) + ) } diff --git a/src/utils/create-deferred.mts b/src/utils/create-deferred.mts index 2cb1e22f6b2..ffc0aceb53c 100644 --- a/src/utils/create-deferred.mts +++ b/src/utils/create-deferred.mts @@ -1,4 +1,3 @@ - const createDeferred = () => { let resolveDeferred let rejectDeferred diff --git a/src/utils/deploy/util.mts b/src/utils/deploy/util.mts index 52f378c44cf..04edb4e5ba6 100644 --- a/src/utils/deploy/util.mts +++ b/src/utils/deploy/util.mts @@ -1,4 +1,3 @@ - import { sep } from 'path' import pWaitFor from 'p-wait-for' diff --git a/src/utils/detect-server-settings.mts b/src/utils/detect-server-settings.mts index 4b842506f81..17345674d47 100644 --- a/src/utils/detect-server-settings.mts +++ b/src/utils/detect-server-settings.mts @@ -1,4 +1,3 @@ - import { readFile } from 'fs/promises' import { EOL } from 'os' import { dirname, relative, resolve } from 'path' diff --git a/src/utils/dev.mts b/src/utils/dev.mts index f9c754c92c1..22b0165a8e9 100644 --- a/src/utils/dev.mts +++ b/src/utils/dev.mts @@ -1,4 +1,3 @@ - import process from 'process' import getPort from 'get-port' diff --git a/src/utils/dot-env.mts b/src/utils/dot-env.mts index 5f76c80c140..23bcdcb7ce7 100644 --- a/src/utils/dot-env.mts +++ b/src/utils/dot-env.mts @@ -1,4 +1,3 @@ - import { readFile } from 'fs/promises' import path from 'path' diff --git a/src/utils/framework-server.mts b/src/utils/framework-server.mts index 7b8088eec0c..704940c0e26 100644 --- a/src/utils/framework-server.mts +++ b/src/utils/framework-server.mts @@ -1,4 +1,3 @@ - import waitPort from 'wait-port' import { startSpinner, stopSpinner } from '../lib/spinner.mjs' diff --git a/src/utils/functions/functions.mts b/src/utils/functions/functions.mts index f841727b12a..f28595b69a9 100644 --- a/src/utils/functions/functions.mts +++ b/src/utils/functions/functions.mts @@ -1,4 +1,3 @@ - import { promises as fs } from 'fs' import { resolve } from 'path' diff --git a/src/utils/functions/get-functions.mts b/src/utils/functions/get-functions.mts index 31e3aa8feda..d5620bf7719 100644 --- a/src/utils/functions/get-functions.mts +++ b/src/utils/functions/get-functions.mts @@ -1,4 +1,3 @@ - import { listFunctions } from '@netlify/zip-it-and-ship-it' import { fileExistsAsync } from '../../lib/fs.mjs' diff --git a/src/utils/get-repo-data.mts b/src/utils/get-repo-data.mts index 5d3d30c717c..531528bb2df 100644 --- a/src/utils/get-repo-data.mts +++ b/src/utils/get-repo-data.mts @@ -1,4 +1,3 @@ - import { dirname } from 'path' import util from 'util' diff --git a/src/utils/gh-auth.mts b/src/utils/gh-auth.mts index 87770fd569c..7e380e7c5f0 100644 --- a/src/utils/gh-auth.mts +++ b/src/utils/gh-auth.mts @@ -1,4 +1,3 @@ - // A simple ghauth inspired library for getting a personal access token import http from 'http' import process from 'process' diff --git a/src/utils/gitignore.mts b/src/utils/gitignore.mts index 1e464b669e9..d80b51f5514 100644 --- a/src/utils/gitignore.mts +++ b/src/utils/gitignore.mts @@ -1,4 +1,3 @@ - import { readFile, writeFile } from 'fs/promises' import path from 'path' diff --git a/src/utils/init/config-github.mts b/src/utils/init/config-github.mts index b6033688bef..fe7273af9e9 100644 --- a/src/utils/init/config-github.mts +++ b/src/utils/init/config-github.mts @@ -1,4 +1,3 @@ - import { Octokit } from '@octokit/rest' import { chalk, error as failAndExit, log } from '../command-helpers.mjs' diff --git a/src/utils/init/config-manual.mts b/src/utils/init/config-manual.mts index 472dcf4c563..d3feae8236e 100644 --- a/src/utils/init/config-manual.mts +++ b/src/utils/init/config-manual.mts @@ -1,4 +1,3 @@ - import inquirer from 'inquirer' import { exit, log } from '../command-helpers.mjs' diff --git a/src/utils/init/config.mts b/src/utils/init/config.mts index 5706a4db35d..8c50e0dc321 100644 --- a/src/utils/init/config.mts +++ b/src/utils/init/config.mts @@ -1,4 +1,3 @@ - import { chalk, log } from '../command-helpers.mjs' import { configGithub } from './config-github.mjs' diff --git a/src/utils/init/node-version.mts b/src/utils/init/node-version.mts index cf37701fb51..4ce99607775 100644 --- a/src/utils/init/node-version.mts +++ b/src/utils/init/node-version.mts @@ -1,4 +1,3 @@ - import { readFile } from 'fs/promises' import { locatePath } from 'locate-path' diff --git a/src/utils/init/utils.mts b/src/utils/init/utils.mts index 1aa3e280c26..4081dbda361 100644 --- a/src/utils/init/utils.mts +++ b/src/utils/init/utils.mts @@ -1,4 +1,3 @@ - import { writeFile } from 'fs/promises' import path from 'path' @@ -31,7 +30,7 @@ export const getPluginsToAutoInstall = (pluginsInstalled = [], pluginsRecommende (acc, plugin) => pluginsInstalled.includes(plugin) && !pluginsToAlwaysInstall.has(plugin) ? acc : [...acc, plugin], - /** @type {string[]} */ ([]), + /** @type {string[]} */ [], ) /** diff --git a/src/utils/lm/install.mts b/src/utils/lm/install.mts index 932395212ea..92130a98417 100644 --- a/src/utils/lm/install.mts +++ b/src/utils/lm/install.mts @@ -1,4 +1,3 @@ - import { appendFile, copyFile, readFile, rm, writeFile } from 'fs/promises' import os from 'os' import path, { dirname } from 'path' diff --git a/src/utils/lm/requirements.mts b/src/utils/lm/requirements.mts index b9e0068ab7b..23f1aac0ac8 100644 --- a/src/utils/lm/requirements.mts +++ b/src/utils/lm/requirements.mts @@ -1,4 +1,3 @@ - import semver from 'semver' // @ts-expect-error TS(7034) FIXME: Variable 'execa' implicitly has type 'any' in some... Remove this comment to see the full error message diff --git a/src/utils/proxy-server.mts b/src/utils/proxy-server.mts index faf3e17f307..f94b5dbc5b2 100644 --- a/src/utils/proxy-server.mts +++ b/src/utils/proxy-server.mts @@ -1,4 +1,3 @@ - import { exit, log, NETLIFYDEVERR } from './command-helpers.mjs' import { startProxy } from './proxy.mjs' diff --git a/src/utils/proxy.mts b/src/utils/proxy.mts index d2c15394a30..06f4f201db5 100644 --- a/src/utils/proxy.mts +++ b/src/utils/proxy.mts @@ -1,4 +1,3 @@ - import { Buffer } from 'buffer' import { once } from 'events' import { readFile } from 'fs/promises' diff --git a/src/utils/read-repo-url.mts b/src/utils/read-repo-url.mts index 978b668c133..ae14d4f856c 100644 --- a/src/utils/read-repo-url.mts +++ b/src/utils/read-repo-url.mts @@ -1,4 +1,3 @@ - import url from 'url' // @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'node... Remove this comment to see the full error message diff --git a/src/utils/redirects.mts b/src/utils/redirects.mts index 55bbd1a9492..fa1c0a12f72 100644 --- a/src/utils/redirects.mts +++ b/src/utils/redirects.mts @@ -1,4 +1,3 @@ - import { parseAllRedirects } from 'netlify-redirect-parser' import { NETLIFYDEVERR, log } from './command-helpers.mjs' diff --git a/src/utils/request-id.mts b/src/utils/request-id.mts index 012548db063..e5752eec5ca 100644 --- a/src/utils/request-id.mts +++ b/src/utils/request-id.mts @@ -1,4 +1,3 @@ - import { ulid } from 'ulid' export const generateRequestID = () => ulid() diff --git a/src/utils/rules-proxy.mts b/src/utils/rules-proxy.mts index cad17c4cafe..0e70a62bc80 100644 --- a/src/utils/rules-proxy.mts +++ b/src/utils/rules-proxy.mts @@ -1,4 +1,3 @@ - import path from 'path' import chokidar from 'chokidar' diff --git a/src/utils/run-build.mts b/src/utils/run-build.mts index b4222558f24..06712a0abbd 100644 --- a/src/utils/run-build.mts +++ b/src/utils/run-build.mts @@ -1,4 +1,3 @@ - import { promises as fs } from 'fs' import path, { join } from 'path' diff --git a/src/utils/shell.mts b/src/utils/shell.mts index 1460a905fab..d9de5979020 100644 --- a/src/utils/shell.mts +++ b/src/utils/shell.mts @@ -1,4 +1,3 @@ - import process from 'process' import execa from 'execa' @@ -108,8 +107,8 @@ export const runCommand = (command, options = {}) => { ) } else { const errorMessage = result.failed - // @ts-expect-error TS(2339) FIXME: Property 'shortMessage' does not exist on type 'Ex... Remove this comment to see the full error message - ? `${NETLIFYDEVERR} ${result.shortMessage}` + ? // @ts-expect-error TS(2339) FIXME: Property 'shortMessage' does not exist on type 'Ex... Remove this comment to see the full error message + `${NETLIFYDEVERR} ${result.shortMessage}` : `${NETLIFYDEVWARN} "${command}" exited with code ${result.exitCode}` log(`${errorMessage}. Shutting down Netlify Dev server`) diff --git a/src/utils/static-server.mts b/src/utils/static-server.mts index 9ca95d6c1b1..ad48659e4b8 100644 --- a/src/utils/static-server.mts +++ b/src/utils/static-server.mts @@ -1,4 +1,3 @@ - import path from 'path' import fastifyStatic from '@fastify/static' diff --git a/src/utils/telemetry/request.mts b/src/utils/telemetry/request.mts index 7cbb11f8bf7..d3f29f6795d 100644 --- a/src/utils/telemetry/request.mts +++ b/src/utils/telemetry/request.mts @@ -1,4 +1,3 @@ - // This file is being called by `src/utils/telemetry/telemetry.js` as a child process // to run a s a detached process import process from 'process' diff --git a/src/utils/telemetry/telemetry.mts b/src/utils/telemetry/telemetry.mts index 9b649bb652a..94981c0231b 100644 --- a/src/utils/telemetry/telemetry.mts +++ b/src/utils/telemetry/telemetry.mts @@ -1,4 +1,3 @@ - import { dirname, join } from 'path' import process, { version as nodejsVersion } from 'process' import { fileURLToPath } from 'url' @@ -26,7 +25,7 @@ function send(type, payload) { type, }) - const args = /** @type {const} */ ([process.execPath, [requestFile, options]]) + const args = /** @type {const} */ [process.execPath, [requestFile, options]] if (process.env.NETLIFY_TEST_TELEMETRY_WAIT === 'true') { // @ts-expect-error TS(7005) FIXME: Variable 'execa' implicitly has an 'any' type. return execa(...args, { diff --git a/src/utils/validation.mts b/src/utils/validation.mts index ac60ba2a42c..2d394b2a18c 100644 --- a/src/utils/validation.mts +++ b/src/utils/validation.mts @@ -1,4 +1,3 @@ - import { BANG, chalk } from './command-helpers.mjs' /**