Skip to content

Develop - #113

Merged
x42en merged 2 commits into
mainfrom
develop
Oct 5, 2026
Merged

x42en merged 2 commits into
mainfrom
develop

Conversation

@x42en

@x42en x42en commented Oct 5, 2026

Copy link
Copy Markdown
Owner

This pull request introduces several improvements to TypeScript support, ESLint configuration, and test consistency across the codebase. The main changes include adding and updating tsconfig files for linting, refining ESLint project and environment configuration (especially for the docs-site and test files), and improving type safety and imports in both example services and test files.

TypeScript and ESLint configuration improvements:

  • Added a new tsconfig.eslint.json at the root and in docs-site/ to provide lint-only TypeScript project references, enabling ESLint to correctly lint all source, test, and example files without interfering with build configs. (tsconfig.eslint.json, docs-site/tsconfig.eslint.json) [1] [2]
  • Updated ESLint configuration to use these new tsconfig.eslint.json files for type-aware linting, and added dedicated blocks for docs-site, test, and script files to ensure correct globals and parser settings per environment. (eslint.config.js) [1] [2]

Test and example code improvements:

  • Replaced all uses of require("socket.io-client") with ESM-style import { io } from "socket.io-client" for consistency and improved type safety in tests and examples. (tests/e2e/chat-app.e2e.test.ts, tests/integration/IOServer.integration.test.ts, tests/performance/performance.test.ts, etc.) [1] [2] [3]
  • Improved type signatures for callback parameters in example service methods, replacing callback?: Function with callback?: (response: any) => void for better type safety and clarity. (examples/chat-app/services/ChatService.ts, examples/simple.ts, tests/integration/IOServer.integration.test.ts) [1] [2] [3]

Test robustness and clarity:

  • Updated error handling in tests to use explicit assertions instead of Jasmine's fail() helper, improving compatibility with Jest and clarity of intent. (tests/unit/IOServerError.test.ts)
  • Minor improvements to test cleanup and async handling for more robust and readable tests. (tests/unit/IOServer.test.ts, tests/performance/performance.test.ts) [1] [2] [3]

Other configuration and ignore updates:

  • Added generated API docs output to ESLint ignore patterns, ensuring that generated files are not linted. (eslint.config.js)

These changes collectively improve the maintainability, type safety, and reliability of both the codebase and the developer tooling.

personal-crew Bot and others added 2 commits October 5, 2026 07:59
Close the three configuration gaps and fix the 64 remaining errors that were
hidden behind the parser-project failure.

Config: ignore generated TypeDoc output under docs/source/_static/api/,
give scripts/**/*.js a CommonJS/Node globals block, and give the TS block plus
the docs-site Nuxt package real lint-only tsconfig projects.

Code: replace require() calls in tests with ESM imports, replace bare
Function callback types with (response: any) => void, and clear the three
unused-vars errors without any eslint-disable.

eslint . now exits 0: 0 errors, 36 pre-existing src/ no-explicit-any warnings.
No src/ runtime change, no workflow change, no dependency or version change.
…112)

# chore(lint): make `eslint .` exit 0 so the blocking Lint gate stops
failing CI

## Why

