1
0
mirror of synced 2025-12-19 18:10:59 -05:00

Remove remaining .js in package.json scripts (#57114)

This commit is contained in:
Kevin Heis
2025-08-18 15:48:33 -07:00
committed by GitHub
parent bb58717a48
commit ad5157764d
9 changed files with 42 additions and 35 deletions

View File

@@ -27,7 +27,7 @@
"clone-translations": "./src/languages/scripts/clone-translations.sh",
"cmp-files": "tsx src/workflows/cmp-files.ts",
"content-changes-table-comment": "tsx src/workflows/content-changes-table-comment.ts",
"copy-fixture-data": "tsx src/tests/scripts/copy-fixture-data.js",
"copy-fixture-data": "tsx src/tests/scripts/copy-fixture-data.ts",
"count-translation-corruptions": "tsx src/languages/scripts/count-translation-corruptions.ts",
"create-enterprise-issue": "tsx src/ghes-releases/scripts/create-enterprise-issue.ts",
"debug": "cross-env NODE_ENV=development ENABLED_LANGUAGES=en nodemon --inspect src/frame/server.ts",
@@ -58,16 +58,16 @@
"index-test-fixtures": "./src/search/scripts/index-test-fixtures.sh",
"labeler": "tsx .github/actions/labeler/labeler.ts",
"lint": "eslint '**/*.{js,mjs,ts,tsx}'",
"lint-content": "tsx src/content-linter/scripts/lint-content.js",
"lint-translation": "vitest src/content-linter/tests/lint-files.js",
"lint-content": "tsx src/content-linter/scripts/lint-content.ts",
"lint-translation": "vitest src/content-linter/tests/lint-files.ts",
"liquid-markdown-tables": "tsx src/tools/scripts/liquid-markdown-tables/index.ts",
"generate-article-api-docs": "tsx src/article-api/scripts/generate-api-docs.ts",
"generate-code-scanning-query-list": "tsx src/code-scanning/scripts/generate-code-scanning-query-list.ts",
"generate-content-linter-docs": "tsx src/content-linter/scripts/generate-docs.ts",
"move-content": "tsx src/content-render/scripts/move-content.js",
"openapi-docs": "tsx src/rest/docs.js",
"move-content": "tsx src/content-render/scripts/move-content.ts",
"openapi-docs": "tsx src/rest/docs.ts",
"playwright-test": "playwright test --config src/fixtures/playwright.config.ts --project=\"Google Chrome\"",
"lint-report": "tsx src/content-linter/scripts/lint-report.js",
"lint-report": "tsx src/content-linter/scripts/lint-report.ts",
"postinstall": "cp package-lock.json .installed.package-lock.json && echo \"Updated .installed.package-lock.json\" # see husky/post-checkout and husky/post-merge",
"precompute-pageinfo": "tsx src/article-api/scripts/precompute-pageinfo.ts",
"prepare": "husky src/workflows/husky",
@@ -75,7 +75,7 @@
"prettier-check": "prettier -c \"**/*.{ts,tsx,js,mjs,scss,yml,yaml}\"",
"prevent-pushes-to-main": "tsx src/workflows/prevent-pushes-to-main.ts",
"purge-fastly-edge-cache": "tsx src/workflows/purge-fastly-edge-cache.ts",
"purge-fastly-edge-cache-per-language": "tsx src/languages/scripts/purge-fastly-edge-cache-per-language.js",
"purge-fastly-edge-cache-per-language": "tsx src/languages/scripts/purge-fastly-edge-cache-per-language.ts",
"readability-report": "tsx src/workflows/experimental/readability-report.ts",
"ready-for-docs-review": "tsx src/workflows/ready-for-docs-review.ts",
"release-banner": "tsx src/ghes-releases/scripts/release-banner.ts",
@@ -83,15 +83,15 @@
"reusables": "tsx src/content-render/scripts/reusables-cli.ts",
"rendered-content-link-checker": "tsx src/links/scripts/rendered-content-link-checker.ts",
"rendered-content-link-checker-cli": "tsx src/links/scripts/rendered-content-link-checker-cli.ts",
"rest-dev": "tsx src/rest/scripts/update-files.js",
"rest-dev": "tsx src/rest/scripts/update-files.ts",
"show-action-deps": "echo 'Action Dependencies:' && rg '^[\\s|-]*(uses:.*)$' .github -I -N --no-heading -r '$1$2' | sort | uniq | cut -c 7-",
"start": "cross-env NODE_ENV=development ENABLED_LANGUAGES=en nodemon src/frame/server.ts",
"start-all-languages": "cross-env NODE_ENV=development tsx src/frame/server.ts",
"start-for-playwright": "cross-env ROOT=src/fixtures/fixtures TRANSLATIONS_FIXTURE_ROOT=src/fixtures/fixtures/translations ENABLED_LANGUAGES=en,ja NODE_ENV=test tsx src/frame/server.ts",
"symlink-from-local-repo": "tsx src/early-access/scripts/symlink-from-local-repo.ts",
"sync-audit-log": "tsx src/audit-logs/scripts/sync.ts",
"sync-codeql-cli": "tsx src/codeql-cli/scripts/sync.js",
"sync-graphql": "tsx src/graphql/scripts/sync.js",
"sync-codeql-cli": "tsx src/codeql-cli/scripts/sync.ts",
"sync-graphql": "tsx src/graphql/scripts/sync.ts",
"sync-rest": "tsx src/rest/scripts/update-files.ts",
"sync-secret-scanning": "tsx src/secret-scanning/scripts/sync.ts",
"sync-webhooks": "npx tsx src/rest/scripts/update-files.ts -o webhooks",

View File

@@ -29,7 +29,7 @@ async function main() {
includeBasePath: true,
globs: ['**/*.md'],
})
const cliMarkdownContents = {}
const cliMarkdownContents: Record<string, { data: any; content: string }> = {}
for (const file of markdownFiles) {
const sourceContent = await readFile(file, 'utf8')
@@ -83,7 +83,7 @@ async function setupEnvironment() {
// copy the raw rst files to the temp directory and convert them
// to Markdownusing pandoc
async function rstToMarkdown(sourceDirectory) {
async function rstToMarkdown(sourceDirectory: string) {
const sourceFiles = walk(sourceDirectory, {
includeBasePath: true,
globs: ['**/*.rst'],

View File

@@ -1,3 +1,4 @@
// @ts-nocheck
import fs from 'fs'
import path from 'path'
import { execSync } from 'child_process'
@@ -258,7 +259,7 @@ async function main() {
}
const fixableFiles = Object.entries(formattedResults)
.filter(([_, results]) => results.some((result) => result.fixable))
.filter(([, results]) => results.some((result) => result.fixable))
.map(([file]) => file)
if (fixableFiles.length) {
console.log('') // Just for some whitespace before the next message
@@ -692,7 +693,7 @@ function isOptionsValid() {
for (const path of paths) {
try {
fs.statSync(path)
} catch (err) {
} catch {
if ('paths'.includes(path)) {
console.log('error: did you mean --paths')
} else {

View File

@@ -10,20 +10,21 @@ import { reportingConfig } from '@/content-linter/style/github-docs'
// GitHub issue body size limit is ~65k characters, so we'll use 60k as a safe limit
const MAX_ISSUE_BODY_SIZE = 60000
interface LintFlaw {
severity: string
ruleNames: string[]
}
/**
* Determines if a lint result should be included in the automated report
* @param {Object} flaw - The lint result object
* @param {string} flaw.severity - 'error' or 'warning'
* @param {string[]} flaw.ruleNames - Array of rule names for this flaw
* @returns {boolean} - True if this flaw should be included in the report
*/
function shouldIncludeInReport(flaw) {
function shouldIncludeInReport(flaw: LintFlaw): boolean {
if (!flaw.ruleNames || !Array.isArray(flaw.ruleNames)) {
return false
}
// Check if any rule name is in the exclude list
const hasExcludedRule = flaw.ruleNames.some((ruleName) =>
const hasExcludedRule = flaw.ruleNames.some((ruleName: string) =>
reportingConfig.excludeRules.includes(ruleName),
)
if (hasExcludedRule) {
@@ -36,7 +37,7 @@ function shouldIncludeInReport(flaw) {
}
// Check if any rule name is in the include list
const hasIncludedRule = flaw.ruleNames.some((ruleName) =>
const hasIncludedRule = flaw.ruleNames.some((ruleName: string) =>
reportingConfig.includeRules.includes(ruleName),
)
if (hasIncludedRule) {
@@ -88,9 +89,9 @@ async function main() {
const parsedResults = JSON.parse(lintResults)
// Filter results based on reporting configuration
const filteredResults = {}
const filteredResults: Record<string, LintFlaw[]> = {}
for (const [file, flaws] of Object.entries(parsedResults)) {
const filteredFlaws = flaws.filter(shouldIncludeInReport)
const filteredFlaws = (flaws as LintFlaw[]).filter(shouldIncludeInReport)
// Only include files that have remaining flaws after filtering
if (filteredFlaws.length > 0) {
@@ -127,8 +128,8 @@ async function main() {
octokit,
reportTitle: `Content linting issues requiring attention`,
reportBody,
reportRepository: REPORT_REPOSITORY,
reportLabel: REPORT_LABEL,
reportRepository: REPORT_REPOSITORY!,
reportLabel: REPORT_LABEL!,
}
await createReportIssue(reportProps)
@@ -137,9 +138,9 @@ async function main() {
core,
octokit,
newReport: await createReportIssue(reportProps),
reportRepository: REPORT_REPOSITORY,
reportAuthor: REPORT_AUTHOR,
reportLabel: REPORT_LABEL,
reportRepository: REPORT_REPOSITORY!,
reportAuthor: REPORT_AUTHOR!,
reportLabel: REPORT_LABEL!,
}
await linkReports(linkProps)

View File

@@ -1,3 +1,4 @@
// @ts-nocheck
import { fileURLToPath } from 'url'
import path from 'path'
import yaml from 'js-yaml'

View File

@@ -1,3 +1,4 @@
// @ts-nocheck
// [start-readme]
//
// Use this script to help you move or rename a single file or a folder. The script will move or rename the file or folder for you, update relevant `children` in the index.md file(s), and add a `redirect_from` to frontmatter in the renamed file(s). Note: You will still need to manually update the `title` if necessary.
@@ -507,7 +508,7 @@ function editFiles(files, updateParent, opts) {
// Add contentType frontmatter to moved files
if (files.length > 0) {
const filePaths = files.map(([oldPath, newPath, oldHref, newHref]) => newPath)
const filePaths = files.map(([, newPath]) => newPath)
try {
const cmd = ['run', 'add-content-type', '--', '--paths', ...filePaths]
const result = execFileSync('npm', cmd, { cwd: process.cwd(), encoding: 'utf8' })

View File

@@ -1,3 +1,4 @@
// @ts-nocheck
import fs from 'fs/promises'
import { appendFileSync } from 'fs'
import path from 'path'

View File

@@ -3,11 +3,13 @@ import { readFile } from 'fs/promises'
import { allVersions } from '@/versions/lib/all-versions'
// Translate the docs versioning nomenclature back to the OpenAPI names
const invertedVersionMapping = JSON.parse(await readFile('src/rest/lib/config.json')).versionMapping
const versionMapping = {}
const invertedVersionMapping = JSON.parse(
await readFile('src/rest/lib/config.json', 'utf8'),
).versionMapping
const versionMapping: Record<string, string> = {}
Object.assign(
versionMapping,
...Object.entries(invertedVersionMapping).map(([a, b]) => ({ [b]: a })),
...Object.entries(invertedVersionMapping).map(([a, b]) => ({ [b as string]: a })),
)
const openApiVersions = Object.values(allVersions)
.map((version) => version.openApiVersionName)

View File

@@ -37,7 +37,7 @@ program
main(program.opts())
async function main(opts) {
async function main(opts: { check?: boolean; dryRun?: boolean; verbose?: boolean }) {
let errors = 0
for (const file of MANDATORY_FILES) {
const source = fs.readFileSync(file, 'utf-8')
@@ -54,7 +54,7 @@ async function main(opts) {
} else if (opts.verbose) {
console.log(`The file ${chalk.green(destination)} is up-to-date 🥰`)
}
} catch (error) {
} catch (error: any) {
if (error.code === 'ENOENT') {
console.warn(`The file ${chalk.red(destination)} does not exist`)
errors++
@@ -71,7 +71,7 @@ async function main(opts) {
}
continue
}
} catch (error) {
} catch (error: any) {
if (error.code !== 'ENOENT') throw error
}
if (!opts.dryRun) {