diff --git a/package.json b/package.json index c6e0b220ed6..e70695b5a85 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,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,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\"" + "prettier": "--ignore-path .eslintignore --loglevel=warn \"{src,tools,scripts,tests,.github}/**/*.{mjs,cjs,js,mts,md,yml,json,html,ts}\" \"*.{mjs,cjs,js,mts,yml,json,html,ts}\" \".*.{mjs,cjs,js,yml,json,html,ts}\" \"!CHANGELOG.md\" \"!**/*/package-lock.json\" \"!.github/**/*.md\"" }, "dependencies": { "@bugsnag/js": "7.20.2", diff --git a/src/commands/blobs/blobs-set.ts b/src/commands/blobs/blobs-set.ts index 017b1040a29..e4e76bdf53b 100644 --- a/src/commands/blobs/blobs-set.ts +++ b/src/commands/blobs/blobs-set.ts @@ -11,7 +11,6 @@ interface Options extends OptionValues { input?: string } - export const blobsSet = async ( storeName: string, key: string, diff --git a/src/commands/dev/dev.ts b/src/commands/dev/dev.ts index 016e4a7f8a9..62eda3e7a43 100644 --- a/src/commands/dev/dev.ts +++ b/src/commands/dev/dev.ts @@ -230,110 +230,107 @@ export const dev = async (options: OptionValues, command: BaseCommand) => { printBanner({ url }) } - export const createDevCommand = (program: BaseCommand) => { 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, - ) - .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')) - .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), - ) - .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(), + 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, + ) + .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')) + .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), + ) + .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', ) - .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), + .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', ) - .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), + .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', ) - .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), + .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( - '-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), + .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', ) - .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) - ) + .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/logs/functions.ts b/src/commands/logs/functions.ts index e966114db60..dc84063bee2 100644 --- a/src/commands/logs/functions.ts +++ b/src/commands/logs/functions.ts @@ -7,7 +7,6 @@ import type BaseCommand from '../base-command.js' import { CLI_LOG_LEVEL_CHOICES_STRING, LOG_LEVELS, LOG_LEVELS_LIST } from './log-levels.js' - function getLog(logData: { level: string; message: string }) { let logString = '' switch (logData.level) { diff --git a/src/functions-templates/typescript/abtest/{{name}}.ts b/src/functions-templates/typescript/abtest/{{name}}.ts index 4544d2f1958..41fb9772d46 100644 --- a/src/functions-templates/typescript/abtest/{{name}}.ts +++ b/src/functions-templates/typescript/abtest/{{name}}.ts @@ -1,31 +1,31 @@ -import type { Context } from "https://edge.netlify.com"; +import type { Context } from 'https://edge.netlify.com' export default async (request: Request, context: Context) => { // look for existing "test_bucket" cookie - const bucketName = "test_bucket"; - const bucket = context.cookies.get(bucketName); + const bucketName = 'test_bucket' + const bucket = context.cookies.get(bucketName) // return here if we find a cookie if (bucket) { - return new Response(`Welcome back! You were assigned ${bucketName} **${bucket}** when you last visited the site!`); + return new Response(`Welcome back! You were assigned ${bucketName} **${bucket}** when you last visited the site!`) } // if no "test_bucket" cookie is found, assign the user to a bucket // in this example we're using two buckets (a, b) with an equal weighting of 50/50 - const weighting = 0.5; + const weighting = 0.5 // get a random number between (0-1) // this is a basic example and you may want to experiment - const random = Math.random(); - const newBucketValue = random <= weighting ? "a" : "b"; + const random = Math.random() + const newBucketValue = random <= weighting ? 'a' : 'b' // set the new "test_bucket" cookie context.cookies.set({ name: bucketName, value: newBucketValue, - }); + }) return new Response( `Congratulations! You have been assigned ${bucketName} **${newBucketValue}**. View your browser cookies to check it out!`, - ); -}; \ No newline at end of file + ) +} diff --git a/src/functions-templates/typescript/geolocation/{{name}}.ts b/src/functions-templates/typescript/geolocation/{{name}}.ts index 61377c58637..a6a6e5d3f87 100644 --- a/src/functions-templates/typescript/geolocation/{{name}}.ts +++ b/src/functions-templates/typescript/geolocation/{{name}}.ts @@ -1,6 +1,6 @@ -import { Context } from "https://edge.netlify.com"; +import { Context } from 'https://edge.netlify.com' -export default async (request: Request, context: Context) => { +export default async (request: Request, context: Context) => // Here's what's available on context.geo // context: { @@ -17,8 +17,7 @@ export default async (request: Request, context: Context) => { // } // } - return Response.json({ + Response.json({ geo: context.geo, - header: request.headers.get("x-nf-geo"), - }); -}; \ No newline at end of file + header: request.headers.get('x-nf-geo'), + }) diff --git a/src/functions-templates/typescript/json/{{name}}.ts b/src/functions-templates/typescript/json/{{name}}.ts index 5df0da9e5d6..094c3ba00ce 100644 --- a/src/functions-templates/typescript/json/{{name}}.ts +++ b/src/functions-templates/typescript/json/{{name}}.ts @@ -1,5 +1,4 @@ -import type { Context } from "https://edge.netlify.com"; +import type { Context } from 'https://edge.netlify.com' -export default async (request: Request, context: Context) => { - return Response.json({ hello: "world", location: context.geo.city }); -}; \ No newline at end of file +export default async (request: Request, context: Context) => + Response.json({ hello: 'world', location: context.geo.city }) diff --git a/src/functions-templates/typescript/log/{{name}}.ts b/src/functions-templates/typescript/log/{{name}}.ts index 57fa4dd2c23..8f0c5cafa4f 100644 --- a/src/functions-templates/typescript/log/{{name}}.ts +++ b/src/functions-templates/typescript/log/{{name}}.ts @@ -1,9 +1,9 @@ -import type { Context } from "https://edge.netlify.com"; +import type { Context } from 'https://edge.netlify.com' export default async (request: Request, context: Context) => { - console.log(`There was a request from ${context.geo.city} to ${request.url}`); + console.log(`There was a request from ${context.geo.city} to ${request.url}`) - return new Response("The request to this URL was logged", { - headers: { "content-type": "text/html" }, - }); -}; + return new Response('The request to this URL was logged', { + headers: { 'content-type': 'text/html' }, + }) +} diff --git a/src/functions-templates/typescript/scheduled-function/{{name}}.ts b/src/functions-templates/typescript/scheduled-function/{{name}}.ts index 40f8f56c563..266482ee25c 100644 --- a/src/functions-templates/typescript/scheduled-function/{{name}}.ts +++ b/src/functions-templates/typescript/scheduled-function/{{name}}.ts @@ -1,12 +1,12 @@ -import { schedule } from '@netlify/functions'; +import { schedule } from '@netlify/functions' -// To learn about scheduled functions and supported cron extensions, +// To learn about scheduled functions and supported cron extensions, // see: https://ntl.fyi/sched-func -export const handler = schedule("@hourly", async (event) => { - const eventBody = JSON.parse(event.body); - console.log(`Next function run at ${eventBody.next_run}.`); +export const handler = schedule('@hourly', async (event) => { + const eventBody = JSON.parse(event.body) + console.log(`Next function run at ${eventBody.next_run}.`) - return { - statusCode: 200 - }; -}); + return { + statusCode: 200, + } +}) diff --git a/src/functions-templates/typescript/set-cookies/{{name}}.ts b/src/functions-templates/typescript/set-cookies/{{name}}.ts index 58749e33a50..f0435acf9f1 100644 --- a/src/functions-templates/typescript/set-cookies/{{name}}.ts +++ b/src/functions-templates/typescript/set-cookies/{{name}}.ts @@ -1,29 +1,29 @@ -import type { Context } from "https://edge.netlify.com"; +import type { Context } from 'https://edge.netlify.com' export default async (request: Request, context: Context) => { - const url = new URL(request.url); + const url = new URL(request.url) - switch (url.searchParams.get("action")) { - case "set": + switch (url.searchParams.get('action')) { + case 'set': context.cookies.set({ - name: "action", - value: "hello", - }); + name: 'action', + value: 'hello', + }) - return new Response('Cookie value has been set. Reload this page without the "action" parameter to see it.'); + return new Response('Cookie value has been set. Reload this page without the "action" parameter to see it.') - case "clear": - context.cookies.delete("action"); + case 'clear': + context.cookies.delete('action') return new Response( 'Cookie value has been cleared. Reload this page without the "action" parameter to see the new state.', - ); + ) } - const value = context.cookies.get("action"); + const value = context.cookies.get('action') const message = value ? `Cookie value is "${value}". You can clear it by using "?action=clear".` - : 'Cookie has not been set. You can do so by adding "?action=set" to the URL.'; + : 'Cookie has not been set. You can do so by adding "?action=set" to the URL.' - return new Response(message); -}; \ No newline at end of file + return new Response(message) +} diff --git a/src/functions-templates/typescript/set-req-header/{{name}}.ts b/src/functions-templates/typescript/set-req-header/{{name}}.ts index 94bf8d6f253..7f95ddd0e5d 100644 --- a/src/functions-templates/typescript/set-req-header/{{name}}.ts +++ b/src/functions-templates/typescript/set-req-header/{{name}}.ts @@ -1,5 +1,5 @@ -import type { Context } from "https://edge.netlify.com"; +import type { Context } from 'https://edge.netlify.com' export default async (request: Request, context: Context) => { - request.headers.set("X-Your-Custom-Header", "Your custom header value"); -}; \ No newline at end of file + request.headers.set('X-Your-Custom-Header', 'Your custom header value') +} diff --git a/src/functions-templates/typescript/set-res-header/{{name}}.ts b/src/functions-templates/typescript/set-res-header/{{name}}.ts index e734f1ed540..196faf91891 100644 --- a/src/functions-templates/typescript/set-res-header/{{name}}.ts +++ b/src/functions-templates/typescript/set-res-header/{{name}}.ts @@ -1,7 +1,7 @@ -import type { Context } from "https://edge.netlify.com"; +import type { Context } from 'https://edge.netlify.com' export default async (request: Request, context: Context) => { - const response = await context.next(); - response.headers.set("X-Your-Custom-Header", "A custom value"); - return response; -}; \ No newline at end of file + const response = await context.next() + response.headers.set('X-Your-Custom-Header', 'A custom value') + return response +} diff --git a/src/functions-templates/typescript/transform-response/{{name}}.ts b/src/functions-templates/typescript/transform-response/{{name}}.ts index 2b897fd68c6..98719bf1831 100644 --- a/src/functions-templates/typescript/transform-response/{{name}}.ts +++ b/src/functions-templates/typescript/transform-response/{{name}}.ts @@ -1,13 +1,13 @@ -import { Context } from "https://edge.netlify.com"; +import { Context } from 'https://edge.netlify.com' export default async (request: Request, context: Context) => { - const url = new URL(request.url); + const url = new URL(request.url) // Look for the query parameter, and return if we don't find it - if (url.searchParams.get("method") !== "transform") { - return; + if (url.searchParams.get('method') !== 'transform') { + return } - const response = await context.next(); - const text = await response.text(); - return new Response(text.toUpperCase(), response); -}; \ No newline at end of file + const response = await context.next() + const text = await response.text() + return new Response(text.toUpperCase(), response) +} diff --git a/src/lib/edge-functions/proxy.ts b/src/lib/edge-functions/proxy.ts index aadf39a51e0..2d325ec74b0 100644 --- a/src/lib/edge-functions/proxy.ts +++ b/src/lib/edge-functions/proxy.ts @@ -2,7 +2,6 @@ import { Buffer } from 'buffer' import { rm } from 'fs/promises' import { join, resolve } from 'path' -// eslint-disable-next-line import/no-namespace import * as bundler from '@netlify/edge-bundler' import getAvailablePort from 'get-port' diff --git a/src/lib/functions/runtimes/index.ts b/src/lib/functions/runtimes/index.ts index 7fa1ac8d16a..df4d51271c8 100644 --- a/src/lib/functions/runtimes/index.ts +++ b/src/lib/functions/runtimes/index.ts @@ -1,4 +1,3 @@ -/* eslint-disable import/no-namespace */ import * as go from './go/index.js' import * as js from './js/index.js' import * as rust from './rust/index.js' diff --git a/src/lib/functions/utils.ts b/src/lib/functions/utils.ts index 8dad0deaaeb..25bb584239c 100644 --- a/src/lib/functions/utils.ts +++ b/src/lib/functions/utils.ts @@ -1,4 +1,3 @@ - import { chalk, warn } from '../../utils/command-helpers.js' import { MISSING_AWS_SDK_WARNING } from '../log.js' diff --git a/src/recipes/vscode/settings.ts b/src/recipes/vscode/settings.ts index 5b01f88226f..50245f5bce5 100644 --- a/src/recipes/vscode/settings.ts +++ b/src/recipes/vscode/settings.ts @@ -1,7 +1,6 @@ import { mkdir, readFile, stat, writeFile } from 'fs/promises' import { dirname, relative } from 'path' -// eslint-disable-next-line import/no-namespace import * as JSONC from 'comment-json' // @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'unix... Remove this comment to see the full error message import unixify from 'unixify' diff --git a/src/utils/addons/diffs/options.ts b/src/utils/addons/diffs/options.ts index 549871b223a..f700aac7fbd 100644 --- a/src/utils/addons/diffs/options.ts +++ b/src/utils/addons/diffs/options.ts @@ -1,5 +1,4 @@ import ansiStyles from 'ansi-styles' -// eslint-disable-next-line no-restricted-imports import { Chalk } from 'chalk' const forceColor = new Chalk({ level: 1 }) diff --git a/src/utils/addons/prepare.ts b/src/utils/addons/prepare.ts index 186e7866676..3a31e07b077 100644 --- a/src/utils/addons/prepare.ts +++ b/src/utils/addons/prepare.ts @@ -1,4 +1,3 @@ - import { chalk, error, exit, log, warn } from '../command-helpers.js' export const ADDON_VALIDATION = { diff --git a/src/utils/addons/prompts.ts b/src/utils/addons/prompts.ts index 15c2b8b408a..967aa2aff1e 100644 --- a/src/utils/addons/prompts.ts +++ b/src/utils/addons/prompts.ts @@ -1,4 +1,3 @@ - import { chalk } from '../command-helpers.js' /* programmatically generate CLI prompts */ diff --git a/src/utils/command-helpers.ts b/src/utils/command-helpers.ts index 1b2b1b6b926..ee53421d7f8 100644 --- a/src/utils/command-helpers.ts +++ b/src/utils/command-helpers.ts @@ -3,7 +3,6 @@ import os from 'os' import process from 'process' import { format, inspect } from 'util' -// eslint-disable-next-line no-restricted-imports import { Chalk } from 'chalk' import chokidar from 'chokidar' import decache from 'decache' @@ -229,7 +228,7 @@ export const exit = (code = 0) => { // @ts-expect-error TS(7006) FIXME: Parameter 'config' implicitly has an 'any' type. export const normalizeConfig = (config) => { // Unused var here is in order to omit 'publish' from build config - // eslint-disable-next-line no-unused-vars + const { publish, publishOrigin, ...build } = config.build return publishOrigin === 'default' ? { ...config, build } : config diff --git a/src/utils/detect-server-settings.ts b/src/utils/detect-server-settings.ts index a5fe31924a6..18bc5a1904e 100644 --- a/src/utils/detect-server-settings.ts +++ b/src/utils/detect-server-settings.ts @@ -62,7 +62,6 @@ const readHttpsSettings = async (options) => { */ // @ts-expect-error TS(7006) FIXME: Parameter 'devConfig' implicitly has an 'any' type... Remove this comment to see the full error message function validateProperty(devConfig, property, type) { - // eslint-disable-next-line valid-typeof if (devConfig[property] && typeof devConfig[property] !== type) { const formattedProperty = formatProperty(property) throw new TypeError( diff --git a/src/utils/init/config.ts b/src/utils/init/config.ts index a3aba0bea3a..a792301ca2b 100644 --- a/src/utils/init/config.ts +++ b/src/utils/init/config.ts @@ -1,4 +1,3 @@ - import { chalk, log } from '../command-helpers.js' import { configGithub } from './config-github.js' diff --git a/src/utils/proxy-server.ts b/src/utils/proxy-server.ts index cc0703d049d..1c69f4e74d4 100644 --- a/src/utils/proxy-server.ts +++ b/src/utils/proxy-server.ts @@ -1,4 +1,3 @@ - import { exit, log, NETLIFYDEVERR } from './command-helpers.js' import { startProxy } from './proxy.js' diff --git a/src/utils/validation.ts b/src/utils/validation.ts index 997cb0931db..141ca0f4605 100644 --- a/src/utils/validation.ts +++ b/src/utils/validation.ts @@ -1,4 +1,3 @@ - import { BANG, chalk } from './command-helpers.js' /** diff --git a/tests/integration/__fixtures__/dev-server-with-edge-functions/netlify/edge-functions/user-iscA.ts b/tests/integration/__fixtures__/dev-server-with-edge-functions/netlify/edge-functions/user-iscA.ts index 38cc019b26b..1d3a75d8d5b 100644 --- a/tests/integration/__fixtures__/dev-server-with-edge-functions/netlify/edge-functions/user-iscA.ts +++ b/tests/integration/__fixtures__/dev-server-with-edge-functions/netlify/edge-functions/user-iscA.ts @@ -1,7 +1,7 @@ -import { Config } from "https://edge.netlify.com"; -import createEdgeFunction from "../../src/edge-function.ts"; +import { Config } from 'https://edge.netlify.com' +import createEdgeFunction from '../../src/edge-function.ts' -export default createEdgeFunction("user-iscA"); +export default createEdgeFunction('user-iscA') export const config: Config = { path: '/ordertest', diff --git a/tests/integration/commands/integration/deploy.test.ts b/tests/integration/commands/integration/deploy.test.ts index 556b197b5e9..7e72eac7210 100644 --- a/tests/integration/commands/integration/deploy.test.ts +++ b/tests/integration/commands/integration/deploy.test.ts @@ -64,9 +64,10 @@ describe(`integration:deploy`, () => { ] await withSiteBuilder('my-integration', async (builder) => { - builder.withContentFiles([{ - path: 'integration.yaml', - content: `config: + builder.withContentFiles([ + { + path: 'integration.yaml', + content: `config: name: integrationName description: an integration' slug: 987645-integration @@ -74,8 +75,9 @@ describe(`integration:deploy`, () => { site: - read integrationLevel: team-and-site - ` - }]) + `, + }, + ]) await builder.buildAsync() vi.spyOn(process, 'cwd').mockReturnValue(builder.directory) @@ -99,7 +101,5 @@ describe(`integration:deploy`, () => { expect(siteDeploy).toBeCalledTimes(1) }) }) - - }) }) diff --git a/tests/integration/commands/logs/functions.test.ts b/tests/integration/commands/logs/functions.test.ts index e5834bd03fd..278dba7423f 100644 --- a/tests/integration/commands/logs/functions.test.ts +++ b/tests/integration/commands/logs/functions.test.ts @@ -13,7 +13,7 @@ vi.mock('../../../../src/utils/websockets/index.js', () => ({ })) vi.mock('../../../../src/utils/command-helpers.js', async () => { - const actual = await vi.importActual("../../../../src/utils/command-helpers.js") + const actual = await vi.importActual('../../../../src/utils/command-helpers.js') return { ...actual, log: vi.fn(), @@ -77,7 +77,7 @@ describe('logs:function command', () => { createLogsFunctionCommand(program) }) - test('should setup the functions stream correctly', async ({ }) => { + test('should setup the functions stream correctly', async ({}) => { const { apiUrl } = await startMockApi({ routes }) const spyWebsocket = getWebSocket as unknown as Mock const spyOn = vi.fn() @@ -96,7 +96,7 @@ describe('logs:function command', () => { expect(spyOn).toHaveBeenCalledTimes(4) }) - test('should send the correct payload to the websocket', async ({ }) => { + test('should send the correct payload to the websocket', async ({}) => { const { apiUrl } = await startMockApi({ routes }) const spyWebsocket = getWebSocket as unknown as Mock const spyOn = vi.fn() @@ -128,7 +128,7 @@ describe('logs:function command', () => { expect(body.access_token).toEqual(env.NETLIFY_AUTH_TOKEN) }) - test('should print only specified log levels', async ({ }) => { + test('should print only specified log levels', async ({}) => { const { apiUrl } = await startMockApi({ routes }) const spyWebsocket = getWebSocket as unknown as Mock const spyOn = vi.fn() @@ -146,12 +146,12 @@ describe('logs:function command', () => { const messageCallback = spyOn.mock.calls.find((args) => args[0] === 'message') const messageCallbackFunc = messageCallback[1] const mockInfoData = { - "level": LOG_LEVELS.INFO, - "message": "Hello World", + level: LOG_LEVELS.INFO, + message: 'Hello World', } const mockWarnData = { - "level": LOG_LEVELS.WARN, - "message": "There was a warning", + level: LOG_LEVELS.WARN, + message: 'There was a warning', } messageCallbackFunc(JSON.stringify(mockInfoData)) @@ -160,7 +160,7 @@ describe('logs:function command', () => { expect(spyLog).toHaveBeenCalledTimes(1) }) - test('should print all the log levels', async ({ }) => { + test('should print all the log levels', async ({}) => { const { apiUrl } = await startMockApi({ routes }) const spyWebsocket = getWebSocket as unknown as Mock const spyOn = vi.fn() @@ -178,12 +178,12 @@ describe('logs:function command', () => { const messageCallback = spyOn.mock.calls.find((args) => args[0] === 'message') const messageCallbackFunc = messageCallback[1] const mockInfoData = { - "level": LOG_LEVELS.INFO, - "message": "Hello World", + level: LOG_LEVELS.INFO, + message: 'Hello World', } const mockWarnData = { - "level": LOG_LEVELS.WARN, - "message": "There was a warning", + level: LOG_LEVELS.WARN, + message: 'There was a warning', } messageCallbackFunc(JSON.stringify(mockInfoData)) diff --git a/tests/integration/commands/sites/sites.test.ts b/tests/integration/commands/sites/sites.test.ts index 55566d59290..1727e3f702b 100644 --- a/tests/integration/commands/sites/sites.test.ts +++ b/tests/integration/commands/sites/sites.test.ts @@ -5,18 +5,13 @@ import { render } from 'prettyjson' import { afterAll, beforeEach, describe, expect, test, vi } from 'vitest' import BaseCommand from '../../../../src/commands/base-command.js' -import { - fetchTemplates, -} from '../../../../src/commands/sites/sites-create-template.js' -import { createSitesCreateCommand , - createSitesFromTemplateCommand -} from '../../../../src/commands/sites/sites.js' +import { fetchTemplates } from '../../../../src/commands/sites/sites-create-template.js' +import { createSitesCreateCommand, createSitesFromTemplateCommand } from '../../../../src/commands/sites/sites.js' import { getGitHubToken } from '../../../../src/utils/init/config-github.js' import { createRepo, getTemplatesFromGitHub } from '../../../../src/utils/sites/utils.js' import { getEnvironmentVariables, withMockApi } from '../../utils/mock-api.js' vi.mock('../../../../src/utils/command-helpers.js', async () => ({ - // @ts-expect-error No types yet for command-helpers ...(await vi.importActual('../../../../src/utils/command-helpers.js')), // eslint-disable-next-line @typescript-eslint/no-empty-function log: () => {}, diff --git a/tools/project-graph/types.d.ts b/tools/project-graph/types.d.ts index 87e0f0f5ba1..8738aa4015d 100644 --- a/tools/project-graph/types.d.ts +++ b/tools/project-graph/types.d.ts @@ -1,6 +1,6 @@ -import type { Node } from 'typescript'; +import type { Node } from 'typescript' -import type { DependencyGraph } from './dependency-graph.js'; +import type { DependencyGraph } from './dependency-graph.js' export type Dependency = { fileName: string