`main` CI run `37273713053` fails on **both** matrix legs (`22.x` and
`24.x`) at step 6
`Run linting`, which skips `Build project`, `Run tests` and `Upload test
coverage`.
`publish.yml`'s `publish-npm` and `publish-gpr` jobs declare `needs:
build`, and `build` runs
that same lint step — so creating the `v2.2.1` release today would fail
the `build` job at lint
and skip both publish jobs.

**This PR is what unblocks the `v2.2.1` release.** The gate itself is
already blocking on `main`
(PR #110 removed `continue-on-error`) and stays blocking; nothing is
reintroduced or softened here.

## Result

`pnpm run lint` exits **0**, reported as `✖ 36 problems (0 errors, 36
warnings)`.

The 36 warnings are the pre-existing
`@typescript-eslint/no-explicit-any` in `src/`
(33 in `IOServer.ts`, 3 in `BaseClasses.ts`). They are permitted by
`AGENTS.md`, `eslint .` has
no `--max-warnings`, and they are **still present and un-suppressed** —
the errors were fixed
rather than muted.

## Config gaps, each proven with a real `eslint .` count

Measured on a scratch copy of `origin/develop` (`bbab5ba`, same tree as
`main` `7b39dc9`),
Node 22.22.1, pnpm 12.9.1. Each stage is generated from the untouched
upstream config with only
the change that stage names applied to it, so no block can leak in
unobserved.

| Stage | Change | `eslint .` | `exit` |
|---|---|---|---|
| 0 | untouched baseline | **269 problems (233 errors, 36 warnings)** |
1 |
| 1 | `ignores: ['docs/source/_static/api/**']` — generated TypeDoc
output | 75 problems (39 errors) | 1 |
| 2 | Node/CommonJS globals block for `scripts/**/*.js` | 54 problems
(18 errors) | 1 |
| 3 | parser project `tsconfig.eslint.json` for the `**/*.ts` block |
**100 problems (64 errors, 36 warnings)** | 1 |
| 4 | ambient Node globals for `tests/**/*.ts` + `examples/**/*.ts` | 67
problems (31 errors) | 1 |
| 5 | `docs-site/tsconfig.eslint.json` + Nuxt auto-import globals | 64
problems (28 errors) | 1 |

Stage 2 → 3 *rises* from 54 to 100 problems, which is the whole point:
closing the parser gap
turns 18 unparseable files into lintable ones, exposing the errors that
were hidden behind the
parse failure. Stages 0 → 3 reproduce this card's inventory exactly —
269 problems, 233 errors,
and then 34 `no-undef` + 13 `no-require-imports` + 11
`no-unsafe-function-type` + 3 parser + 3
`no-unused-vars` = the 64 errors it listed.

**`*.js` in a flat-config `ignores` list is not recursive.** Probing
`ignores: ['*.js']` alone
still lints `scripts/gpr.js`, `scripts/gpr-restore.js` and
`docs/source/_static/api/assets/*.js`, while the root-level
`jest.config.js` and `.eslintrc.js`
are skipped. That — not a malformed config — is why `scripts/gpr*.js`
was linted despite the
existing pattern. Confirmed with a direct `eslint .` run, not by
inspection.

## The 64 errors: how each family was closed

| Count | Rule | Treatment |
|---|---|---|
| 34 | `no-undef` | **33 by ambient globals, 1 in code.** The
`require`/`module` and `setTimeout`/`setInterval`/`clear*` references in
`tests/` and `examples/` are genuine host-provided CommonJS/Node globals
(those files execute under ts-jest and ts-node), so they get an ambient
globals block — the same root cause as the `scripts/` gap, which the
card itself flags. The 34th is `fail` in
`tests/unit/IOServerError.test.ts`: **not a global at all** (see below),
fixed in code. |
| 13 | `@typescript-eslint/no-require-imports` | **Code fix.**
`require()` calls in `tests/e2e/chat-app.e2e.test.ts`,
`tests/integration/IOServer.integration.test.ts` (7),
`tests/performance/performance.test.ts` (3),
`tests/unit/IOServer.static.test.ts` replaced with real ESM imports
(`import supertest from "supertest"`, `import { io } from
"socket.io-client"`), and the redundant per-test `const io =
require(...)` lookups deleted. |
| 11 | `@typescript-eslint/no-unsafe-function-type` | **Code fix.**
Every bare `callback?: Function` became `callback?: (response: any) =>
void` — 6 in `examples/chat-app/services/ChatService.ts`, 1 in
`examples/simple.ts`, 4 in
`tests/integration/IOServer.integration.test.ts`. The signatures are
only ever *called* with a plain object payload, so the behaviour is
unchanged: these are widened parameter types, never narrowed ones, and
`tests/e2e/chat-app.e2e.test.ts` (which drives those files) stays green.
|
| 3 | `Parsing error: "parserOptions.project"` under `docs-site/` |
**Config.** Both `tsconfig.eslint.json` projects are new, lint-only
files. |
| 3 | `@typescript-eslint/no-unused-vars` | **Code fix, no
suppression:** `(_, i)` → `(_, _unused)` in
`tests/performance/performance.test.ts`; `catch (error)` → bare `catch
{}` in `tests/unit/IOServer.test.ts`; the unused `callback` parameter of
`ChatService.typing()` renamed to `_callback`, matching the
already-configured `argsIgnorePattern: '^_'`. |

Net split: **28 errors fixed in code**, 36 closed by configuration (33
ambient globals that the
card classes as the same root cause as the `scripts/` gap, plus 3
parser-project errors).
No rule was turned off, no global rule override was added, and **there
is not a single
`eslint-disable` in the diff** — files or lines.

### The `fail()` global — a latent broken test, not a suppression

`tests/unit/IOServerError.test.ts` called Jasmine's `fail()`, which
jest-circus does not provide:
that branch could never have fired, so the test was silently passing
without ever asserting
anything. It is replaced by a real assertion
(`expect(error).toBeInstanceOf(IOServerError)` followed by the two
property checks), which is
strictly stronger and needs no new global.

## `docs-site/` — decision and justification

**Decision: `docs-site/` gets a real parser project
(`docs-site/tsconfig.eslint.json`) and stays
in the lint scope — it is not excluded.**

`docs-site/` is a separate, private Nuxt package (`ioserver-docs@1.0.0`)
that `publish.yml` does
not publish and that commits no `tsconfig.json` at all, so its three
source files failed with
`The file was not found in any of the provided project(s)`. That is a
configuration defect, not a
false positive: excluding them would have silenced three real source
files to avoid writing one
small tsconfig. The project is lint-only (`noEmit`, `types: []`) and
declares the three Nuxt
auto-imports (`defineNuxtConfig`, `defineAppConfig`,
`defineEventHandler`) as ambient globals,
because the Nuxt build injects them without an import.

## Verification — clean room (`rm -rf node_modules` first), Node
22.22.1, pnpm 12.9.1

| Gate | Before (`bbab5ba` / `7b39dc9`) | After | Verdict |
|---|---|---|---|
| `pnpm install --frozen-lockfile` | exit 0 | exit 0 | unchanged |
| `pnpm run lint` | exit **1** — 233 errors | exit **0** — `0 errors, 36
warnings` | fixed |
| `pnpm run build` | exit 0 | exit 0 | unchanged |
| `pnpm test` | exit 0 — 7/7 suites, 66/66 tests | exit 0 — **7/7
suites, 66/66 tests** | unchanged |
| `pnpm run test:coverage` | exit 0 — 7/7 suites, 66/66 tests | exit 0 —
7/7 suites, 66/66 tests; statements 80.4 %, branches 66.04 %, functions
86 %, lines 80.4 % | reported only, **not** wired into CI |

`tests/e2e/chat-app.e2e.test.ts` — the suite that exercises the
rewritten `Function` signatures —
passes. Lint results are not Node-version-specific: the CI failure is
identical on both `22.x` and
`24.x` and the fix contains nothing version-dependent.

## Scope guard

- **No `continue-on-error` anywhere** — `grep -c continue-on-error
.github/workflows/*.yml` → `0` / `0` / `0`.
- `AGENTS.md` untouched (protected, out of scope).
- `package.json` `version` stays **`2.2.1`**; no dependency, lockfile or
Action change.
- **`src/` untouched** — verified byte-identical against
`origin/develop`; none of the 64 errors
were in `src/`, and no `src/` file is in the diff. The 36
`no-explicit-any` warnings in `src/`
  remain as-is.
- No coverage gating, no new lint rules, no new tests.

## Files changed (11)

- `eslint.config.js` — generated-output ignore; ambient globals for
`tests/`+`examples/` and for
`scripts/**/*.js`; parser projects for the `**/*.ts` block and for
`docs-site/`.
- `tsconfig.eslint.json` **(new)** — lint-only, extends `tsconfig.json`,
widens `include` to
  `src` + `tests` + `examples`, `noEmit: true`.
- `docs-site/tsconfig.eslint.json` **(new)** — lint-only project for the
Nuxt docs package.
- `tests/e2e/chat-app.e2e.test.ts`,
`tests/integration/IOServer.integration.test.ts`,
`tests/performance/performance.test.ts`,
`tests/unit/IOServer.static.test.ts`,
  `tests/unit/IOServer.test.ts`, `tests/unit/IOServerError.test.ts`
- `examples/simple.ts`, `examples/chat-app/services/ChatService.ts`

## Rollback

One revert commit. The change is lint configuration plus lint hygiene
only: no published-package
behaviour change, no runtime path in `src/`, no CI workflow edit.
Reverting restores the previous
(failing) lint gate. Both `tsconfig.eslint.json` files are `noEmit`
lint-only projects and are not
referenced by `pnpm run build`, `pnpm test` or `typedoc.json`.

## Merge

Opening only — **do not merge**. The merge and the `v2.2.1` tag/release
are the operator's steps.
@x42en x42en self-assigned this Oct 5, 2026
@x42en x42en added the bug label Oct 5, 2026
@x42en
x42en merged commit acc2b52 into main Oct 5, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant