chore: Code changes & formatting and linting (#3552)

* Do some code changes & run prettier and eslint

* Fix test:test-type script

* Apply code review suggestions

* update heartbeat interval & add a reason for the specific value

* Fix husky error

* Update to TS 5.5

And use ${configDir}

* Fix test.json tsconfig base

---------

Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com>
This commit is contained in:
Fleny
2024-07-08 22:11:41 +02:00
committed by GitHub
parent 2f89d4da30
commit 97a8016041
83 changed files with 370 additions and 526 deletions

View File

@@ -1,10 +1,13 @@
/* eslint-disable @typescript-eslint/explicit-function-return-type */
/* eslint-disable @typescript-eslint/no-unsafe-argument */
import fs from 'fs'
// TODO: replace with fetch of live spec
const DISCORD_SPEC = {}
function schemaRefToName(ref) {
if (!ref) return ""
if (!ref) return ''
return `Discord${ref?.substring(ref.lastIndexOf('/') + 1)}`
}
@@ -60,12 +63,12 @@ function generateFromSpec() {
type === 'integer'
? 'number'
: type === 'array'
? property.items.$ref
? `${schemaRefToName(property.items.$ref)}[]`
: Array.isArray(property.items.oneOf)
? `${property.items.oneOf.map((o) => `${schemaRefToName(o.$ref)}[]`).join(' | ')}`
: `unknown[]`
: type,
? property.items.$ref
? `${schemaRefToName(property.items.$ref)}[]`
: Array.isArray(property.items.oneOf)
? `${property.items.oneOf.map((o) => `${schemaRefToName(o.$ref)}[]`).join(' | ')}`
: `unknown[]`
: type,
)
.join(' | ') ??
property.oneOf