Skip to content

Commit 34b9870

Browse files
christian-byrneGlary-BotDrJKL
authored
build(website): enable the strictest tsconfig flags that already pass (#15300)
*PR Created by the Glary-Bot Agent* --- ## Summary `astro/tsconfigs/strictest` layers nine options on top of the `strict` preset the app already uses. Measured each against `apps/website`: seven report zero errors once six dead declarations are removed. This turns those seven on. ## Changes - **What**: enables `noUnusedLocals`, `noUnusedParameters`, `noImplicitReturns`, `noFallthroughCasesInSwitch`, `noImplicitOverride`, `allowUnreachableCode: false`, `allowUnusedLabels: false`, and deletes the six declarations that blocked them: - `data/drops.ts` — `FEATURED_BADGE` (unused `LocalizedText`) - `layouts/BaseLayout.astro` — unused `Locale` type import - `pages/careers.astro` + `pages/zh-CN/careers.astro` — `siteUrl` destructured but never read - `scripts/generate-models.ts` — unused `RawModel` interface - `components/product/enterprise/TeamSection.vue` — `routes` computed and its `getRoutes` import - **Breaking**: none. Every deletion is a declaration with no reader. ## Review Focus **Measured, not guessed.** Error counts per flag against this app: | flag | errors | enabled here | |---|---:|:---:| | `noUnusedParameters` | 0 | yes | | `noImplicitReturns` | 0 | yes | | `noFallthroughCasesInSwitch` | 0 | yes | | `noImplicitOverride` | 0 | yes | | `allowUnreachableCode: false` | 0 | yes | | `allowUnusedLabels: false` | 0 | yes | | `noUnusedLocals` | 6 | yes (fixed here) | | `exactOptionalPropertyTypes` | **75** | no | | `noUncheckedIndexedAccess` | **202** | no | The last two are left off deliberately — each needs its own remediation pass, not a flag flip. `noUncheckedIndexedAccess` in particular would touch every array index and `Record` lookup in the app. `TeamSection.vue` is only reachable by `vue-tsc`, which this app does not run yet (that arrives in #15284). It is fixed here anyway so the flag stays clean once that lands. ## Verification `astro check` 0 errors with the flags on · 422 unit tests passing (1 pre-existing `minimaxMusic3` failure, also on `main`) · production build 595 pages · oxfmt clean. Confirmed the new flags introduce no `vue-tsc` regressions: `vue-tsc` reports the same 9 pre-existing SFC errors as `main` (same four files, same counts — those are what #15282/#15283 fix), and **zero** TS6133/TS6196/TS7027/TS7030 diagnostics, i.e. none attributable to these flags. This PR is therefore independent of that stack and can merge in any order relative to it. --------- Co-authored-by: Glary-Bot <glary-bot@users.noreply.github.com> Co-authored-by: Alexander Brown <drjkl@comfy.org>
1 parent da403f8 commit 34b9870

12 files changed

Lines changed: 92 additions & 28 deletions

File tree

.stylelintrc.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@
7272
"node_modules/**",
7373
"dist/**",
7474
"**/dist/**",
75+
"coverage/**",
76+
"**/coverage/**",
7577
"playwright-report/**",
7678
"public/**",
7779
"src/lib/litegraph/**"

apps/website/scripts/generate-models.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@ const QUANT_SUFFIXES = [
2222
'_int8'
2323
]
2424

25-
interface RawModel {
26-
name: string
27-
url: string
28-
directory: string
29-
}
30-
3125
interface ModelData {
3226
url: string
3327
directory: string

apps/website/src/components/product/api/HeroSection.vue

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { externalLinks } from '../../../config/routes'
99
import { t } from '../../../i18n/translations'
1010
import BrandButton from '../../common/BrandButton.vue'
1111
import ProductHeroBadge from '../../common/ProductHeroBadge.vue'
12+
import { stampCycleAt } from './stampCycle'
1213
1314
const { locale = 'en' } = defineProps<{ locale?: Locale }>()
1415
@@ -109,18 +110,7 @@ onMounted(() => {
109110
const time = Date.now() / 1000
110111
const cycle = time % 1.0
111112
112-
let stampAmt = 0
113-
let conveyorEject = 0
114-
115-
if (cycle < 0.35) {
116-
const p = cycle / 0.35
117-
stampAmt = Math.pow(Math.sin(p * Math.PI), 1.2)
118-
conveyorEject = 0
119-
} else {
120-
const p = (cycle - 0.35) / 0.65
121-
conveyorEject = (1 - Math.cos(p * Math.PI)) / 2
122-
stampAmt = 0
123-
}
113+
const { stampAmt, conveyorEject } = stampCycleAt(cycle)
124114
125115
const maxPushDistance = 210
126116
const travelMagnitude = stampAmt * maxPushDistance
@@ -224,13 +214,13 @@ onUnmounted(() => {
224214
<ProductHeroBadge text="API" />
225215

226216
<h1
227-
class="text-primary-comfy-canvas mt-6 text-3xl/tight font-light md:text-4xl/tight lg:max-w-2xl lg:text-5xl/tight xl:whitespace-pre-line"
217+
class="mt-6 text-3xl/tight font-light text-primary-comfy-canvas md:text-4xl/tight lg:max-w-2xl lg:text-5xl/tight xl:whitespace-pre-line"
228218
>
229219
{{ t('api.hero.heading', locale) }}
230220
</h1>
231221

232222
<p
233-
class="text-primary-comfy-canvas mt-6 max-w-md text-sm lg:mt-6 lg:text-base"
223+
class="mt-6 max-w-md text-sm text-primary-comfy-canvas lg:mt-6 lg:text-base"
234224
>
235225
{{ t('api.hero.subtitle', locale) }}
236226
</p>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { describe, expect, it } from 'vitest'
2+
3+
import { STAMP_PHASE_END, stampCycleAt } from './stampCycle'
4+
5+
describe('stampCycleAt', () => {
6+
it('rests at the start of the stamp phase', () => {
7+
expect(stampCycleAt(0)).toEqual({ stampAmt: 0, conveyorEject: 0 })
8+
})
9+
10+
it('peaks the press mid-stamp', () => {
11+
expect(stampCycleAt(STAMP_PHASE_END / 2).stampAmt).toBeCloseTo(1, 5)
12+
})
13+
14+
it('hands off with the press retracted as the conveyor starts', () => {
15+
expect(stampCycleAt(STAMP_PHASE_END)).toEqual({
16+
stampAmt: 0,
17+
conveyorEject: 0
18+
})
19+
})
20+
21+
it('fully ejects at the end of the loop', () => {
22+
expect(stampCycleAt(0.999).conveyorEject).toBeCloseTo(1, 2)
23+
})
24+
25+
it.for([0, 0.1, 0.34, STAMP_PHASE_END, 0.5, 0.9, 0.999])(
26+
'keeps both outputs within 0..1 at cycle %s',
27+
(cycle: number) => {
28+
const { stampAmt, conveyorEject } = stampCycleAt(cycle)
29+
30+
expect(stampAmt).toBeGreaterThanOrEqual(0)
31+
expect(stampAmt).toBeLessThanOrEqual(1)
32+
expect(conveyorEject).toBeGreaterThanOrEqual(0)
33+
expect(conveyorEject).toBeLessThanOrEqual(1)
34+
}
35+
)
36+
37+
it('never drives the press and the conveyor at the same time', () => {
38+
for (let cycle = 0; cycle < 1; cycle += 0.01) {
39+
const { stampAmt, conveyorEject } = stampCycleAt(cycle)
40+
41+
expect(Math.min(stampAmt, conveyorEject)).toBe(0)
42+
}
43+
})
44+
})
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
export interface StampCycle {
2+
/** Press travel, 0 at rest and 1 at full stamp. */
3+
stampAmt: number
4+
/** Outfeed travel, 0 before eject and 1 when fully ejected. */
5+
conveyorEject: number
6+
}
7+
8+
/** Stamp occupies the first 35% of the loop; the conveyor ejects across the rest. */
9+
export const STAMP_PHASE_END = 0.35
10+
11+
export function stampCycleAt(cycle: number): StampCycle {
12+
if (cycle < STAMP_PHASE_END) {
13+
const p = cycle / STAMP_PHASE_END
14+
return { stampAmt: Math.pow(Math.sin(p * Math.PI), 1.2), conveyorEject: 0 }
15+
}
16+
const p = (cycle - STAMP_PHASE_END) / (1 - STAMP_PHASE_END)
17+
return { stampAmt: 0, conveyorEject: (1 - Math.cos(p * Math.PI)) / 2 }
18+
}

apps/website/src/components/product/enterprise/TeamSection.vue

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@ import { computed } from 'vue'
33
44
import type { Locale } from '../../../i18n/translations'
55
6-
import { getRoutes } from '../../../config/routes'
76
import { t } from '../../../i18n/translations'
87
import FeatureShowcaseSection from '../shared/FeatureShowcaseSection.vue'
98
109
const { locale = 'en' } = defineProps<{ locale?: Locale }>()
1110
12-
const routes = computed(() => getRoutes(locale))
13-
1411
const features = computed(() => [
1512
{
1613
title: t('enterprise.team.feature1.title', locale),

apps/website/src/data/drops.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ const MODELS_AND_NODES: LocalizedText = {
2828
'zh-CN': '模型与节点'
2929
}
3030
const NEW_BADGE: LocalizedText = { en: 'NEW', 'zh-CN': '新' }
31-
const FEATURED_BADGE: LocalizedText = { en: 'FEATURED', 'zh-CN': '精选' }
3231

3332
function imageFor(fileName: string, alt: LocalizedText): DropMedia {
3433
return {

apps/website/src/layouts/BaseLayout.astro

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import { ClientRouter } from 'astro:transitions'
33
import Analytics from '@vercel/analytics/astro'
44
import '../styles/global.css'
5-
import type { Locale } from '../i18n/translations'
65
import SiteFooter from '../components/common/SiteFooter.vue'
76
import HeaderMain from '../components/common/HeaderMain/HeaderMain.vue'
87
import AnnouncementBanner from '../templates/drops/AnnouncementBanner.vue'

apps/website/src/pages/careers.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ if (outcome.status === 'failed') {
2727
2828
const departments = outcome.snapshot.departments
2929
30-
const { siteUrl, locale, url } = pageContext(
30+
const { locale, url } = pageContext(
3131
Astro.site,
3232
Astro.url.pathname,
3333
Astro.currentLocale,

apps/website/src/pages/zh-CN/careers.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ if (outcome.status === 'failed') {
2727
2828
const departments = outcome.snapshot.departments
2929
30-
const { siteUrl, locale, url } = pageContext(
30+
const { locale, url } = pageContext(
3131
Astro.site,
3232
Astro.url.pathname,
3333
Astro.currentLocale,

0 commit comments

Comments
 (0)