type-check-baselines

작성자: redis

RedisInsight의 프로젝트별 TypeScript 오류 기준선(.tscheck.rec.json)을 실행, 새로 고침 또는 복구합니다. CI가 "기준선이 오래됨" 또는 "더 많은 TS…"를 보고할 때 사용합니다.

npx skills add https://github.com/redis/redisinsight --skill type-check-baselines

TS error baselines

RedisInsight gates TypeScript errors per project via a one-way ratchet: current error counts are recorded in .tscheck.rec.json files, and CI fails if any (file × error-code) count increases. Counts can only go down.

Projects and commands

Projecttsconfig usedBaseline filePer-project compare
UIredisinsight/ui/tsconfig.jsonredisinsight/ui/.tscheck.rec.jsonnpm run type-check --prefix redisinsight/ui
APIredisinsight/api/tsconfig.check.json (strict, extends base)redisinsight/api/.tscheck.rec.jsonnpm run type-check --prefix redisinsight/api
Desktopredisinsight/desktop/tsconfig.jsonredisinsight/desktop/.tscheck.rec.jsonnpm run type-check --prefix redisinsight/desktop
Configsconfigs/tsconfig.json— (must stay at 0 errors)npx tsc --project configs/tsconfig.json --noEmit

Run all checks together from the repo root:

  • npm run type-check — compare against baselines (all four projects). E2E Playwright is type-checked by a separate workflow (tests-e2e-playwright-lint.yml) — not part of this.
  • npm run tscheck — refresh baselines for ui/api/desktop after fixing errors. Projects whose error count didn't change produce no diff.
  • npm run tscheck:force — force-overwrite baselines for ui/api/desktop. Emergencies only.

Always run refresh commands through the root npm run tscheck / npm run tscheck:force wrappers. The per-workspace refresh scripts (npm run tscheck --prefix redisinsight/<ws>) shell out to tsc, tsx, and tsc-output-parser, which are installed only in the root node_modules/.bin/ — this repo is not an npm workspace, so npm run --prefix only exposes the sub-dir's bin, not the root's. The root wrappers exist precisely to avoid that trap by running in the root context first. If you must invoke the per-package script directly, prepend the root bin dir manually: PATH="$PWD/node_modules/.bin:$PATH" npm run tscheck --prefix redisinsight/ui.

API has a dedicated check tsconfig

redisinsight/api/tsconfig.check.json extends the base tsconfig.json and adds:

"strict": true,
"strictPropertyInitialization": false,
"useUnknownInCatchVariables": false,
"noEmit": true

The base tsconfig.json stays as-is so nest build is unaffected. Never enable strict in the base — it breaks the production build.

Workflows

CI says "more TS errors than previously recorded"

You introduced new errors. Fix them. Read the script output — it lists the file, error code (TSxxxx), and message for each new error. Do not run tscheck:force in any workspace to paper over them.

CI says "baseline is outdated"

You fixed errors (good). Refresh baselines from the repo root:

npm run tscheck

This runs the refresh for ui, api, and desktop; only the project whose count changed will produce a diff. Commit the updated .tscheck.rec.json.

Adding a brand-new file with TS errors

Same rule: the file × error-code counts went from 0 to N — that's "new errors". Fix them before merging. Strict-mode escape hatches (as any, // @ts-expect-error with justification) are acceptable when fixing legitimately is out of scope, but prefer real fixes.

Bootstrapping a fresh baseline

Only needed once per project (already done for ui/api/desktop). The non-force npm run tscheck --prefix redisinsight/<workspace> calls compare first, which fails against an empty baseline. Use npm run tscheck:force --prefix redisinsight/<workspace> for the very first baseline only.

After npm install in redisinsight/api/

The api postinstall regenerates redisinsight/api-client/. That can shift UI and Desktop error counts (they both import from apiClient). If npm run type-check:ui or npm run type-check:desktop reports drift after an api install, refresh those baselines.

Local UI check disagrees with CI

UI plugins under redisinsight/ui/src/packages/{redisearch, redisgraph, redistimeseries-app, ri-explain, clients-list} are sub-projects whose source gets type-checked via the UI tsconfig. Their deps live in nested node_modules populated by npm run build:statics (or by running npm install --prefix redisinsight/ui/src/packages/<plugin>). CI runs npm run build:statics before npm run type-check:ui, so the baseline reflects "plugin deps installed."

If npm run type-check:ui shows TS7016 ("Could not find a declaration file for module ...") errors that CI doesn't, you're missing plugin deps. Run npm run build:statics once, then re-run the check. Don't refresh the baseline to your local state — CI runs with plugin deps installed.

Local Desktop check disagrees with CI

Desktop type-check needs redisinsight/api/dist/ populated with the dev nest build (npm run build --prefix redisinsight/api, not build:prod — prod skips .d.ts emission). CI does this automatically. Locally, build api once before generating or refreshing the desktop baseline.

Reviewing PRs

Reject PRs that:

  • Bump a .tscheck.rec.json file × code count up without a corresponding code fix.
  • Use tscheck:force in any workspace (look for the diff: a force overwrite typically touches many lines in the rec file with no related TS changes).
  • Enable strict in redisinsight/api/tsconfig.json (the base). Strict for api belongs only in tsconfig.check.json.

Approve PRs that:

  • Leave counts unchanged.
  • Decrease counts (with the rec file updated and committed).

redis의 다른 스킬

docs-sync
redis
마스터 브랜치의 구현 및 구성을 분석하여 docs/, README.md, 패키지별 README에서 누락되거나, 부정확하거나, 오래된 문서를 찾습니다.
redis-query-engine
redis
Redis Query Engine (RQE) 가이드: FT.CREATE 스키마 설계, 필드 유형 선택(TEXT, TAG, NUMERIC, GEO, GEOSHAPE, VECTOR), DIALECT 2 쿼리 구문,…
redis-search
redis
Redis Search 가이드: FT.CREATE 스키마 설계, 필드 유형 선택(TEXT, TAG, NUMERIC, GEO, GEOSHAPE, VECTOR, JSON 경로), DIALECT 2 쿼리 구문,…
redis-security
redis
Redis 보안 가이드로 인증(requirepass 및 ACL 사용자), TLS, ACL 기반 최소 권한 접근 제어, 네트워크 노출 제한 등을 다룹니다.
redis-semantic-cache
redis
Redis LangCache를 사용하여 Redis Cloud에서 LLM 응답의 시맨틱 캐싱을 수행하는 방법 — SDK 또는 REST API를 통한 검색/설정 호출, 유사도 임계값 조정,…
redis-vector-search
redis
Redis 벡터 검색 가이드: HNSW vs FLAT 알고리즘 선택, 벡터 인덱스 구성(차원, 거리 메트릭, 데이터 타입), 필터링된 하이브리드 검색…
bump-test-image
redis
공유 DEFAULT_DOCKER_CONFIG 및 CI 매트릭스에서 기본 Redis docker 테스트 이미지(redislabs/client-libs-test)를 범프한 다음 강제 푸시합니다…
i18n
redis
RedisInsight UI(i18next)의 국제화 규칙입니다. redisinsight/ui/** 아래의 사용자 표시 문자열을 추가하거나 변경할 때, ...를 편집할 때 사용합니다.