Skip to content

build: pnpm verify, and type-aware oxlint and knip in every gate - #25

Merged
rmotafreitas merged 3 commits into
mainfrom
ci/verify-and-linters
Nov 4, 2026
Merged

rmotafreitas merged 3 commits into
mainfrom
ci/verify-and-linters

Conversation

@rmotafreitas

Copy link
Copy Markdown
Contributor

Brings the library's gates up to the Animu app's: its type-aware linter and dead-code check, and a pnpm verify that runs everything CI runs.

Changes

Gates

  • pnpm run lint = ESLint (lint:eslint) + oxlint type-aware (lint:types, tsgolint, the app's exact rule set and versions) + knip (lint:deps).
  • scripts/verify.mjs lists every check. It runs each one even after a failure and prints a summary; --fast skips the slow ones (secrets, audit).
  • check:ci (GitHub Actions, Jenkins, the npm publish workflow) is verify, and check:quality (the app's isolated submodule check) is verify --no-secrets, so CI and a local run can't drift. A tooling test keeps check:ci, check:quality and lint in step with the list.
  • sherif is left out: it checks monorepo consistency, and this is one package.

Findings fixed (behaviour unchanged, 56 before)

  • Casts and optional chains the types already rule out are gone (valibot input, validated DTO fields, Response.headers).
  • isRealTrack / getTrackProgress keep their guards, and their parameter types now say they take track-like values (the app passes tracks it rebuilt). The types are wider, so this is compatible for callers.
  • Switches name every case (off artwork tier, typeof's remaining cases). A missing request error code becomes "" and still gets the default message.
  • live.ts: flags set in callbacks or across an await (finished, idle, idleTimer, running) are false positives for TS narrowing. Each is disabled on its line with the reason, as the app does.
  • Utf8Decoder is no longer exported (internal). The auth.ts shim drops a BinaryResponse re-export (the package only exports its index, which has it). The deprecated Google alias is tagged @alias for knip.
  • The ESLint config uses defineConfig. Tests type their catch callbacks, and may call the deprecated aliases they cover.

Verification

  • pnpm run check:ci: all 9 steps pass (secrets, tooling tests (13), audit, ESLint, oxlint, knip, typecheck, 246 tests + coverage, build)
  • The app's node scripts/check-submodule.mjs animu-api (isolated copy, no .git): all 8 steps pass

What oxlint's type-aware rules (the app's set) find, ahead of running them
in CI:

- Casts and optional chains the types already rule out go: the payload
  valibot parses, a validated DTO and its track id, a Response's headers.
- isRealTrack and getTrackProgress keep their guards and now say why in
  their types: they take track-like values (the app asks of tracks it
  rebuilt), so a missing title part or start reads as nothing.
- Switches name every case they meet: the artwork tier `off`, typeof's
  function/symbol/undefined, and a missing request error is "".
- Flags set in callbacks or across an await (finished, idle, idleTimer,
  running), which TypeScript's narrowing does not follow, are disabled on
  their lines with the reason; the deprecated Google alias stays exported
  as such.
- Utf8Decoder is internal; the auth shim no longer re-exports
  BinaryResponse (the package exports only its index, which has it).
- The ESLint config uses defineConfig and names the SonarJS preset's
  fields; tests type their catch callbacks and read a Request's URL.
`pnpm run lint` now runs ESLint, oxlint's type-aware rules (tsgolint, the
app's rule set) and knip. scripts/verify.mjs is the list of every check:
it runs each even after a failure and ends with a summary, and check:ci
(GitHub Actions, Jenkins, the npm publish) and check:quality (the app's
submodule check, without the history scan) are that script, so a local
run and CI cannot drift apart. `--fast` skips the slow steps. Its tooling
test keeps check:ci, check:quality and `lint` in step with the list.

Tests may call the deprecated aliases they cover.
A JS npm_execpath (pnpm's) runs on this Node, anything else (Yarn's shell
launcher) as is; tested for both.
@rmotafreitas
rmotafreitas merged commit ddbe49a into main Nov 4, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant