Review 12.4 Merged

80746[TASK] Use TypeScript tsconfig include instead of exclude

Benjamin Franzke CR +2 V +2 Easy +17 −4 updated 08/29/23, 10:23

Commit message

This helps to prevent hard-to-discover build failures, that only
happen on clean installs (e.g. CI).
This is because TypeScript will by default scan the entire source
dictionary (Build/ in our case) for possible includes.
We previously excluded /Build/composer in #95046, but it is actually
much better to explicitly include the actually used source paths
to also exclude build output (Build/JavaScript/) from being
reinterpreted by subsequential eslint or tsc compile runs.

Note that we also refactor the types/ directory in order to
be a folder that conforms to the @types/* packages conventions,
by being actually usable in the compilerOptions.types property.

Note that our custom global type definitions (types/) were previously
implicitly loaded as globally available sourcepaths.
With the new `include` option we could add them back, but then we
wouldn't notice if we do not add proper index.d.ts files (like we
did until now). Therefore index.d.ts files are added in here.

Now, with TypeScript being "clean", we need a another small
adjustment in order for eslint to still being able to lint
our types/ folder. Therefore tsconfig.json is extended to
include the types directory. See [1] for more information on
why eslint needs that.

[1] https://typescript-eslint.io/linting/troubleshooting/#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file

Review

  • Code review CR +2 Done
    • Benjamin Franzke +2
  • Verified V +2 Done
    • Benjamin Franzke +2
    • core-ci +1 CI

Issues 2

Files 9

Review log 34

  1. Benjamin Franzke uploaded patch set 1 08/29/23, 10:02

  2. Benjamin Franzke uploaded patch set 2 08/29/23, 10:08

    Copied Votes: * Code-Review+2 (copy condition: "changekind:NO_CHANGE OR is:MIN") * Verified+2 (copy condition: "changekind:NO_CHANGE")
  3. core-ci voted on patch set 2 V +1 08/29/23, 10:21 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/45971

  4. Benjamin Franzke merged patch set 3 08/29/23, 10:23