Repository navigation
fix(template): lint-ignore generated types in shared/appkit-types - #733
Conversation
`appkit generate-types` and the Vite plugin write `shared/appkit-types/*.d.ts`. With no database schema or metric views, `database.d.ts` and `metric-views.d.ts` carry empty registry interfaces, which trip `typescript/no-empty-object-type` on a fresh scaffold. Generated files are overwritten on the next run, so ignore the directory rather than lint it. Also drop `async` from the three functions in `server/example.test.ts` that never await (`typescript/require-await`), so a fresh scaffold passes its own `lint` script. Refs LA-2385 Co-authored-by: Isaac <no-reply@databricks.com> Signed-off-by: Atila Fassina <atila@fassina.eu>
After the build, write the empty-registry declarations typegen emits for an app with no database schema or metric views, then run the app's own `lint` script. Fails on the current main config with no-empty-object-type in shared/appkit-types. Refs LA-2385 Co-authored-by: Isaac <no-reply@databricks.com> Signed-off-by: Atila Fassina <atila@fassina.eu>
🤖 AppKit PR bot🔬 Run evalsStart an eval for this PR from the evals-monitor app: Go to Evals Monitor → 📦 Try this PR's app templateScaffolds a new app from this PR's SDK build. Run it in any folder (requires the GitHub CLI — gh run download 43313215734 -R databricks/appkit -n appkit-template-0.94.1-pr.9e5ea7e-work-15-lint-ignore-generated-types-in-733 -D appkit-pr-733 \
&& unzip -o "appkit-pr-733/appkit-template-0.94.1-pr.9e5ea7e-work-15-lint-ignore-generated-types-in-733.zip" -d "appkit-pr-733" \
&& databricks apps init --template "appkit-pr-733"The template pins |
|
Review 3 · Pass Does the change do what the task asked? Yes. Gate: major and worse must be fixed. The changed template ignores generated AppKit types, and an isolated scaffold now passes lint, build, typecheck, and tests. The old config reproduces both reported generated-type lint errors; the reviewed PR is open, ready for review, and approved at this commit. No findings. |
calvarjorge
left a comment
There was a problem hiding this comment.
LGTM. I ran the template smoke test at dc02ea8 and it passes. In the scaffold, the old config gives 2× no-empty-object-type and the old example.test.ts gives 3× require-await; with this PR, oxlint is clean. Ignoring the generated directory is the right fix, since the empty registry interfaces are needed for declaration merging and tsc still checks those files.
Fixes LA-2385 (follow-up to #665).
Problem
appkit generate-typesand the Vite plugin writeshared/appkit-types/*.d.ts. With no database schema or metric views,database.d.tsandmetric-views.d.tscontain empty registry interfaces (interface DatabaseRegistry {},interface MetricRegistry {}), and the template's.oxlintrc.jsonreports them astypescript(no-empty-object-type). In NFL-Scout evals, 8 of 20 sampled trajectories hit this error and 5 edited.oxlintrc.jsonto get around it.Fix: ignore the directory (not a typegen change)
template/.oxlintrc.jsonnow listsshared/appkit-types/**inignorePatterns.interface DatabaseRegistry extends GeneratedDatabaseRegistry {}works through declaration merging, and atypealias can't merge. The interface is empty whenever nothing has been generated yet, so typegen can't avoid it. Generated files are also overwritten on every run, so any lint error in them (no-explicit-any,no-unsafe-*and so on) can't be fixed where it's reported. Ignoring the whole directory covers every generated file, now and later.Also:
server/example.test.tsA fresh scaffold also failed its own
lintscript with 3×typescript(require-await)inserver/example.test.ts. That has been there since the testing kit landed (#530/#540). I removedasyncwhere nothing is awaited:setup()and the route handler now returnPromise.resolve(), andgreetis a sync generator (expectStreamaccepts anyIterable).Test
tools/template-smoke-runner.ts(CIsmoke-test-template --run, pnpm and npm): after the build, which runs typegen, the runner writes the empty-registry declarations the generator emits (taken from the repo's ownNEUTRAL_DATABASE_TYPES/generateMetricTypeDeclarations([]), and only if the build didn't write them) and then runs the app's ownlintscript.Verification
generate-types, old config: 2×no-empty-object-typeinshared/appkit-typesplus 3×require-await. New config:oxlintexits 0.--runpasses for pnpm and npm. With the old.oxlintrc.jsonit fails on theno-empty-object-typeerrors.pnpm build,pnpm typecheck,pnpm check:fix,pnpm docs:buildand the vitesttoolsproject (102 tests) pass. The scaffold'stypecheckandexample.test.ts(3 tests) pass.This pull request and its description were written by Isaac.