From 06c794fe9d6ee8fe466441c56d267707ee4ba234 Mon Sep 17 00:00:00 2001 From: Salah-Eddine Saakoun Date: Tue, 17 Nov 2026 13:26:16 +0100 Subject: [PATCH 1/6] chore: apply the oxlint rules to the workflow scripts --- oxlint.config.mts | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/oxlint.config.mts b/oxlint.config.mts index cbae98fd..7b620e22 100644 --- a/oxlint.config.mts +++ b/oxlint.config.mts @@ -3,6 +3,17 @@ import commonjs from '@metamask/oxlint-config-commonjs'; import nodejs from '@metamask/oxlint-config-nodejs'; import typescript from '@metamask/oxlint-config-typescript'; import vitest from '@metamask/oxlint-config-vitest'; +import type { OxlintConfig } from 'oxlint'; + +// Tests and workflow scripts read the environment and use synchronous APIs. +const relaxedNodeRules: OxlintConfig = { + rules: { + 'node/no-process-env': 'off', + 'node/no-sync': 'off', + }, +}; + +type Overrides = NonNullable[0]['overrides']>; export default createConfig({ extends: [base], @@ -41,27 +52,14 @@ export default createConfig({ '.github/**/*.test.{mjs,mts}', '.github/scripts/tests/**', ], - extends: [ - nodejs, - vitest, - { - // Tests read the environment and use synchronous APIs for fixtures. - rules: { - 'node/no-process-env': 'off', - 'node/no-sync': 'off', - }, - }, - ], + extends: [nodejs, vitest, relaxedNodeRules], }, { // The workflow scripts are command line programs: they read their inputs // from the environment and can use synchronous APIs. - files: ['.github/**'], - rules: { - 'node/no-process-env': 'off', - 'node/no-sync': 'off', - }, + files: ['.github/**/*.{js,mjs,mts,ts}'], + extends: [nodejs, relaxedNodeRules], }, - ], + ] as Overrides, }); From c97163827d02d44ed265099f07ffd21deeca0182 Mon Sep 17 00:00:00 2001 From: Salah-Eddine Saakoun Date: Tue, 17 Nov 2026 13:28:39 +0100 Subject: [PATCH 2/6] chore: apply the oxlint autofixes to the workflow scripts and src --- .../create-playwright-test-health-report.mjs | 2 - .../lib/classify-report-buckets.mjs | 8 +- .../lib/slack-test-health-blocks.mjs | 2 +- .github/scripts/clean-release-changelog.mts | 6 +- .github/scripts/create-flaky-test-report.mjs | 24 ++--- .github/scripts/generate-rc-commits.mjs | 23 ++-- .../scripts/post-merge-validation-tracker.mjs | 101 +++++++++++++----- .../scripts/remove-rca-needed-label-sheets.ts | 62 +++++------ .github/scripts/slack-release-testing.mjs | 20 ++-- .github/scripts/stable-sync.js | 2 - .../update-release-changelog-baseline.mts | 2 +- .github/scripts/update-release-changelog.mts | 2 +- .github/scripts/update-release-sheet.mjs | 8 +- .../analytics-model.ts | 2 +- src/segment-schema-draft-pr/apply-changes.ts | 7 +- src/segment-schema-draft-pr/cli.ts | 3 +- src/segment-schema-draft-pr/generate.test.ts | 4 +- src/segment-schema-draft-pr/publish.test.ts | 3 +- src/segment-schema-draft-pr/schema-index.ts | 4 +- 19 files changed, 165 insertions(+), 120 deletions(-) diff --git a/.github/actions/playwright-test-health-report/create-playwright-test-health-report.mjs b/.github/actions/playwright-test-health-report/create-playwright-test-health-report.mjs index 912176bb..1c318250 100644 --- a/.github/actions/playwright-test-health-report/create-playwright-test-health-report.mjs +++ b/.github/actions/playwright-test-health-report/create-playwright-test-health-report.mjs @@ -1,5 +1,3 @@ -#!/usr/bin/env node - import { Octokit } from '@octokit/rest'; import { diff --git a/.github/actions/playwright-test-health-report/lib/classify-report-buckets.mjs b/.github/actions/playwright-test-health-report/lib/classify-report-buckets.mjs index 74176daa..4c8f315a 100644 --- a/.github/actions/playwright-test-health-report/lib/classify-report-buckets.mjs +++ b/.github/actions/playwright-test-health-report/lib/classify-report-buckets.mjs @@ -44,19 +44,19 @@ export function partitionSummary(summary) { export function allocateBucketSlots(topN, counts) { const { broken = 0, flaky = 0, watch = 0, infra = 0 } = counts; - let maxBroken = Math.min( + const maxBroken = Math.min( broken, Math.max(Math.ceil(topN * 0.4), broken > 0 ? 2 : 0), ); - let maxFlaky = Math.min( + const maxFlaky = Math.min( flaky, Math.max(Math.ceil(topN * 0.25), flaky > 0 ? 2 : 0), ); - let maxInfra = Math.min( + const maxInfra = Math.min( infra, Math.max(Math.ceil(topN * 0.1), infra > 0 ? 1 : 0), ); - let maxWatch = Math.min(watch, topN - maxBroken - maxFlaky - maxInfra); + const maxWatch = Math.min(watch, topN - maxBroken - maxFlaky - maxInfra); let remaining = topN - (maxBroken + maxFlaky + maxWatch + maxInfra); diff --git a/.github/actions/playwright-test-health-report/lib/slack-test-health-blocks.mjs b/.github/actions/playwright-test-health-report/lib/slack-test-health-blocks.mjs index 64cfad50..25807267 100644 --- a/.github/actions/playwright-test-health-report/lib/slack-test-health-blocks.mjs +++ b/.github/actions/playwright-test-health-report/lib/slack-test-health-blocks.mjs @@ -14,7 +14,7 @@ export function normalizeErrorForSlack(message, maxLength = 120) { } const withoutEmojiShortcodes = String(message).replace( - /:[a-z0-9_+\-]+:/gi, + /:[a-z0-9_+-]+:/gi, ' ', ); const firstMeaningfulLine = withoutEmojiShortcodes diff --git a/.github/scripts/clean-release-changelog.mts b/.github/scripts/clean-release-changelog.mts index 1f3e3f81..f06bb8b0 100644 --- a/.github/scripts/clean-release-changelog.mts +++ b/.github/scripts/clean-release-changelog.mts @@ -525,7 +525,7 @@ export async function requestGhApiWithRetry( request: GhApiRequest = executeGhApi, sleep?: (milliseconds: number) => Promise, ): Promise { - return await retry(async () => request(argumentsList), { + return await retry(async () => await request(argumentsList), { delayMilliseconds: GH_API_RETRY_DELAY_MS, maxAttempts: GH_API_MAX_ATTEMPTS, onRetry: ({ attempt, delayMilliseconds }) => { @@ -763,7 +763,7 @@ export async function requestCleanRoomRewrite({ ], }; - return retry( + return await retry( async () => { const controller = new AbortController(); const timeout = setTimeout(() => controller.abort(), timeoutMs); @@ -839,7 +839,7 @@ export async function requestValidatedRewrite( prNumbers: readonly string[], maxAttempts = MAX_VALIDATION_ATTEMPTS, ): Promise { - return retry( + return await retry( async () => { const section = await requestCleanRoomRewrite(options); try { diff --git a/.github/scripts/create-flaky-test-report.mjs b/.github/scripts/create-flaky-test-report.mjs index 53b2238b..d499cc66 100644 --- a/.github/scripts/create-flaky-test-report.mjs +++ b/.github/scripts/create-flaky-test-report.mjs @@ -1,5 +1,3 @@ -#!/usr/bin/env node - // Based on the original script done by @itsyoboieltr on Extension repo import { Octokit } from '@octokit/rest'; @@ -7,7 +5,9 @@ import { IncomingWebhook } from '@slack/webhook'; import unzipper from 'unzipper'; const githubToken = process.env.GITHUB_TOKEN; -if (!githubToken) throw new Error('Missing GITHUB_TOKEN env var'); +if (!githubToken) { + throw new Error('Missing GITHUB_TOKEN env var'); +} const env = { GITHUB_TOKEN: process.env.GITHUB_TOKEN, @@ -184,7 +184,7 @@ function extractRealFailures(testData) { jobId: testSuite.job?.id, runId: testSuite.job?.runId, date: new Date(testSuite.date || Date.now()), - retryCount: retryCount, + retryCount, type: 'real_failure', }); } @@ -237,7 +237,7 @@ function extractFlakyTests(testData) { jobId: failureInfo.jobId, runId: failureInfo.runId, date: failureInfo.date, - retryCount: retryCount, + retryCount, type: 'flaky', }); } @@ -482,7 +482,7 @@ function createSlackBlocks( elements: [ { type: 'rich_text_section', - elements: elements, + elements, }, ], }); @@ -491,7 +491,7 @@ function createSlackBlocks( const error = test.lastRealFailureError; if (error) { const errorPreview = - error.length > 150 ? error.substring(0, 150) + '...' : error; + error.length > 150 ? `${error.substring(0, 150)}...` : error; blocks.push({ type: 'rich_text', elements: [ @@ -577,7 +577,7 @@ function createSlackBlocks( elements: [ { type: 'rich_text_section', - elements: elements, + elements, }, ], }); @@ -586,7 +586,7 @@ function createSlackBlocks( const error = test.flakyFailureError; if (error) { const errorPreview = - error.length > 150 ? error.substring(0, 150) + '...' : error; + error.length > 150 ? `${error.substring(0, 150)}...` : error; blocks.push({ type: 'rich_text', elements: [ @@ -610,7 +610,7 @@ function createSlackBlocks( } function displayResults(summary, dateDisplay) { - console.log('\n' + '='.repeat(80)); + console.log(`\n${'='.repeat(80)}`); console.log(`šŸ“Š REPORT - ${dateDisplay}`); console.log('='.repeat(80)); @@ -662,7 +662,7 @@ function displayResults(summary, dateDisplay) { if (test.lastRealFailureError) { const errorPreview = test.lastRealFailureError.length > 100 - ? test.lastRealFailureError.substring(0, 100) + '...' + ? `${test.lastRealFailureError.substring(0, 100)}...` : test.lastRealFailureError; console.log(` šŸ’„ Error: ${errorPreview.replace(/\n/g, ' ')}`); } @@ -684,7 +684,7 @@ function displayResults(summary, dateDisplay) { if (test.flakyFailureError) { const errorPreview = test.flakyFailureError.length > 100 - ? test.flakyFailureError.substring(0, 100) + '...' + ? `${test.flakyFailureError.substring(0, 100)}...` : test.flakyFailureError; console.log( ` šŸ’„ Initial error: ${errorPreview.replace(/\n/g, ' ')}`, diff --git a/.github/scripts/generate-rc-commits.mjs b/.github/scripts/generate-rc-commits.mjs index 74e21cf7..99b73bcd 100644 --- a/.github/scripts/generate-rc-commits.mjs +++ b/.github/scripts/generate-rc-commits.mjs @@ -37,7 +37,7 @@ async function getTeam(repository, prNumber) { console.error( `Invalid response when fetching topology.json: ${response.status}`, ); - return undefined; + return; } const topologyJson = response.data; @@ -59,13 +59,13 @@ async function getTeam(repository, prNumber) { } // Return undefined if author not found in any team - return undefined; + return; } catch (error) { console.error( `Error fetching team for PR #${prNumber}:`, error.message || error, ); - return undefined; + return; } } @@ -75,7 +75,7 @@ async function filterCommitsByTeam(platform, refA, refB) { const MAX_COMMITS = 500; // Limit the number of commits to process console.log('Filtering commits by team...'); - var repository = ''; + let repository = ''; switch (platform) { case 'mobile': @@ -190,22 +190,25 @@ function escapeCSV(field) { } // Helper function to create change type function assignChangeType(field) { - if (field.includes('feat')) return 'Added'; - else if ( + if (field.includes('feat')) { + return 'Added'; + } else if ( field.includes('cherry') || field.includes('bump') || field.includes('release') - ) + ) { return 'Ops'; - else if ( + } else if ( field.includes('chore') || field.includes('test') || field.includes('ci') || field.includes('docs') || field.includes('refactor') - ) + ) { return 'Changed'; - else if (field.includes('fix')) return 'Fixed'; + } else if (field.includes('fix')) { + return 'Fixed'; + } return 'Unknown'; } diff --git a/.github/scripts/post-merge-validation-tracker.mjs b/.github/scripts/post-merge-validation-tracker.mjs index 0ac697e7..90a11acc 100644 --- a/.github/scripts/post-merge-validation-tracker.mjs +++ b/.github/scripts/post-merge-validation-tracker.mjs @@ -26,11 +26,18 @@ const AUTOMATED_TEST_PATTERNS = [ ]; const SKIP_RELEASE_VALIDATION_LABEL = 'skip-release-validation'; -if (!githubToken) throw new Error('Missing GITHUB_TOKEN env var'); -if (!spreadsheetId) throw new Error('Missing SHEET_ID env var'); -if (!googleApplicationCredentialsBase64) +if (!githubToken) { + throw new Error('Missing GITHUB_TOKEN env var'); +} +if (!spreadsheetId) { + throw new Error('Missing SHEET_ID env var'); +} +if (!googleApplicationCredentialsBase64) { throw new Error('Missing GOOGLE_APPLICATION_CREDENTIALS_BASE64 env var'); -if (!repo) throw new Error('Missing REPO env var'); +} +if (!repo) { + throw new Error('Missing REPO env var'); +} const octokit = new Octokit({ auth: githubToken }); const sheets = google.sheets('v4'); @@ -48,16 +55,21 @@ async function getGoogleAuth() { function parseRepo() { const [owner, repoName] = repo.split('/'); - if (!owner || !repoName) + if (!owner || !repoName) { throw new Error( `Invalid repo format "${repo}". Expected format: "owner/repo"`, ); + } return { owner, repo: repoName }; } function repoType(repo) { - if (repo.endsWith('-extension')) return 'extension'; - if (repo.endsWith('-mobile')) return 'mobile'; + if (repo.endsWith('-extension')) { + return 'extension'; + } + if (repo.endsWith('-mobile')) { + return 'mobile'; + } return repo; } @@ -67,8 +79,12 @@ function tabTitleFor(repo, releaseLabel) { function platformLabelFor(type) { const t = String(type).toLowerCase(); - if (t === 'mobile') return 'šŸ“± Mobile - Pull requests'; - if (t === 'extension') return 'šŸ”Œ Extension - Pull requests'; + if (t === 'mobile') { + return 'šŸ“± Mobile - Pull requests'; + } + if (t === 'extension') { + return 'šŸ”Œ Extension - Pull requests'; + } return t; } @@ -100,12 +116,13 @@ async function ensureSheetExists(authClient, title, platformType) { // First, try to find the exact title (with "pre-" prefix) let existing = sheetsList.find((s) => s.properties?.title === title); - if (existing) + if (existing) { return { sheetId: existing.properties.sheetId, actualTitle: title, isNew: false, }; + } // If not found and title starts with "pre-", try without the "pre-" prefix if (title.startsWith('pre-')) { @@ -262,7 +279,9 @@ async function readRows(authClient, title) { } async function appendRows(authClient, title, rows) { - if (!rows.length) return; + if (!rows.length) { + return; + } await sheets.spreadsheets.values.append({ spreadsheetId, auth: authClient, @@ -278,7 +297,9 @@ function uniqKey(number) { } function formatDateHumanUTC(iso) { - if (!iso) return ''; + if (!iso) { + return ''; + } const d = new Date(iso); const yyyy = d.getUTCFullYear(); const mm = String(d.getUTCMonth() + 1).padStart(2, '0'); @@ -349,7 +370,9 @@ async function fetchMergedPRsSince(owner, repo, sinceDateISO) { advanced_search: true, }); - if (!data.items.length) break; + if (!data.items.length) { + break; + } console.log(`Found ${data.items.length} PRs on page ${page}`); for (const item of data.items) { @@ -369,7 +392,9 @@ async function fetchMergedPRsSince(owner, repo, sinceDateISO) { } } - if (data.items.length < 100) break; + if (data.items.length < 100) { + break; + } page++; await sleep(200); } catch (e) { @@ -385,7 +410,9 @@ async function fetchMergedPRsSince(owner, repo, sinceDateISO) { } function isRelevantTitle(title) { - if (!title) return false; + if (!title) { + return false; + } return RELEVANT_TITLE_REGEX.test(String(title)); } @@ -393,7 +420,9 @@ function extractLabelText(formulaOrText) { const s = String(formulaOrText || ''); // If it's a HYPERLINK formula like =HYPERLINK("url","Label") extract Label const m = s.match(/HYPERLINK\([^,]+,\s*"([^"]+)"\)/i); - if (m) return m[1]; + if (m) { + return m[1]; + } return s; } @@ -509,10 +538,10 @@ function applyAutoSkipToRow(row, labels, repoName) { } // Add efficient version detection with caching -let versionCache = new Map(); // Cache version bumps per repo +const versionCache = new Map(); // Cache version bumps per repo // Automated test detection cache -let automatedTestCache = new Map(); // Cache automated test results per PR: "owner/repo/prNumber" -> "Yes"|"No"|"Unknown" +const automatedTestCache = new Map(); // Cache automated test results per PR: "owner/repo/prNumber" -> "Yes"|"No"|"Unknown" async function getVersionTimelineForRepo(owner, repo, sinceDateISO) { const cacheKey = `${owner}/${repo}`; @@ -535,7 +564,7 @@ async function getVersionTimelineForRepo(owner, repo, sinceDateISO) { // Create timeline: [newest bump, older bump, ..., oldest bump] const timeline = { currentVersion: normalizeVersion(currentVersion), - versionBumps: versionBumps, // Already sorted newest first + versionBumps, // Already sorted newest first sinceDate: new Date(sinceDateISO), }; @@ -583,11 +612,15 @@ function parseVersionFromPatch(patch) { for (const line of lines) { if (line.startsWith('-') && line.includes('"version":')) { const match = line.match(/"version":\s*"([^"]+)"/); - if (match) oldVersion = match[1]; + if (match) { + oldVersion = match[1]; + } } if (line.startsWith('+') && line.includes('"version":')) { const match = line.match(/"version":\s*"([^"]+)"/); - if (match) newVersion = match[1]; + if (match) { + newVersion = match[1]; + } } } @@ -598,7 +631,9 @@ function parseVersionFromPatch(patch) { } function normalizeVersion(version) { - if (!version) return null; + if (!version) { + return null; + } return version.startsWith('v') ? version : `v${version}`; } @@ -653,7 +688,9 @@ async function buildTabGrouping(owner, repo, relevantItems, sinceDateISO) { pr.closed_at, versionTimeline, ); - if (!releaseVersion) continue; + if (!releaseVersion) { + continue; + } if (!prsByVersion.has(releaseVersion)) { prsByVersion.set(releaseVersion, []); @@ -777,7 +814,9 @@ async function fetchPRFiles(owner, repo, prNumber) { allFiles.push(...files); // If we got less than 100 files, we've reached the end - if (files.length < 100) break; + if (files.length < 100) { + break; + } page++; await sleep(100); @@ -791,7 +830,9 @@ async function fetchPRFiles(owner, repo, prNumber) { } function checkFilesForAutomatedTestPatterns(filenames) { - if (!filenames || filenames.length === 0) return false; + if (!filenames || filenames.length === 0) { + return false; + } // Debug logging to help identify pattern matching issues const matches = filenames.filter((filename) => @@ -849,7 +890,7 @@ async function removePrePrefixFromSheet(authClient, sheetTitle) { return false; } - const sheetId = sheet.properties.sheetId; + const { sheetId } = sheet.properties; // Rename the sheet by removing "pre-" prefix await sheets.spreadsheets.batchUpdate({ @@ -860,7 +901,7 @@ async function removePrePrefixFromSheet(authClient, sheetTitle) { { updateSheetProperties: { properties: { - sheetId: sheetId, + sheetId, title: newTitle, }, fields: 'title', @@ -901,10 +942,12 @@ async function processTab(authClient, title, entries, platformType) { const deduped = []; for (const r of sortedRows) { const num = parsePrNumberFromCell(r[0]); - const key = num !== null ? uniqKey(num) : null; + const key = num === null ? null : uniqKey(num); if (!key || !existingKeys.has(key)) { deduped.push(r); - if (key) existingKeys.add(key); + if (key) { + existingKeys.add(key); + } } } console.log(`Tab=${actualTitle} toInsertAfterDedup=${deduped.length}`); diff --git a/.github/scripts/remove-rca-needed-label-sheets.ts b/.github/scripts/remove-rca-needed-label-sheets.ts index 86833792..f52e87b1 100644 --- a/.github/scripts/remove-rca-needed-label-sheets.ts +++ b/.github/scripts/remove-rca-needed-label-sheets.ts @@ -1,9 +1,9 @@ // Note: These packages are installed at runtime in the GitHub Actions workflow -// @ts-ignore - @actions/core is not in devDependencies +// @ts-expect-error - @actions/core is not in devDependencies import * as core from '@actions/core'; -// @ts-ignore - @actions/github is not in devDependencies +// @ts-expect-error - @actions/github is not in devDependencies import { context, getOctokit } from '@actions/github'; -// @ts-ignore - googleapis types may not be available locally +// @ts-expect-error - googleapis types may not be available locally import { google } from 'googleapis'; // HTTP status codes enum for better maintainability @@ -11,11 +11,11 @@ enum HttpStatusCode { NotFound = 404, } -interface Label { +type Label = { name: string; color: string; description: string; -} +}; const RCA_NEEDED_LABEL: Label = { name: 'RCA-needed', @@ -24,14 +24,14 @@ const RCA_NEEDED_LABEL: Label = { }; // Type alias for Google Sheets v4 API -// @ts-ignore - googleapis types may not be available locally +// @ts-expect-error - googleapis types may not be available locally type SheetsV4 = ReturnType; // Google Sheets configuration from environment variables -// @ts-ignore - process is available at runtime in GitHub Actions -const SPREADSHEET_ID = process.env.SPREADSHEET_ID; -// @ts-ignore - process is available at runtime in GitHub Actions -const SHEET_NAME = process.env.SHEET_NAME; +// @ts-expect-error - process is available at runtime in GitHub Actions +const { SPREADSHEET_ID } = process.env; +// @ts-expect-error - process is available at runtime in GitHub Actions +const { SHEET_NAME } = process.env; /** * Represents a single response row from the RCA (Root Cause Analysis) Google Form. @@ -40,19 +40,19 @@ const SHEET_NAME = process.env.SHEET_NAME; * @property [key: string] - Any additional form fields captured from the Google Form. * The keys correspond to column headers in the Google Sheet, and the values are the user responses. */ -interface RcaFormResponse { +type RcaFormResponse = { issueNumber: string; timestamp: string; [key: string]: any; -} +}; // GitHub GraphQL types -interface GitHubLabel { +type GitHubLabel = { id: string; name: string; -} +}; -interface GitHubIssue { +type GitHubIssue = { id: string; number: number; title: string; @@ -61,9 +61,9 @@ interface GitHubIssue { labels: { nodes: GitHubLabel[]; }; -} +}; -interface GetIssuesWithRcaLabelResponse { +type GetIssuesWithRcaLabelResponse = { repository: { issues: { nodes: GitHubIssue[]; @@ -73,11 +73,11 @@ interface GetIssuesWithRcaLabelResponse { }; }; }; -} +}; async function main(): Promise { try { - // @ts-ignore - process is available at runtime in GitHub Actions + // @ts-expect-error - process is available at runtime in GitHub Actions const githubToken = process.env.GITHUB_TOKEN; if (!githubToken) { core.setFailed('GITHUB_TOKEN not found'); @@ -85,7 +85,7 @@ async function main(): Promise { } // Google Sheets API credentials (base64 encoded service account JSON) - // @ts-ignore - process is available at runtime in GitHub Actions + // @ts-expect-error - process is available at runtime in GitHub Actions const googleCredentials = process.env.GOOGLE_SHEETS_CREDENTIALS; if (!googleCredentials) { core.setFailed('GOOGLE_SHEETS_CREDENTIALS not found'); @@ -102,7 +102,7 @@ async function main(): Promise { return; } - // @ts-ignore - process is available at runtime in GitHub Actions + // @ts-expect-error - process is available at runtime in GitHub Actions const isDryRun = process.env.DRY_RUN === 'true'; const octokit = getOctokit(githubToken); @@ -154,7 +154,12 @@ async function main(): Promise { `āœ… RCA response found in Google Sheets for issue #${issue.number}`, ); - if (!isDryRun) { + if (isDryRun) { + console.log( + `šŸ” [DRY RUN] Would remove label from issue #${issue.number}`, + ); + removedCount++; + } else { // Remove the RCA-needed label await removeLabelFromIssue( octokit, @@ -168,11 +173,6 @@ async function main(): Promise { `āœ… Successfully removed RCA-needed label from issue #${issue.number}`, ); removedCount++; - } else { - console.log( - `šŸ” [DRY RUN] Would remove label from issue #${issue.number}`, - ); - removedCount++; } } else { console.log( @@ -225,7 +225,7 @@ async function main(): Promise { async function initializeGoogleSheets(credentials: string): Promise { // Decode base64 credentials const credentialsJson = JSON.parse( - // @ts-ignore - Buffer is available at runtime in GitHub Actions + // @ts-expect-error - Buffer is available at runtime in GitHub Actions Buffer.from(credentials, 'base64').toString('utf-8'), ); @@ -258,7 +258,7 @@ async function fetchRcaResponses(sheets: SheetsV4): Promise { const headerRow = rows[0] || []; const ISSUE_NUMBER_HEADER = 'Issue Number'; const issueNumberColumnIndex = headerRow.findIndex( - (col: string) => col && col.trim() === ISSUE_NUMBER_HEADER, + (col: string) => col?.trim() === ISSUE_NUMBER_HEADER, ); if (issueNumberColumnIndex === -1) { @@ -291,7 +291,7 @@ async function fetchRcaResponses(sheets: SheetsV4): Promise { if (issueMatch) { const issueNumber = issueMatch[1]; responses.push({ - issueNumber: issueNumber, + issueNumber, timestamp: row[0] || '', // Column A: Timestamp // Additional fields can be added if needed: // repository: row[2], // Column C: Github Repository @@ -367,7 +367,7 @@ async function getIssuesWithRcaLabel( labelNames: LABEL_NAMES, pageSize: PAGE_SIZE, }); - const issues = result.repository.issues; + const { issues } = result.repository; allIssues.push(...(issues.nodes || [])); hasNextPage = issues.pageInfo.hasNextPage; diff --git a/.github/scripts/slack-release-testing.mjs b/.github/scripts/slack-release-testing.mjs index 9db5c680..31cb23b6 100644 --- a/.github/scripts/slack-release-testing.mjs +++ b/.github/scripts/slack-release-testing.mjs @@ -36,7 +36,7 @@ async function getGoogleAuth() { // Initialize GoogleAuth with credentials object directly const auth = new google.auth.GoogleAuth({ - credentials: credentials, + credentials, scopes: ['https://www.googleapis.com/auth/spreadsheets'], }); @@ -130,9 +130,8 @@ async function findPullRequestUrlByBranch(owner, repo, branchName) { if (data.length > 0) { // Assuming you want the first PR that matches return data[0].html_url; // Return the URL of the first matching PR - } else { - throw new Error(`No pull requests found for branch ${branchName}`); } + throw new Error(`No pull requests found for branch ${branchName}`); } catch (error) { console.error('Error fetching pull requests:', error); throw error; @@ -258,7 +257,7 @@ async function getReleaseBlockers(release, team) { const { data } = await octokit.rest.issues.listForRepo({ owner, repo, - labels: labels, + labels, state: 'open', // Optionally, filter by state (open, closed, all) }); @@ -291,9 +290,8 @@ async function getPublishChannelName(release) { // Allows for local testing without publishing actual release channels if (testOnly()) { return `${channel}-testonly`; - } else { - return channel; } + return channel; } async function fmtSlackHandle(team) { @@ -337,11 +335,11 @@ async function publishReleaseTestingStatus(release) { `Publishing testing status for release ${release.SemanticVersion} on platform ${release.Platform} to channel ${channel}`, ); - var header = + let header = `:blablablocker:* [${fmtPlatform}] - ${release.SemanticVersion} Release Validation.*\n` + `_*Testing Plan and Progress Tracker Summary*_ ():`; - var body = `*Teams Sign Off ${release.SemanticVersion} Release on <${releasePrUrl}|GH>:*\n`; + let body = `*Teams Sign Off ${release.SemanticVersion} Release on <${releasePrUrl}|GH>:*\n`; const hasPendingSignoffs = teamResults.some( (team) => team.status !== 'Completed', @@ -350,12 +348,12 @@ async function publishReleaseTestingStatus(release) { let releaseBlockerCount = 0; for (const team of teamResults) { - let slackHandlePart = await fmtSlackHandle(team); + const slackHandlePart = await fmtSlackHandle(team); //Grab RCs for a specific team/release const releaseBlockers = await getReleaseBlockers(release, team.team); //Accumulate the total release blocker count releaseBlockerCount += releaseBlockers.count; - let releaseBlockerParts = + const releaseBlockerParts = releaseBlockers.count > 0 ? ` - <${releaseBlockers.url}|${releaseBlockers.count} Release Blockers>` : ''; @@ -373,7 +371,7 @@ async function publishReleaseTestingStatus(release) { try { await slackClient.chat.postMessage({ - channel: channel, + channel, text: slackMessage, unfurl_links: false, unfurl_media: false, diff --git a/.github/scripts/stable-sync.js b/.github/scripts/stable-sync.js index 8794f555..eef41370 100644 --- a/.github/scripts/stable-sync.js +++ b/.github/scripts/stable-sync.js @@ -1,5 +1,3 @@ -#!/usr/bin/env node - // USAGE: // This will create/update a local stable-sync branch // and get it in the state needed for a stable-sync PR diff --git a/.github/scripts/update-release-changelog-baseline.mts b/.github/scripts/update-release-changelog-baseline.mts index a34a7366..e1213c82 100644 --- a/.github/scripts/update-release-changelog-baseline.mts +++ b/.github/scripts/update-release-changelog-baseline.mts @@ -5,9 +5,9 @@ import { } from './release-section.mts'; import { compareSemver, - type ReleaseBranch, selectHighestLowerVersion, } from './release-version-utils.mts'; +import type { ReleaseBranch } from './release-version-utils.mts'; const RELEASE_LINK_REFERENCE = /^\[(\d+\.\d+\.\d+)\]: /u; diff --git a/.github/scripts/update-release-changelog.mts b/.github/scripts/update-release-changelog.mts index 9defff80..b5ad0d5e 100644 --- a/.github/scripts/update-release-changelog.mts +++ b/.github/scripts/update-release-changelog.mts @@ -34,8 +34,8 @@ import { writeReport } from './shared/report.mts'; import { removeNewerReleases, selectChangelogBaseline, - type ChangelogBaseline, } from './update-release-changelog-baseline.mts'; +import type { ChangelogBaseline } from './update-release-changelog-baseline.mts'; type ProofreadingStatus = 'succeeded' | 'failed' | 'no-new-prs' | 'unchanged'; diff --git a/.github/scripts/update-release-sheet.mjs b/.github/scripts/update-release-sheet.mjs index c22f734c..fbb720eb 100644 --- a/.github/scripts/update-release-sheet.mjs +++ b/.github/scripts/update-release-sheet.mjs @@ -28,7 +28,7 @@ async function getGoogleAuth() { // Initialize GoogleAuth with credentials object directly const auth = new google.auth.GoogleAuth({ - credentials: credentials, + credentials, scopes: ['https://www.googleapis.com/auth/spreadsheets'], }); @@ -281,7 +281,7 @@ async function main() { const releases = await getAllReleases(documentId); - var sheetExists = false; + let sheetExists = false; releases.forEach((release) => { console.log( @@ -358,7 +358,9 @@ function parseCSVv2(filePath) { // Start from the second line to skip headers for (let i = 1; i < lines.length; i++) { - if (lines[i].trim() === '') continue; // Skip empty lines + if (lines[i].trim() === '') { + continue; + } // Skip empty lines // Split the line into columns based on commas const columns = lines[i].split(','); diff --git a/src/segment-schema-draft-pr/analytics-model.ts b/src/segment-schema-draft-pr/analytics-model.ts index a46e02fe..2d31fb25 100644 --- a/src/segment-schema-draft-pr/analytics-model.ts +++ b/src/segment-schema-draft-pr/analytics-model.ts @@ -25,7 +25,7 @@ export function extractAnalyticsModel( filePath: string, sourceText: string, config: PlatformConfig, - sharedCatalog: EventCatalog | undefined = undefined, + sharedCatalog?: EventCatalog | undefined, ): AnalyticsModel { const sourceFile = ts.createSourceFile( filePath, diff --git a/src/segment-schema-draft-pr/apply-changes.ts b/src/segment-schema-draft-pr/apply-changes.ts index dca253c2..9acff13a 100644 --- a/src/segment-schema-draft-pr/apply-changes.ts +++ b/src/segment-schema-draft-pr/apply-changes.ts @@ -5,7 +5,8 @@ import type { Document as YamlDocument } from 'yaml'; import { TODO_DESCRIPTION } from './constants'; import { uniqueKebabSlug } from './names'; -import { defaultPropKeys, type SchemaIndex } from './schema-index'; +import { defaultPropKeys } from './schema-index'; +import type { SchemaIndex } from './schema-index'; import type { AnalyticsChangeSet, IntendedFileChange, @@ -454,7 +455,7 @@ function yamlKey(value: unknown): string | undefined { return value; } if (value && typeof value === 'object' && 'value' in value) { - const inner = (value as { value: unknown }).value; + const inner = value.value; if (typeof inner === 'string') { return inner; } @@ -476,7 +477,7 @@ function isYamlMap(value: unknown): value is { typeof value === 'object' && value !== null && 'items' in value && - Array.isArray((value as { items: unknown }).items) + Array.isArray(value.items) ); } diff --git a/src/segment-schema-draft-pr/cli.ts b/src/segment-schema-draft-pr/cli.ts index 6be73bc7..8f2ba332 100644 --- a/src/segment-schema-draft-pr/cli.ts +++ b/src/segment-schema-draft-pr/cli.ts @@ -3,7 +3,8 @@ import { botBranchName } from './config'; import { generateSchemaDraft, writeSummaryFile } from './generate'; import { createOctokitClients, parseRepo } from './github-api'; import { writeGithubOutput } from './github-output'; -import { parseCliArgs, type CliArgs } from './parse-args'; +import { parseCliArgs } from './parse-args'; +import type { CliArgs } from './parse-args'; import { runPublish } from './publish'; main().catch((error: unknown) => { diff --git a/src/segment-schema-draft-pr/generate.test.ts b/src/segment-schema-draft-pr/generate.test.ts index b0fc2bcf..e7370705 100644 --- a/src/segment-schema-draft-pr/generate.test.ts +++ b/src/segment-schema-draft-pr/generate.test.ts @@ -70,9 +70,9 @@ function mockClientOctokit( new Error('Not Found'), { status: 404 }, ); - return Promise.reject(error); + return await Promise.reject(error); } - return Promise.resolve(encodedFile(text)); + return await Promise.resolve(encodedFile(text)); }, ); diff --git a/src/segment-schema-draft-pr/publish.test.ts b/src/segment-schema-draft-pr/publish.test.ts index eaabf195..03f82c03 100644 --- a/src/segment-schema-draft-pr/publish.test.ts +++ b/src/segment-schema-draft-pr/publish.test.ts @@ -1,5 +1,6 @@ import type { Octokit } from '@octokit/rest'; -import { describe, expect, it, vi, type Mock } from 'vitest'; +import { describe, expect, it, vi } from 'vitest'; +import type { Mock } from 'vitest'; import { PROPOSAL_MARKER } from './constants'; import type { CliArgs } from './parse-args'; diff --git a/src/segment-schema-draft-pr/schema-index.ts b/src/segment-schema-draft-pr/schema-index.ts index f4fd0677..71bd1eea 100644 --- a/src/segment-schema-draft-pr/schema-index.ts +++ b/src/segment-schema-draft-pr/schema-index.ts @@ -183,7 +183,7 @@ function isYamlMap(value: unknown): value is { typeof value === 'object' && value !== null && 'items' in value && - Array.isArray((value as { items: unknown }).items) + Array.isArray(value.items) ); } @@ -198,7 +198,7 @@ function asString(value: unknown): string | undefined { return value; } if (value && typeof value === 'object' && 'value' in value) { - const inner = (value as { value: unknown }).value; + const inner = value.value; if (typeof inner === 'string') { return inner; } From c43128dd9a763468f7b262b5ae95cc993502cf23 Mon Sep 17 00:00:00 2001 From: Salah-Eddine Saakoun Date: Tue, 17 Nov 2026 13:42:34 +0100 Subject: [PATCH 3/6] chore: remove the unused csv-parse dependency --- package.json | 1 - yarn.lock | 8 -------- 2 files changed, 9 deletions(-) diff --git a/package.json b/package.json index ab309874..557e7833 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,6 @@ "@slack/webhook": "^7.0.6", "@types/luxon": "^3.3.0", "axios": "^0.24.0", - "csv-parse": "5.6.0", "execa": "^9.5.2", "googleapis": "144.0.0", "luxon": "^3.3.0", diff --git a/yarn.lock b/yarn.lock index 62cad97b..b177d8b0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -311,7 +311,6 @@ __metadata: "@vitest/coverage-v8": "npm:^5.1.0" "@yarnpkg/types": "npm:^4.0.0" axios: "npm:^0.24.0" - csv-parse: "npm:5.6.0" eslint-plugin-n: "npm:^18.5.0" execa: "npm:^9.5.2" googleapis: "npm:144.0.0" @@ -2364,13 +2363,6 @@ __metadata: languageName: node linkType: hard -"csv-parse@npm:5.6.0": - version: 5.6.0 - resolution: "csv-parse@npm:5.6.0" - checksum: 10/4c82e11f50ae0ccbac2aed716ef2502d0468bf96552083561db789fc0258ee4bb0a30106fcfb2684f153cb4042f0413e0eac3645d5466874803b7ccdeba67ac8 - languageName: node - linkType: hard - "debug@npm:4, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.3, debug@npm:^4.3.4, debug@npm:^4.3.5": version: 4.4.0 resolution: "debug@npm:4.4.0" From 96672adbae3c9735b49c223b1f6616851bcecada Mon Sep 17 00:00:00 2001 From: Salah-Eddine Saakoun Date: Tue, 17 Nov 2026 13:42:34 +0100 Subject: [PATCH 4/6] chore: reset the coverage thresholds after formatting the workflow scripts --- vitest.config.mts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vitest.config.mts b/vitest.config.mts index 33b3ca06..5a491484 100644 --- a/vitest.config.mts +++ b/vitest.config.mts @@ -49,10 +49,10 @@ export default defineConfig({ thresholds: { // Raises the thresholds in this file when coverage improves. autoUpdate: true, - branches: 41.72, - functions: 50.63, - lines: 41.61, - statements: 41.5, + branches: 41.75, + functions: 50.79, + lines: 41.34, + statements: 41.52, }, }, }, From 689f5c6de01c576489950e1b9bb8c830fc524b2d Mon Sep 17 00:00:00 2001 From: Salah-Eddine Saakoun Date: Tue, 17 Nov 2026 13:42:34 +0100 Subject: [PATCH 5/6] chore: fix the remaining oxlint violations in the workflow scripts and src --- .../lib/normalize-repo-file-path.mjs | 24 +- .../lib/slack-test-health-blocks.mjs | 6 +- .github/scripts/clean-release-changelog.mts | 8 +- .github/scripts/create-flaky-test-report.mjs | 12 +- .github/scripts/generate-rc-commits.mjs | 17 +- .../scripts/post-merge-validation-tracker.mjs | 169 ++++---- .../scripts/post-relay-subsidy-balance.mjs | 6 +- .../scripts/remove-rca-needed-label-sheets.ts | 115 ++++-- .github/scripts/slack-release-testing.mjs | 33 +- .github/scripts/update-release-changelog.mts | 13 +- .github/scripts/update-release-sheet.mjs | 24 +- oxlint-suppressions.json | 391 +----------------- src/cache-utils.ts | 1 + src/changelog-check.mts | 4 +- src/error-utils.ts | 2 +- src/fs-utils.ts | 2 +- src/get-review-metrics.ts | 7 +- src/github/octokit.ts | 1 + .../cli.ts | 2 +- src/segment-schema-draft-pr/apply-changes.ts | 2 +- src/segment-schema-draft-pr/diff-models.ts | 7 +- src/segment-schema-draft-pr/publish.test.ts | 3 +- 22 files changed, 269 insertions(+), 580 deletions(-) diff --git a/.github/actions/playwright-test-health-report/lib/normalize-repo-file-path.mjs b/.github/actions/playwright-test-health-report/lib/normalize-repo-file-path.mjs index b4518a6d..e06e8550 100644 --- a/.github/actions/playwright-test-health-report/lib/normalize-repo-file-path.mjs +++ b/.github/actions/playwright-test-health-report/lib/normalize-repo-file-path.mjs @@ -6,39 +6,41 @@ * - Optional testDir prefix (e.g. accounts/foo.spec.ts → tests/smoke-appium/accounts/foo.spec.ts) * - Idempotent when the path already starts with the prefix or `tests/` * - * @param {string} filePath - * @param {{ prefix?: string }} [options] - * @returns {string} + * @param {string} filePath The test file path to normalize. + * @param {{ prefix?: string }} [options] Optional settings. + * @returns {string} The normalized repo relative path. */ export function normalizeRepoFilePath(filePath, { prefix } = {}) { if (!filePath) { return filePath; } - let normalized = String(filePath).replace(/\\/g, '/'); + let normalized = String(filePath).replace(/\\/gu, '/'); const isAbsolute = - normalized.startsWith('/') || /^[A-Za-z]:\//.test(normalized); + normalized.startsWith('/') || /^[A-Za-z]:\//u.test(normalized); if (isAbsolute) { - const testsMatch = normalized.match(/(?:^|\/)(tests\/.+)$/); + const testsMatch = normalized.match(/(?:^|\/)(tests\/.+)$/u); if (testsMatch) { normalized = testsMatch[1]; } else { - const runnerMatch = normalized.match(/\/work\/[^/]+\/[^/]+\/(.+)$/); + const runnerMatch = normalized.match(/\/work\/[^/]+\/[^/]+\/(.+)$/u); if (runnerMatch) { normalized = runnerMatch[1]; } else { - normalized = normalized.replace(/^\/+/, '').replace(/^[A-Za-z]:\//, ''); + normalized = normalized + .replace(/^\/+/u, '') + .replace(/^[A-Za-z]:\//u, ''); } } } - normalized = normalized.replace(/^\/+/, ''); + normalized = normalized.replace(/^\/+/u, ''); const cleanPrefix = prefix ?.trim() - .replace(/\\/g, '/') - .replace(/^\/+|\/+$/g, ''); + .replace(/\\/gu, '/') + .replace(/^\/+|\/+$/gu, ''); if (cleanPrefix) { const alreadyPrefixed = normalized === cleanPrefix || diff --git a/.github/actions/playwright-test-health-report/lib/slack-test-health-blocks.mjs b/.github/actions/playwright-test-health-report/lib/slack-test-health-blocks.mjs index 25807267..62ab12c9 100644 --- a/.github/actions/playwright-test-health-report/lib/slack-test-health-blocks.mjs +++ b/.github/actions/playwright-test-health-report/lib/slack-test-health-blocks.mjs @@ -14,15 +14,15 @@ export function normalizeErrorForSlack(message, maxLength = 120) { } const withoutEmojiShortcodes = String(message).replace( - /:[a-z0-9_+-]+:/gi, + /:[a-z0-9_+-]+:/giu, ' ', ); const firstMeaningfulLine = withoutEmojiShortcodes - .split(/\r?\n/) + .split(/\r?\n/u) .map((line) => line.trim()) .find(Boolean); const normalized = (firstMeaningfulLine || withoutEmojiShortcodes) - .replace(/\s+/g, ' ') + .replace(/\s+/gu, ' ') .trim(); if (!normalized) { diff --git a/.github/scripts/clean-release-changelog.mts b/.github/scripts/clean-release-changelog.mts index f06bb8b0..1d8e3828 100644 --- a/.github/scripts/clean-release-changelog.mts +++ b/.github/scripts/clean-release-changelog.mts @@ -153,7 +153,7 @@ export function splitReleaseSectionIntoChunks( const entries: CategorizedEntry[] = []; let category: string | undefined; let currentEntry: string[] = []; - const endEntry = () => { + const endEntry = (): void => { if (category && currentEntry.length > 0) { entries.push({ category, text: currentEntry.join('\n').trimEnd() }); } @@ -179,7 +179,7 @@ export function splitReleaseSectionIntoChunks( let chunkEntries = new Map(); let chunkEntryCount = 0; let chunkPrNumbers: string[] = []; - const addChunk = () => { + const addChunk = (): void => { if (chunkEntryCount === 0) { return; } @@ -291,7 +291,7 @@ function getCategorizedBlocks( const blocks = new Map(); let category: string | undefined; let categoryEntries: string[] = []; - const addCategory = () => { + const addCategory = (): void => { if (!category) { return; } @@ -382,7 +382,7 @@ export function validateReplacement( const categoryNames = new Set(); let category: string | undefined; let categoryEntryCount = 0; - const endCategory = () => { + const endCategory = (): void => { if (category && categoryEntryCount === 0) { throw new Error(`Category ${category} must not be empty`); } diff --git a/.github/scripts/create-flaky-test-report.mjs b/.github/scripts/create-flaky-test-report.mjs index d499cc66..a366bff5 100644 --- a/.github/scripts/create-flaky-test-report.mjs +++ b/.github/scripts/create-flaky-test-report.mjs @@ -11,7 +11,7 @@ if (!githubToken) { const env = { GITHUB_TOKEN: process.env.GITHUB_TOKEN, - LOOKBACK_DAYS: parseInt(process.env.LOOKBACK_DAYS ?? '1'), + LOOKBACK_DAYS: parseInt(process.env.LOOKBACK_DAYS ?? '1', 10), TEST_RESULTS_FILE_PATTERN: process.env.TEST_RESULTS_FILE_PATTERN || 'test-runs', OWNER: process.env.OWNER || 'MetaMask', @@ -450,7 +450,7 @@ function createSlackBlocks( // Each failure top10 .filter((test) => test.realFailures > 0) - .forEach((test, idx) => { + .forEach((test) => { const globalIndex = top10.indexOf(test) + 1; const failText = test.realFailures === 1 ? 'time' : 'times'; const retryText = test.totalRetries === 1 ? 'retry' : 'retries'; @@ -500,7 +500,7 @@ function createSlackBlocks( elements: [ { type: 'text', - text: ` ${errorPreview.replace(/\n/g, ' ')}`, + text: ` ${errorPreview.replace(/\n/gu, ' ')}`, style: { italic: true }, }, ], @@ -595,7 +595,7 @@ function createSlackBlocks( elements: [ { type: 'text', - text: ` ${errorPreview.replace(/\n/g, ' ')}`, + text: ` ${errorPreview.replace(/\n/gu, ' ')}`, style: { italic: true }, }, ], @@ -664,7 +664,7 @@ function displayResults(summary, dateDisplay) { test.lastRealFailureError.length > 100 ? `${test.lastRealFailureError.substring(0, 100)}...` : test.lastRealFailureError; - console.log(` šŸ’„ Error: ${errorPreview.replace(/\n/g, ' ')}`); + console.log(` šŸ’„ Error: ${errorPreview.replace(/\n/gu, ' ')}`); } } else { // Flaky tests (failed initially but eventually passed) @@ -687,7 +687,7 @@ function displayResults(summary, dateDisplay) { ? `${test.flakyFailureError.substring(0, 100)}...` : test.flakyFailureError; console.log( - ` šŸ’„ Initial error: ${errorPreview.replace(/\n/g, ' ')}`, + ` šŸ’„ Initial error: ${errorPreview.replace(/\n/gu, ' ')}`, ); } } diff --git a/.github/scripts/generate-rc-commits.mjs b/.github/scripts/generate-rc-commits.mjs index 99b73bcd..b2ec5124 100644 --- a/.github/scripts/generate-rc-commits.mjs +++ b/.github/scripts/generate-rc-commits.mjs @@ -26,10 +26,10 @@ async function getTeam(repository, prNumber) { const topologyJsonUrl = 'https://raw.githubusercontent.com/MetaMask/MetaMask-planning/refs/heads/main/topology.json'; - const githubToken = process.env.GITHUB_TOKEN; + const topologyToken = process.env.GITHUB_TOKEN; const response = await axios.get(topologyJsonUrl, { - headers: { Authorization: `token ${githubToken}` }, + headers: { Authorization: `token ${topologyToken}` }, }); // Check if the response is successful and contains data @@ -59,13 +59,11 @@ async function getTeam(repository, prNumber) { } // Return undefined if author not found in any team - return; } catch (error) { console.error( `Error fetching team for PR #${prNumber}:`, error.message || error, ); - return; } } @@ -163,7 +161,7 @@ function formatAsCSV(commitsByTeam) { stripDelimiter(commit.author, ','), commit.prLink, stripDelimiter(team, ','), - , + '', assignChangeType(commit.message), ]; csvContent.push(row.join(',')); @@ -177,17 +175,10 @@ function formatAsCSV(commitsByTeam) { // Helper function to strip delimiter from CSV fields so they can be properly imported automatically later function stripDelimiter(inputString, delimiter) { // Create a regex dynamically based on the provided delimiter - const regex = new RegExp(delimiter, 'g'); + const regex = new RegExp(delimiter, 'gu'); return inputString.replace(regex, ''); } -// Helper function to escape CSV fields -function escapeCSV(field) { - if (field.includes(',') || field.includes('"') || field.includes('\n')) { - return `"${field.replace(/"/g, '""')}"`; // Encapsulate in double quotes and escape existing quotes - } - return field; -} // Helper function to create change type function assignChangeType(field) { if (field.includes('feat')) { diff --git a/.github/scripts/post-merge-validation-tracker.mjs b/.github/scripts/post-merge-validation-tracker.mjs index 90a11acc..c1a04317 100644 --- a/.github/scripts/post-merge-validation-tracker.mjs +++ b/.github/scripts/post-merge-validation-tracker.mjs @@ -7,22 +7,22 @@ const spreadsheetId = process.env.SHEET_ID; // 1uSERA-Mczy0pjlrr1vv... // GOOGLE_APPLICATION_CREDENTIALS_BASE64 can be found in MM QA 1pasword vault const googleApplicationCredentialsBase64 = process.env.GOOGLE_APPLICATION_CREDENTIALS_BASE64; -const repo = process.env.REPO || 'MetaMask/metamask-extension'; -const LOOKBACK_DAYS = parseInt(process.env.LOOKBACK_DAYS ?? '1'); -const START_HOUR_UTC = parseInt(process.env.START_HOUR_UTC ?? '7'); +const targetRepo = process.env.REPO || 'MetaMask/metamask-extension'; +const LOOKBACK_DAYS = parseInt(process.env.LOOKBACK_DAYS ?? '1', 10); +const START_HOUR_UTC = parseInt(process.env.START_HOUR_UTC ?? '7', 10); const START_MINUTE_UTC = 0; const RELEVANT_TITLE_REGEX = - /^(feat|perf|fix|chore|refactor)\s*(\(|:|!|\/)|\bbump\b/i; + /^(feat|perf|fix|chore|refactor)\s*(\(|:|!|\/)|\bbump\b/iu; const TEAM_LABEL_PREFIX = 'team-'; const SIZE_LABEL_PREFIX = 'size-'; const AUTOMATED_TEST_PATTERNS = [ - /\.test\.(js|ts|tsx)$/, - /\.spec\.(js|ts|tsx)$/, - /\.(test|spec)\.(js|ts|tsx)\.snap$/, - /(^|\/)test\//, - /(^|\/)e2e\//, - /(^|\/)wdio\//, + /\.test\.(js|ts|tsx)$/u, + /\.spec\.(js|ts|tsx)$/u, + /\.(test|spec)\.(js|ts|tsx)\.snap$/u, + /(^|\/)test\//u, + /(^|\/)e2e\//u, + /(^|\/)wdio\//u, ]; const SKIP_RELEASE_VALIDATION_LABEL = 'skip-release-validation'; @@ -35,7 +35,7 @@ if (!spreadsheetId) { if (!googleApplicationCredentialsBase64) { throw new Error('Missing GOOGLE_APPLICATION_CREDENTIALS_BASE64 env var'); } -if (!repo) { +if (!targetRepo) { throw new Error('Missing REPO env var'); } @@ -54,10 +54,10 @@ async function getGoogleAuth() { } function parseRepo() { - const [owner, repoName] = repo.split('/'); + const [owner, repoName] = targetRepo.split('/'); if (!owner || !repoName) { throw new Error( - `Invalid repo format "${repo}". Expected format: "owner/repo"`, + `Invalid repo format "${targetRepo}". Expected format: "owner/repo"`, ); } return { owner, repo: repoName }; @@ -78,19 +78,19 @@ function tabTitleFor(repo, releaseLabel) { } function platformLabelFor(type) { - const t = String(type).toLowerCase(); - if (t === 'mobile') { + const typeLower = String(type).toLowerCase(); + if (typeLower === 'mobile') { return 'šŸ“± Mobile - Pull requests'; } - if (t === 'extension') { + if (typeLower === 'extension') { return 'šŸ”Œ Extension - Pull requests'; } - return t; + return typeLower; } function headerRowFor(type) { - const t = String(type).toLowerCase(); - const isMobile = t === 'mobile'; + const typeLower = String(type).toLowerCase(); + const isMobile = typeLower === 'mobile'; const colG = isMobile ? 'Validated (Android)' : 'Validated (Chrome)'; const colH = isMobile ? 'Validated (iOS)' : 'Validated (Firefox)'; return [ @@ -115,7 +115,7 @@ async function ensureSheetExists(authClient, title, platformType) { const sheetsList = meta.data.sheets || []; // First, try to find the exact title (with "pre-" prefix) - let existing = sheetsList.find((s) => s.properties?.title === title); + let existing = sheetsList.find((sheet) => sheet.properties?.title === title); if (existing) { return { sheetId: existing.properties.sheetId, @@ -126,9 +126,9 @@ async function ensureSheetExists(authClient, title, platformType) { // If not found and title starts with "pre-", try without the "pre-" prefix if (title.startsWith('pre-')) { - const titleWithoutPrefix = title.replace(/^pre-/, ''); + const titleWithoutPrefix = title.replace(/^pre-/u, ''); existing = sheetsList.find( - (s) => s.properties?.title === titleWithoutPrefix, + (sheet) => sheet.properties?.title === titleWithoutPrefix, ); if (existing) { console.log( @@ -159,11 +159,12 @@ async function createSheetFromTemplateOrBlank( ) { // Try to duplicate from a template tab (single template name: 'template') const templateCandidates = ['template']; - const template = sheetsList.find((s) => - templateCandidates.includes(s.properties?.title || ''), + const template = sheetsList.find((sheet) => + templateCandidates.includes(sheet.properties?.title || ''), ); - if (template?.properties?.sheetId != null) { + const templateSheetId = template?.properties?.sheetId; + if (templateSheetId !== null && templateSheetId !== undefined) { const duplicateRes = await sheets.spreadsheets.batchUpdate({ spreadsheetId, auth: authClient, @@ -272,7 +273,7 @@ async function readRows(authClient, title) { range: `${title}!A2:J`, }); return res.data.values || []; - } catch (e) { + } catch { // If the sheet or range doesn't exist yet return []; } @@ -300,37 +301,41 @@ function formatDateHumanUTC(iso) { if (!iso) { return ''; } - const d = new Date(iso); - const yyyy = d.getUTCFullYear(); - const mm = String(d.getUTCMonth() + 1).padStart(2, '0'); - const dd = String(d.getUTCDate()).padStart(2, '0'); - const hh = String(d.getUTCHours()).padStart(2, '0'); - const mi = String(d.getUTCMinutes()).padStart(2, '0'); + const date = new Date(iso); + const yyyy = date.getUTCFullYear(); + const mm = String(date.getUTCMonth() + 1).padStart(2, '0'); + const dd = String(date.getUTCDate()).padStart(2, '0'); + const hh = String(date.getUTCHours()).padStart(2, '0'); + const mi = String(date.getUTCMinutes()).padStart(2, '0'); return `${yyyy}-${mm}-${dd} ${hh}:${mi}`; } function makePrHyperlinkCell(url, title, number) { const label = `${title} (#${number})`; // Sheets formula - const escapedUrl = url.replace(/"/g, ''); - const escapedLabel = label.replace(/"/g, ''); + const escapedUrl = url.replace(/"/gu, ''); + const escapedLabel = label.replace(/"/gu, ''); return `=HYPERLINK("${escapedUrl}","${escapedLabel}")`; } function extractTeam(labels) { - const found = labels.find((l) => l.name?.startsWith(TEAM_LABEL_PREFIX)); + const found = labels.find((label) => + label.name?.startsWith(TEAM_LABEL_PREFIX), + ); return found ? found.name : 'unknown'; } function extractSize(labels) { - const found = labels.find((l) => l.name?.startsWith(SIZE_LABEL_PREFIX)); + const found = labels.find((label) => + label.name?.startsWith(SIZE_LABEL_PREFIX), + ); return found ? found.name : 'unknown'; } function isoSinceAtUTC(days, hour = 2, minute = 0) { // Returns an ISO timestamp at (today - days) with specific UTC hour:minute, e.g., 02:00Z const now = new Date(); - const d = new Date( + const targetDate = new Date( Date.UTC( now.getUTCFullYear(), now.getUTCMonth(), @@ -341,9 +346,9 @@ function isoSinceAtUTC(days, hour = 2, minute = 0) { 0, ), ); - d.setUTCDate(d.getUTCDate() - days); - d.setUTCHours(hour, minute, 0, 0); - return d.toISOString(); + targetDate.setUTCDate(targetDate.getUTCDate() - days); + targetDate.setUTCHours(hour, minute, 0, 0); + return targetDate.toISOString(); } async function fetchMergedPRsSince(owner, repo, sinceDateISO) { @@ -395,10 +400,10 @@ async function fetchMergedPRsSince(owner, repo, sinceDateISO) { if (data.items.length < 100) { break; } - page++; + page += 1; await sleep(200); - } catch (e) { - console.log(`āŒ Search API error: ${e.message}`); + } catch (error) { + console.log(`āŒ Search API error: ${error.message}`); break; } } @@ -417,19 +422,19 @@ function isRelevantTitle(title) { } function extractLabelText(formulaOrText) { - const s = String(formulaOrText || ''); + const text = String(formulaOrText || ''); // If it's a HYPERLINK formula like =HYPERLINK("url","Label") extract Label - const m = s.match(/HYPERLINK\([^,]+,\s*"([^"]+)"\)/i); - if (m) { - return m[1]; + const match = text.match(/HYPERLINK\([^,]+,\s*"([^"]+)"\)/iu); + if (match) { + return match[1]; } - return s; + return text; } function parsePrNumberFromCell(cell) { const text = extractLabelText(cell); - const m = String(text).match(/#(\d+)/); - return m ? Number(m[1]) : null; + const match = String(text).match(/#(\d+)/u); + return match ? Number(match[1]) : null; } async function sleep(ms) { @@ -456,7 +461,7 @@ function getAutoSkipLabelsForPR(labels, repoName) { const hasSkipAll = labelNames.includes(SKIP_RELEASE_VALIDATION_LABEL); const granularLabels = labelNames.filter((name) => - /^skip-release-validation\[(android|ios|design|chrome|firefox)\]$/i.test( + /^skip-release-validation\[(android|ios|design|chrome|firefox)\]$/iu.test( name, ), ); @@ -598,8 +603,8 @@ async function getCurrentPackageVersion(owner, repo) { const content = Buffer.from(data.content, 'base64').toString('utf8'); const packageJson = JSON.parse(content); return packageJson.version; - } catch (e) { - console.log(`āš ļø Failed to fetch package.json version: ${e.message}`); + } catch (error) { + console.log(`āš ļø Failed to fetch package.json version: ${error.message}`); return null; } } @@ -611,13 +616,13 @@ function parseVersionFromPatch(patch) { for (const line of lines) { if (line.startsWith('-') && line.includes('"version":')) { - const match = line.match(/"version":\s*"([^"]+)"/); + const match = line.match(/"version":\s*"([^"]+)"/u); if (match) { oldVersion = match[1]; } } if (line.startsWith('+') && line.includes('"version":')) { - const match = line.match(/"version":\s*"([^"]+)"/); + const match = line.match(/"version":\s*"([^"]+)"/u); if (match) { newVersion = match[1]; } @@ -638,7 +643,7 @@ function normalizeVersion(version) { } function determineReleaseVersionFromTimeline(mergedAt, versionTimeline) { - const { currentVersion, versionBumps, sinceDate } = versionTimeline; + const { currentVersion, versionBumps } = versionTimeline; const mergedDate = new Date(mergedAt); // If no version bumps in our lookback period, everything goes to current version @@ -766,7 +771,7 @@ async function findVersionBumpCommits(owner, repo, sinceDateISO) { }); const packageJsonFile = commitData.files?.find( - (f) => f.filename === 'package.json', + (file) => file.filename === 'package.json', ); if (packageJsonFile?.patch) { const versionChange = parseVersionFromPatch(packageJsonFile.patch); @@ -779,8 +784,10 @@ async function findVersionBumpCommits(owner, repo, sinceDateISO) { }; } } - } catch (e) { - console.log(`āš ļø Failed to analyze commit ${commit.sha}: ${e.message}`); + } catch (error) { + console.log( + `āš ļø Failed to analyze commit ${commit.sha}: ${error.message}`, + ); } return null; }); @@ -790,8 +797,8 @@ async function findVersionBumpCommits(owner, repo, sinceDateISO) { // Sort by date (newest first) return versionBumps.sort((a, b) => new Date(b.date) - new Date(a.date)); - } catch (e) { - console.log(`āš ļø Failed to find version bumps: ${e.message}`); + } catch (error) { + console.log(`āš ļø Failed to find version bumps: ${error.message}`); return []; } } @@ -818,13 +825,15 @@ async function fetchPRFiles(owner, repo, prNumber) { break; } - page++; + page += 1; await sleep(100); } return allFiles.map((file) => file.filename); - } catch (e) { - console.log(`āš ļø Failed to fetch files for PR #${prNumber}: ${e.message}`); + } catch (error) { + console.log( + `āš ļø Failed to fetch files for PR #${prNumber}: ${error.message}`, + ); return null; // Return null to indicate API failure } } @@ -873,7 +882,7 @@ async function removePrePrefixFromSheet(authClient, sheetTitle) { return false; } - const newTitle = sheetTitle.replace(/^pre-/, ''); + const newTitle = sheetTitle.replace(/^pre-/u, ''); // Get sheet metadata to find the sheetId const meta = await sheets.spreadsheets.get({ @@ -883,7 +892,7 @@ async function removePrePrefixFromSheet(authClient, sheetTitle) { }); const sheet = meta.data.sheets?.find( - (s) => s.properties?.title === sheetTitle, + (candidate) => candidate.properties?.title === sheetTitle, ); if (!sheet) { console.log(`āš ļø Sheet "${sheetTitle}" not found for renaming`); @@ -913,8 +922,8 @@ async function removePrePrefixFromSheet(authClient, sheetTitle) { console.log(`āœ… Renamed sheet: "${sheetTitle}" → "${newTitle}"`); return true; - } catch (e) { - console.log(`āš ļø Failed to rename "${sheetTitle}": ${e.message}`); + } catch (error) { + console.log(`āš ļø Failed to rename "${sheetTitle}": ${error.message}`); return false; } } @@ -931,20 +940,20 @@ async function processTab(authClient, title, entries, platformType) { ); const existingKeys = new Set( existing - .map((r) => parsePrNumberFromCell(r[0])) - .filter((n) => n !== null) - .map((n) => uniqKey(n)), + .map((row) => parsePrNumberFromCell(row[0])) + .filter((number) => number !== null) + .map((number) => uniqKey(number)), ); const sortedRows = entries .slice() .sort((a, b) => new Date(a.mergedAtIso) - new Date(b.mergedAtIso)) - .map((e) => applyAutoSkipToRow(e.row, e.labels, repo)); + .map((entry) => applyAutoSkipToRow(entry.row, entry.labels, targetRepo)); const deduped = []; - for (const r of sortedRows) { - const num = parsePrNumberFromCell(r[0]); - const key = num === null ? null : uniqKey(num); + for (const row of sortedRows) { + const prNumber = parsePrNumberFromCell(row[0]); + const key = prNumber === null ? null : uniqKey(prNumber); if (!key || !existingKeys.has(key)) { - deduped.push(r); + deduped.push(row); if (key) { existingKeys.add(key); } @@ -998,8 +1007,8 @@ async function processRepo(authClient, owner, repo, since) { // Sort tabs by extracting version numbers for proper ordering tabsArray.sort((a, b) => { - const versionA = a.title.match(/v[\d.]+/)?.[0] || ''; - const versionB = b.title.match(/v[\d.]+/)?.[0] || ''; + const versionA = a.title.match(/v[\d.]+/u)?.[0] || ''; + const versionB = b.title.match(/v[\d.]+/u)?.[0] || ''; return versionB.localeCompare(versionA, undefined, { numeric: true }); }); @@ -1043,7 +1052,7 @@ async function main() { await processRepo(authClient, owner, repoName, since); } -main().catch((e) => { - console.error(e); +main().catch((error) => { + console.error(error); process.exit(1); }); diff --git a/.github/scripts/post-relay-subsidy-balance.mjs b/.github/scripts/post-relay-subsidy-balance.mjs index a19a289e..623bbeeb 100644 --- a/.github/scripts/post-relay-subsidy-balance.mjs +++ b/.github/scripts/post-relay-subsidy-balance.mjs @@ -77,9 +77,9 @@ const validateRelayResponseShape = (data) => { const computeTotalUsd = (balances) => balances - .map((b) => parseAmountUsd(b?.amountUsd)) - .filter((v) => Number.isFinite(v)) - .reduce((sum, v) => sum + v, 0); + .map((balance) => parseAmountUsd(balance?.amountUsd)) + .filter((value) => Number.isFinite(value)) + .reduce((sum, value) => sum + value, 0); const formatAsOfDate = (date) => new Intl.DateTimeFormat('en-US', { diff --git a/.github/scripts/remove-rca-needed-label-sheets.ts b/.github/scripts/remove-rca-needed-label-sheets.ts index f52e87b1..cf2a9392 100644 --- a/.github/scripts/remove-rca-needed-label-sheets.ts +++ b/.github/scripts/remove-rca-needed-label-sheets.ts @@ -1,10 +1,72 @@ // Note: These packages are installed at runtime in the GitHub Actions workflow // @ts-expect-error - @actions/core is not in devDependencies -import * as core from '@actions/core'; +import * as rawCore from '@actions/core'; // @ts-expect-error - @actions/github is not in devDependencies -import { context, getOctokit } from '@actions/github'; +import { + context as rawContext, + getOctokit as rawGetOctokit, +} from '@actions/github'; // @ts-expect-error - googleapis types may not be available locally -import { google } from 'googleapis'; +import { google as rawGoogle } from 'googleapis'; + +// Minimal local types for the runtime-installed packages (their own types are +// not available locally), describing only what this script uses. +type CoreLike = { + setFailed: (message: string) => void; + warning: (message: string) => void; +}; + +type RepoContext = { + repo: { owner: string; repo: string }; +}; + +type OctokitLike = { + graphql: ( + query: string, + variables: Record, + ) => Promise; + rest: { + issues: { + removeLabel: (params: { + owner: string; + repo: string; + issue_number: number; + name: string; + }) => Promise; + }; + }; +}; + +type SheetsV4 = { + spreadsheets: { + values: { + get: (params: { spreadsheetId: string; range: string }) => Promise<{ + data: { values?: string[][] | null }; + }>; + }; + }; +}; + +type GoogleLike = { + auth: { + GoogleAuth: new (options: { + credentials: unknown; + scopes: string[]; + }) => unknown; + }; + sheets: (options: { version: string; auth: unknown }) => SheetsV4; +}; + +// Shape of the errors we read `message` / `status` from +type ErrorLike = { + message?: string; + status?: number; +}; + +const core = rawCore as CoreLike; +const context = rawContext as RepoContext; +const getOctokit = rawGetOctokit as (token: string) => OctokitLike; +const google = rawGoogle as GoogleLike; // HTTP status codes enum for better maintainability enum HttpStatusCode { @@ -23,10 +85,6 @@ const RCA_NEEDED_LABEL: Label = { description: 'Issue requires Root Cause Analysis', }; -// Type alias for Google Sheets v4 API -// @ts-expect-error - googleapis types may not be available locally -type SheetsV4 = ReturnType; - // Google Sheets configuration from environment variables // @ts-expect-error - process is available at runtime in GitHub Actions const { SPREADSHEET_ID } = process.env; @@ -43,7 +101,7 @@ const { SHEET_NAME } = process.env; type RcaFormResponse = { issueNumber: string; timestamp: string; - [key: string]: any; + [key: string]: unknown; }; // GitHub GraphQL types @@ -158,7 +216,7 @@ async function main(): Promise { console.log( `šŸ” [DRY RUN] Would remove label from issue #${issue.number}`, ); - removedCount++; + removedCount += 1; } else { // Remove the RCA-needed label await removeLabelFromIssue( @@ -172,19 +230,19 @@ async function main(): Promise { console.log( `āœ… Successfully removed RCA-needed label from issue #${issue.number}`, ); - removedCount++; + removedCount += 1; } } else { console.log( `ā³ No RCA found in sheet for issue #${issue.number} - skipping`, ); - skippedCount++; + skippedCount += 1; } - } catch (error: any) { + } catch (error: unknown) { console.error( - `āŒ Failed to process issue #${issue.number}: ${error?.message || String(error)}`, + `āŒ Failed to process issue #${issue.number}: ${(error as ErrorLike | undefined)?.message || String(error)}`, ); - failedCount++; + failedCount += 1; failedIssues.push(issue.number); // Continue processing other issues } @@ -207,7 +265,6 @@ async function main(): Promise { // Set appropriate exit status if (failedCount > 0 && removedCount === 0) { core.setFailed('All label removal attempts failed'); - return; } else if (failedCount > 0) { console.log( `\nāš ļø Completed with ${failedCount} failures. Check logs for details.`, @@ -215,16 +272,16 @@ async function main(): Promise { } else { console.log(`\nāœ… All operations completed successfully!`); } - } catch (error: any) { + } catch (error: unknown) { core.setFailed( - `Error in Google Sheets RCA label removal: ${error?.message || String(error)}`, + `Error in Google Sheets RCA label removal: ${(error as ErrorLike | undefined)?.message || String(error)}`, ); } } async function initializeGoogleSheets(credentials: string): Promise { // Decode base64 credentials - const credentialsJson = JSON.parse( + const credentialsJson: unknown = JSON.parse( // @ts-expect-error - Buffer is available at runtime in GitHub Actions Buffer.from(credentials, 'base64').toString('utf-8'), ); @@ -279,7 +336,7 @@ async function fetchRcaResponses(sheets: SheetsV4): Promise { // Get issue number from dynamically determined column const issueNumberValue = row[issueNumberColumnIndex]; - if (issueNumberValue != null) { + if (issueNumberValue !== null && issueNumberValue !== undefined) { // Extract just the numeric part from the issue number // Handles formats like: "18454", "#18454", or leading/trailing whitespace const trimmedValue = issueNumberValue.toString().trim(); @@ -287,7 +344,7 @@ async function fetchRcaResponses(sheets: SheetsV4): Promise { continue; // Skip if empty string after trimming } - const issueMatch = trimmedValue.match(/^#?(\d+)$/); + const issueMatch = trimmedValue.match(/^#?(\d+)$/u); if (issueMatch) { const issueNumber = issueMatch[1]; responses.push({ @@ -305,17 +362,17 @@ async function fetchRcaResponses(sheets: SheetsV4): Promise { } return responses; - } catch (error: any) { + } catch (error: unknown) { console.error( 'Error fetching Google Sheets data:', - error?.message || String(error), + (error as ErrorLike | undefined)?.message || String(error), ); throw error; } } async function getIssuesWithRcaLabel( - octokit: ReturnType, + octokit: OctokitLike, owner: string, repo: string, ): Promise { @@ -382,7 +439,7 @@ async function getIssuesWithRcaLabel( } async function removeLabelFromIssue( - octokit: ReturnType, + octokit: OctokitLike, owner: string, repo: string, issueNumber: number, @@ -396,18 +453,20 @@ async function removeLabelFromIssue( issue_number: issueNumber, name: labelName, }); - } catch (error: any) { + } catch (error: unknown) { // If label doesn't exist on issue, the API will throw 404 // This is not an error for our use case, so we can safely ignore it - if (error?.status !== HttpStatusCode.NotFound) { + if ((error as ErrorLike | undefined)?.status !== HttpStatusCode.NotFound) { throw error; } } } // Run the main function -main().catch((error: any): void => { +main().catch((error: unknown): void => { console.error('Unhandled error:', error); - core.setFailed(`Unhandled error: ${error?.message || String(error)}`); + core.setFailed( + `Unhandled error: ${(error as ErrorLike | undefined)?.message || String(error)}`, + ); // core.setFailed() sets the action's exit code to 1, causing the workflow to fail }); diff --git a/.github/scripts/slack-release-testing.mjs b/.github/scripts/slack-release-testing.mjs index 31cb23b6..30ab7d91 100644 --- a/.github/scripts/slack-release-testing.mjs +++ b/.github/scripts/slack-release-testing.mjs @@ -86,19 +86,19 @@ function parseReleaseUpdates(data) { const result = []; const regex = - /(.*?):\s+\*(.*?)\*\s+-\s+@(.*?)\s+There (?:is|are) (\d+) .*? changes\. \*Pending validation:\* (\d+)\. \*Status:\* (.*)/; + /(.*?):\s+\*(.*?)\*\s+-\s+@(.*?)\s+There (?:is|are) (\d+) .*? changes\. \*Pending validation:\* (\d+)\. \*Status:\* (.*)/u; lines.forEach((line) => { const match = line.match(regex); if (match) { - const [_, emoji, team, slackHandle, changes, pendingValidations, status] = + const [, emoji, team, slackHandle, changes, pendingValidations, status] = match; result.push({ emoji: emoji.trim(), team: team.trim(), slackHandle: slackHandle.trim(), - changes: parseInt(changes), - pendingValidations: parseInt(pendingValidations), + changes: parseInt(changes, 10), + pendingValidations: parseInt(pendingValidations, 10), status: status.trim(), }); } @@ -173,8 +173,8 @@ async function getActiveReleases(documentId) { .filter((sheet) => !sheet.properties.hidden) .map(async (sheet) => { const { title } = sheet.properties; - const versionMatch = title.match(/v(\d+\.\d+\.\d+)/); - const platformMatch = title.match(/\(([^)]+)\)/); + const versionMatch = title.match(/v(\d+\.\d+\.\d+)/u); + const platformMatch = title.match(/\(([^)]+)\)/u); if (!versionMatch) { console.log(`Skipping sheet: ${title} - Semantic version not found.`); @@ -202,9 +202,9 @@ async function getActiveReleases(documentId) { // Filter out null values (sheets that were skipped) and resolve all promises const results = await Promise.all(promises); return results.filter((result) => result !== null); - } catch (err) { - console.error('Failed to retrieve spreadsheet data:', err); - throw err; + } catch (error) { + console.error('Failed to retrieve spreadsheet data:', error); + throw error; } } @@ -227,9 +227,9 @@ async function readSheetData(spreadsheetId, sheetName, cellRange) { }); return result.data.values; - } catch (err) { - console.error('Failed to read data from the sheet:', err); - throw err; + } catch (error) { + console.error('Failed to read data from the sheet:', error); + throw error; } } @@ -279,11 +279,12 @@ async function getReleaseBlockers(release, team) { /** * Determine the Slack channel name to publish to based on the release - * @param {*} release + * @param {*} release The release entry to publish. + * @returns {Promise} The Slack channel name to publish to. */ async function getPublishChannelName(release) { // convert the version to a format that can be used in a channel name - const formattedVersion = release.SemanticVersion.replace(/\./g, '-'); + const formattedVersion = release.SemanticVersion.replace(/\./gu, '-'); const channel = `#release-${release.Platform}-${formattedVersion}`; @@ -456,7 +457,3 @@ function formatTitle(val) { function testOnly() { return process.env.TEST_ONLY === 'true'; } - -function createSheetUrl(documentId, sheetId) { - return `https://docs.google.com/spreadsheets/d/${documentId}/edit#gid=${sheetId}`; -} diff --git a/.github/scripts/update-release-changelog.mts b/.github/scripts/update-release-changelog.mts index b5ad0d5e..148c852d 100644 --- a/.github/scripts/update-release-changelog.mts +++ b/.github/scripts/update-release-changelog.mts @@ -28,6 +28,7 @@ import { restoreGeneratedCategories, splitLines, } from './release-section.mts'; +import type { ReleaseBranch } from './release-version-utils.mts'; import { compareSemver, parseReleaseBranch } from './release-version-utils.mts'; import { getEnvironmentWithoutAiKey } from './shared/environment.mts'; import { writeReport } from './shared/report.mts'; @@ -373,7 +374,7 @@ function getStableVersions(): string[] { * * @returns The parsed release branches. */ -function getReleaseBranches() { +function getReleaseBranches(): ReleaseBranch[] { // strip=3 drops `refs/remotes/origin/`, leaving `release/X.Y.Z`. return capture('git', [ 'for-each-ref', @@ -2066,12 +2067,12 @@ function main(): void { ); } - const readChangelog = () => readFileSync('CHANGELOG.md', 'utf8'); - const writeChangelog = (content: string) => + const readChangelog = (): string => readFileSync('CHANGELOG.md', 'utf8'); + const writeChangelog = (content: string): void => writeFileSync('CHANGELOG.md', content); - const readCurrentReleaseSection = () => + const readCurrentReleaseSection = (): string => extractReleaseSection(readChangelog(), version).section; - const writeCurrentReleaseSection = (section: string) => + const writeCurrentReleaseSection = (section: string): void => writeChangelog(replaceReleaseSection(readChangelog(), version, section)); const authorEmail = @@ -2344,7 +2345,7 @@ function main(): void { } runChangelogValidation(proofreading, version); - const assertSourcesUnchanged = () => { + const assertSourcesUnchanged = (): void => { try { assertRemoteRefUnchanged({ ref: `origin/${releaseBranch}`, diff --git a/.github/scripts/update-release-sheet.mjs b/.github/scripts/update-release-sheet.mjs index fbb720eb..951450c1 100644 --- a/.github/scripts/update-release-sheet.mjs +++ b/.github/scripts/update-release-sheet.mjs @@ -1,4 +1,3 @@ -import { parse } from 'csv-parse/sync'; import fs from 'fs'; import { google } from 'googleapis'; @@ -43,6 +42,7 @@ async function getGoogleAuth() { * @param {string} platform - The platform for which the release is being prepared. * @param {string} semanticVersion - The semantic version of the release. * @param {number} templateSheetId - The sheet ID of the template to be duplicated. + * @param {Array>} sheetData - The rows of data to write into the new sheet. * @returns {Promise} A promise that resolves when the sheet has been created and modified. */ async function createReleaseSheet( @@ -82,7 +82,7 @@ async function createReleaseSheet( console.log(`Sheet duplicated successfully. New sheet ID: ${newSheetId}`); // Step 2. Make the new sheet the active sheet - const sheetActivationResponse = await sheets.spreadsheets.batchUpdate({ + await sheets.spreadsheets.batchUpdate({ spreadsheetId: documentId, resource: { requests: [ @@ -158,9 +158,9 @@ async function getTotalSheetCount(documentId) { } return sheetsData.length; - } catch (err) { - console.error('Failed to retrieve spreadsheet data:', err); - throw err; + } catch (error) { + console.error('Failed to retrieve spreadsheet data:', error); + throw error; } } @@ -197,8 +197,8 @@ async function getAllReleases(documentId) { // Create a list of promises for each sheet using map const promises = sheetsData.map(async (sheet) => { const { title } = sheet.properties; - const versionMatch = title.match(/v(\d+\.\d+\.\d+)/); - const platformMatch = title.match(/\(([^)]+)\)/); + const versionMatch = title.match(/v(\d+\.\d+\.\d+)/u); + const platformMatch = title.match(/\(([^)]+)\)/u); if (!versionMatch) { console.log( @@ -219,9 +219,9 @@ async function getAllReleases(documentId) { // Filter out null values (sheets that were skipped) and resolve all promises const results = await Promise.all(promises); return results.filter((result) => result !== null); - } catch (err) { - console.error('Failed to retrieve spreadsheet data:', err); - throw err; + } catch (error) { + console.error('Failed to retrieve spreadsheet data:', error); + throw error; } } @@ -341,8 +341,8 @@ function parseCSVv2(filePath) { // Regex patterns to exclude certain commit messages // Regex patterns to exclude certain commit messages const excludedCommitRegex = [ - /cherry-pick/, // Matches any occurrence of "cherry-pick" - /cp-\d+\.\d+\.\d+/, // Matches patterns like "cp-1.0.0" + /cherry-pick/u, // Matches any occurrence of "cherry-pick" + /cp-\d+\.\d+\.\d+/u, // Matches patterns like "cp-1.0.0" ]; try { diff --git a/oxlint-suppressions.json b/oxlint-suppressions.json index 61224d9f..9fd1daf1 100644 --- a/oxlint-suppressions.json +++ b/oxlint-suppressions.json @@ -1,419 +1,53 @@ { ".github/actions/playwright-test-health-report/create-playwright-test-health-report.mjs": { - "n/hashbang": { - "count": 1 - }, - "node/no-process-env": { - "count": 12 - } - }, - ".github/actions/playwright-test-health-report/lib/classify-report-buckets.mjs": { - "prefer-const": { - "count": 4 - } - }, - ".github/actions/playwright-test-health-report/lib/normalize-repo-file-path.mjs": { - "jsdoc/require-param-description": { + "unicorn/no-process-exit": { "count": 2 - }, - "jsdoc/require-returns-description": { - "count": 1 - }, - "require-unicode-regexp": { - "count": 9 - } - }, - ".github/actions/playwright-test-health-report/lib/slack-test-health-blocks.mjs": { - "no-useless-escape": { - "count": 1 - }, - "require-unicode-regexp": { - "count": 3 - } - }, - ".github/scripts/clean-release-changelog.mts": { - "node/no-process-env": { - "count": 3 - }, - "node/no-sync": { - "count": 4 - }, - "typescript/explicit-function-return-type": { - "count": 4 - }, - "typescript/return-await": { - "count": 3 } }, ".github/scripts/create-flaky-test-report.mjs": { - "curly": { - "count": 1 - }, - "n/hashbang": { - "count": 1 - }, - "no-unused-vars": { - "count": 1 - }, - "node/no-process-env": { - "count": 11 - }, - "object-shorthand": { - "count": 4 - }, - "prefer-template": { - "count": 5 - }, - "radix": { - "count": 1 - }, - "require-unicode-regexp": { - "count": 4 + "unicorn/no-process-exit": { + "count": 2 } }, ".github/scripts/generate-rc-commits.mjs": { - "curly": { - "count": 4 - }, "import/no-named-as-default": { "count": 1 }, - "no-shadow": { - "count": 1 - }, - "no-sparse-arrays": { - "count": 1 - }, - "no-unused-vars": { - "count": 1 - }, - "no-var": { - "count": 1 - }, - "node/no-process-env": { - "count": 2 - }, - "node/no-sync": { - "count": 1 - }, - "require-unicode-regexp": { - "count": 2 - }, "unicorn/no-process-exit": { "count": 2 - }, - "unicorn/no-useless-undefined": { - "count": 3 - } - }, - ".github/scripts/merge-previous-release-changelog.mts": { - "node/no-sync": { - "count": 3 } }, ".github/scripts/post-merge-validation-tracker.mjs": { - "curly": { - "count": 23 - }, - "id-denylist": { - "count": 2 - }, - "id-length": { - "count": 27 - }, - "no-eq-null": { - "count": 1 - }, - "no-negated-condition": { - "count": 1 - }, - "no-plusplus": { - "count": 2 - }, - "no-shadow": { - "count": 10 - }, - "no-unused-vars": { - "count": 2 - }, - "node/no-process-env": { - "count": 6 - }, - "object-shorthand": { - "count": 2 - }, - "prefer-const": { - "count": 2 - }, - "prefer-destructuring": { - "count": 1 - }, - "radix": { - "count": 2 - }, - "require-unicode-regexp": { - "count": 18 - }, "unicorn/no-process-exit": { "count": 1 } }, ".github/scripts/post-relay-subsidy-balance.mjs": { - "id-length": { - "count": 2 - }, "import/unambiguous": { "count": 1 - }, - "node/no-process-env": { - "count": 3 } }, ".github/scripts/remove-rca-needed-label-sheets.ts": { - "no-eq-null": { - "count": 1 - }, - "no-negated-condition": { - "count": 1 - }, - "no-plusplus": { - "count": 4 - }, - "no-useless-return": { - "count": 1 - }, - "node/no-process-env": { - "count": 5 - }, - "object-shorthand": { - "count": 1 - }, - "prefer-destructuring": { - "count": 3 - }, - "require-unicode-regexp": { - "count": 1 - }, - "typescript/ban-ts-comment": { - "count": 10 - }, - "typescript/consistent-type-definitions": { - "count": 5 - }, - "typescript/no-explicit-any": { - "count": 6 - }, - "typescript/no-unsafe-argument": { - "count": 4 - }, - "typescript/no-unsafe-assignment": { - "count": 12 - }, - "typescript/no-unsafe-call": { - "count": 14 - }, - "typescript/no-unsafe-member-access": { - "count": 21 - }, "typescript/prefer-nullish-coalescing": { - "count": 6 - }, - "typescript/prefer-optional-chain": { - "count": 1 - } - }, - ".github/scripts/shared/environment.mts": { - "node/no-process-env": { - "count": 1 - } - }, - ".github/scripts/shared/report.mts": { - "node/no-sync": { - "count": 2 - } - }, - ".github/scripts/slack-release-testing.mjs": { - "id-denylist": { - "count": 4 - }, - "jsdoc/require-param-description": { - "count": 1 - }, - "jsdoc/require-returns": { - "count": 1 - }, - "no-else-return": { - "count": 2 - }, - "no-unused-vars": { - "count": 2 - }, - "no-var": { - "count": 2 - }, - "node/no-process-env": { - "count": 6 - }, - "object-shorthand": { - "count": 3 - }, - "prefer-const": { - "count": 2 - }, - "radix": { - "count": 2 - }, - "require-unicode-regexp": { - "count": 4 + "count": 5 } }, ".github/scripts/stable-sync.js": { "import/unambiguous": { "count": 1 }, - "n/hashbang": { - "count": 1 - }, - "node/no-process-env": { - "count": 3 - } - }, - ".github/scripts/update-release-changelog-baseline.mts": { - "import/consistent-type-specifier-style": { - "count": 1 - } - }, - ".github/scripts/update-release-changelog.mts": { - "import/consistent-type-specifier-style": { - "count": 1 - }, - "node/no-process-env": { - "count": 12 - }, - "node/no-sync": { - "count": 17 - }, - "typescript/explicit-function-return-type": { - "count": 6 + "unicorn/no-process-exit": { + "count": 5 } }, ".github/scripts/update-release-sheet.mjs": { - "curly": { - "count": 1 - }, - "id-denylist": { - "count": 4 - }, - "jsdoc/require-param": { - "count": 1 - }, - "no-unused-vars": { - "count": 2 - }, - "no-var": { - "count": 1 - }, - "node/no-process-env": { - "count": 1 - }, - "node/no-sync": { - "count": 1 - }, - "object-shorthand": { - "count": 1 - }, - "require-unicode-regexp": { - "count": 4 - }, "unicorn/no-process-exit": { "count": 1 } }, - "src/cache-utils.ts": { - "jsdoc/require-returns": { - "count": 1 - } - }, - "src/changelog-check.mts": { - "typescript/explicit-function-return-type": { - "count": 1 - }, - "typescript/no-unsafe-argument": { - "count": 1 - }, - "typescript/no-unsafe-member-access": { - "count": 1 - } - }, - "src/error-utils.ts": { - "typescript/explicit-function-return-type": { - "count": 1 - } - }, - "src/fs-utils.ts": { - "typescript/no-unsafe-return": { - "count": 1 - } - }, "src/get-review-metrics.ts": { - "jsdoc/require-returns": { - "count": 1 - }, - "typescript/explicit-function-return-type": { - "count": 1 - }, "typescript/no-unnecessary-type-assertion": { "count": 1 - }, - "typescript/no-unsafe-argument": { - "count": 1 - }, - "typescript/no-unsafe-assignment": { - "count": 1 - }, - "typescript/no-unsafe-member-access": { - "count": 1 - } - }, - "src/github/octokit.ts": { - "jsdoc/require-returns": { - "count": 1 - } - }, - "src/scripts/count-references-to-contributor-docs/cli.ts": { - "typescript/explicit-function-return-type": { - "count": 1 - } - }, - "src/segment-schema-draft-pr/analytics-model.ts": { - "unicorn/no-useless-undefined": { - "count": 1 - } - }, - "src/segment-schema-draft-pr/apply-changes.ts": { - "import/consistent-type-specifier-style": { - "count": 1 - }, - "typescript/explicit-function-return-type": { - "count": 1 - }, - "typescript/no-unnecessary-type-assertion": { - "count": 2 - } - }, - "src/segment-schema-draft-pr/cli.ts": { - "import/consistent-type-specifier-style": { - "count": 1 - } - }, - "src/segment-schema-draft-pr/diff-models.ts": { - "typescript/no-unsafe-assignment": { - "count": 6 - } - }, - "src/segment-schema-draft-pr/generate.test.ts": { - "typescript/return-await": { - "count": 2 } }, "src/segment-schema-draft-pr/github-output.ts": { @@ -421,19 +55,6 @@ "count": 1 } }, - "src/segment-schema-draft-pr/publish.test.ts": { - "import/consistent-type-specifier-style": { - "count": 1 - }, - "typescript/no-unsafe-member-access": { - "count": 1 - } - }, - "src/segment-schema-draft-pr/schema-index.ts": { - "typescript/no-unnecessary-type-assertion": { - "count": 2 - } - }, "yarn.config.cjs": { "import/unambiguous": { "count": 1 diff --git a/src/cache-utils.ts b/src/cache-utils.ts index 5e0e47d4..bfa4bca1 100644 --- a/src/cache-utils.ts +++ b/src/cache-utils.ts @@ -28,6 +28,7 @@ const DEFAULT_MAX_AGE = 60 * 60 * 1000; // 1 hour * considered "fresh". Affects subsequent calls: if `fetchOrPopulateFileCache` * is called again with the same file path within the duration specified here, * `getDataToCache` will not get called again, otherwise it will. + * @returns The cached data if it is fresh, otherwise the newly generated data. */ export async function fetchOrPopulateFileCache({ filePath, diff --git a/src/changelog-check.mts b/src/changelog-check.mts index cfd0ae06..1083b899 100644 --- a/src/changelog-check.mts +++ b/src/changelog-check.mts @@ -529,7 +529,7 @@ async function getChangedPackages( /** * Main function to run the changelog check. */ -async function main() { +async function main(): Promise { // Parse command-line arguments const args = process.argv.slice(2); @@ -623,7 +623,7 @@ async function main() { } } -main().catch((error) => { +main().catch((error: { message: string }) => { logError(error.message); // eslint-disable-next-line n/no-process-exit process.exit(1); diff --git a/src/error-utils.ts b/src/error-utils.ts index 8ff21a9b..af5348ee 100644 --- a/src/error-utils.ts +++ b/src/error-utils.ts @@ -41,7 +41,7 @@ export function isErrorWithCode(error: unknown): error is { code: string } { * something throwable). * @returns A new error object. */ -export function wrapError(message: string, originalError: unknown) { +export function wrapError(message: string, originalError: unknown): Error { if (isError(originalError)) { const error: Error & { code?: string } = new Error(message, { cause: originalError, diff --git a/src/fs-utils.ts b/src/fs-utils.ts index 9246327c..ce30e826 100644 --- a/src/fs-utils.ts +++ b/src/fs-utils.ts @@ -54,7 +54,7 @@ export async function readJsonFile( ): Promise { try { const content = await readFile(filePath); - return JSON.parse(content); + return JSON.parse(content) as Value; } catch (error) { throw wrapError(`Could not read JSON file '${filePath}'`, error); } diff --git a/src/get-review-metrics.ts b/src/get-review-metrics.ts index a9e9fa94..12ae91c3 100644 --- a/src/get-review-metrics.ts +++ b/src/get-review-metrics.ts @@ -33,8 +33,9 @@ const pullRequests: { * Get all review comments for the repository specified. * * @param page - The page number of results to fetch. + * @returns Whether the last page of results has been reached. */ -async function getAllComments(page = 1) { +async function getAllComments(page = 1): Promise { const { data } = await octokit.rest.pulls.listReviewCommentsForRepo({ owner: 'MetaMask', repo: 'metamask-extension', @@ -75,7 +76,9 @@ async function execute(): Promise { }); const pulls = Object.keys(pullRequests); for (const pull of pulls) { - const { data } = await octokit.request(pull); + const { data } = (await octokit.request(pull)) as { + data: { user: { login: string } }; + }; if (TEAM.includes(data.user.login) && pullRequests[pull]) { (pullRequests[pull] as PullRequestData).isInternal = true; } diff --git a/src/github/octokit.ts b/src/github/octokit.ts index 4748454d..6fab9110 100644 --- a/src/github/octokit.ts +++ b/src/github/octokit.ts @@ -9,6 +9,7 @@ import { getRequiredEnvironmentVariable } from '../env-utils'; * * @param args - The same arguments that * [`graphql`](https://github.com/octokit/graphql.js) takes. + * @returns The response data of the GraphQL request. */ export async function graphql( ...args: Parameters diff --git a/src/scripts/count-references-to-contributor-docs/cli.ts b/src/scripts/count-references-to-contributor-docs/cli.ts index 4cd56452..f02d224d 100644 --- a/src/scripts/count-references-to-contributor-docs/cli.ts +++ b/src/scripts/count-references-to-contributor-docs/cli.ts @@ -30,7 +30,7 @@ main().catch(console.error); * This script counts the number of references to the `contributor-docs` repo * across a selection of MetaMask repositories. */ -async function main() { +async function main(): Promise { const spinner = ora(); console.log( diff --git a/src/segment-schema-draft-pr/apply-changes.ts b/src/segment-schema-draft-pr/apply-changes.ts index 9acff13a..60978c8b 100644 --- a/src/segment-schema-draft-pr/apply-changes.ts +++ b/src/segment-schema-draft-pr/apply-changes.ts @@ -127,7 +127,7 @@ function newEventNames( const names: string[] = []; const seen = new Set(); - const consider = (eventName: string) => { + const consider = (eventName: string): void => { if (seen.has(eventName) || index.eventsByName.has(eventName)) { return; } diff --git a/src/segment-schema-draft-pr/diff-models.ts b/src/segment-schema-draft-pr/diff-models.ts index 1e164728..88a701a0 100644 --- a/src/segment-schema-draft-pr/diff-models.ts +++ b/src/segment-schema-draft-pr/diff-models.ts @@ -3,6 +3,7 @@ import type { AnalyticsModel, EventChange, PropertyChange, + PropertyType, RemovedProperty, RenameChange, UnresolvedProperty, @@ -54,8 +55,10 @@ export function diffModels( continue; } - const baseProps = base.events.get(eventName)?.properties ?? new Map(); - const headProps = head.events.get(eventName)?.properties ?? new Map(); + const baseProps = + base.events.get(eventName)?.properties ?? new Map(); + const headProps = + head.events.get(eventName)?.properties ?? new Map(); for (const [key, type] of headProps) { const previous = baseProps.get(key); diff --git a/src/segment-schema-draft-pr/publish.test.ts b/src/segment-schema-draft-pr/publish.test.ts index 03f82c03..fe2ee6eb 100644 --- a/src/segment-schema-draft-pr/publish.test.ts +++ b/src/segment-schema-draft-pr/publish.test.ts @@ -154,7 +154,8 @@ describe('publishGenerateResult', () => { body: expect.stringContaining(PROPOSAL_MARKER), }), ); - expect(updateComment.mock.calls[0]?.[0].body).toContain( + const [updateArgs] = updateComment.mock.calls[0] as [{ body: string }]; + expect(updateArgs.body).toContain( 'https://github.com/Consensys/segment-schema/pull/9', ); expect(createComment).not.toHaveBeenCalled(); From 8fac5f2860f034d606b33c26186bb8303196f04d Mon Sep 17 00:00:00 2001 From: Salah-Eddine Saakoun Date: Tue, 17 Nov 2026 13:56:18 +0100 Subject: [PATCH 6/6] chore: match the jsdoc param style in the added descriptions --- .../lib/normalize-repo-file-path.mjs | 4 ++-- .github/scripts/slack-release-testing.mjs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/playwright-test-health-report/lib/normalize-repo-file-path.mjs b/.github/actions/playwright-test-health-report/lib/normalize-repo-file-path.mjs index e06e8550..f927fc67 100644 --- a/.github/actions/playwright-test-health-report/lib/normalize-repo-file-path.mjs +++ b/.github/actions/playwright-test-health-report/lib/normalize-repo-file-path.mjs @@ -6,8 +6,8 @@ * - Optional testDir prefix (e.g. accounts/foo.spec.ts → tests/smoke-appium/accounts/foo.spec.ts) * - Idempotent when the path already starts with the prefix or `tests/` * - * @param {string} filePath The test file path to normalize. - * @param {{ prefix?: string }} [options] Optional settings. + * @param {string} filePath - The test file path to normalize. + * @param {{ prefix?: string }} [options] - The options, where `prefix` is the test directory prepended to relative paths. * @returns {string} The normalized repo relative path. */ export function normalizeRepoFilePath(filePath, { prefix } = {}) { diff --git a/.github/scripts/slack-release-testing.mjs b/.github/scripts/slack-release-testing.mjs index 30ab7d91..95c7f564 100644 --- a/.github/scripts/slack-release-testing.mjs +++ b/.github/scripts/slack-release-testing.mjs @@ -279,7 +279,7 @@ async function getReleaseBlockers(release, team) { /** * Determine the Slack channel name to publish to based on the release - * @param {*} release The release entry to publish. + * @param {*} release - The release entry to publish. * @returns {Promise} The Slack channel name to publish to. */ async function getPublishChannelName(release) {