Skip to content

build: no-undef runs on TypeScript files and breaks if lint config changes #893

Open

Description

@bpowers

The shared ESLint config enables core ESLint's no-undef rule on .ts and .tsx files, because it spreads eslint.configs.recommended.rules into the TypeScript block.
typescript-eslint recommends turning it off for TypeScript: tsc already checks for undefined names, with full type knowledge, and the ESLint rule gives false positives.

Example

Today no-undef reports nothing, but only by accident.
parserOptions.project makes the parser read lib from the tsconfig and register the DOM and ES globals, which keeps the rule quiet.
Removing project from src/diagram produces 383 spurious no-undef errors.
Adding parserOptions.lib: ['es2020', 'dom', 'dom.iterable'] back makes them go away.

Why it matters

Dropping project is the obvious way to speed up lint (#892), and anyone who tries it gets hundreds of unrelated errors with no hint that no-undef is the cause.
The hand-maintained globals lists in the shared config and in src/simlin-serve/web/eslint.config.cjs (window, document, WebSocket, ...) exist only to quiet this rule and will never be complete.

Fix

Set 'no-undef': 'off' in the TypeScript block of eslint.config.shared.js.
Then delete the globals lists, after checking that no remaining core rule reads them.

Pointers

Activity

  1. added
    bug
    hygiene
    javascript
    on Jul 8, 2026
  2. changed the title [-]build: no-undef is enabled on TypeScript files, silently masked by parserOptions.project[/-] [+]build: no-undef runs on TypeScript files and breaks if lint config changes[/+] on Oct 12, 2026
  3. added
    ci
    on Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcihygienejavascript

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions