Issue Epic New

#111591Enforce type-checked linting for the TypeScript sources

Benjamin Kott 11/25/26, 14:18 updated 11/25/26, 14:33

Description

Goal

The ESLint run over Build/Sources/TypeScript uses the typescript-eslint preset recommended-type-checked, plus typescript-eslint/no-non-null-assertion@, with no rule switched off.

Motivation

The TypeScript build runs with strict, so strictNullChecks is enabled. Yet values typed as any and non-null assertions (!) bypass those checks without a word, for example in backend/user-pass-login.ts:

protected options: any;
// ...
const usernameField: HTMLInputElement = document.querySelector(this.options.usernameField);

querySelector() returns any here instead of HTMLInputElement | null, and the missing null handling is not reported. The type-aware lint setup is already in place (parserOptions.project in Build/eslint.config.mjs), so the rules only have to be enabled and their findings resolved.

Plan

  1. Switch Build/eslint.config.mjs from recommended to recommended-type-checked. Every rule that still has findings is listed with "off", so the lint stays green and all other rules of the preset are enforced from then on. no-non-null-assertion is listed with "off" as well.
  2. Per rule, one task as a subtask of this epic: resolve its findings with real types, not with casts or assertions, and remove its "off" line. Large rules may be split per extension.
  3. The epic is done when no "off" line for these rules remains.

Open findings (typescript-eslint 8.58.1)

Rule Findings
no-non-null-assertion 1948
no-unsafe-member-access 1016
no-floating-promises 971
no-unsafe-assignment 701
no-unsafe-argument 402
no-unsafe-call 390
no-unsafe-return 62
require-await 43
no-misused-promises 42
no-unsafe-enum-comparison 41
only-throw-error 32
no-base-to-string 21
no-redundant-type-constituents 14
prefer-promise-reject-errors 7
await-thenable 7
restrict-template-expressions 2

The findings partly overlap: resolving an any often clears several no-unsafe-* findings at once.

Related: #102560, #111568

Reviews 1

Subtasks 17

History 17

  1. Benjamin Kott changed subtask #111593 11/25/26, 14:25

  2. Benjamin Kott changed subtask #111594 11/25/26, 14:25

  3. Benjamin Kott changed subtask #111595 11/25/26, 14:25

  4. Benjamin Kott changed subtask #111596 11/25/26, 14:25

  5. Benjamin Kott changed subtask #111597 11/25/26, 14:26

  6. Benjamin Kott changed subtask #111598 11/25/26, 14:26

  7. Benjamin Kott changed subtask #111599 11/25/26, 14:26

  8. Benjamin Kott changed subtask #111600 11/25/26, 14:26

  9. Benjamin Kott changed subtask #111601 11/25/26, 14:27

  10. Benjamin Kott changed subtask #111602 11/25/26, 14:27

  11. Benjamin Kott changed subtask #111603 11/25/26, 14:27

  12. Benjamin Kott changed subtask #111604 11/25/26, 14:27

  13. Benjamin Kott changed subtask #111589 11/25/26, 14:28

  14. Benjamin Kott changed subtask #111605 11/25/26, 14:28

  15. Benjamin Kott changed subtask #111606 11/25/26, 14:28

  16. Benjamin Kott changed subtask #111607 11/25/26, 14:28

  17. Benjamin Kott changed subtask #111608 11/25/26, 14:33