Review main Merged

80739[TASK] Use TypeScript tsconfig include instead of exclude

Benjamin Franzke CR +2 V +2 Easy +16 −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
    • Christian Kuhn +1
    • Andreas Kienast +1
  • Verified V +2 Done
    • Benjamin Franzke +2
    • Christian Kuhn +1
    • Andreas Kienast +1
    • core-ci +1 CI

Issues 2

Files 8

Review log 68

  1. Benjamin Franzke uploaded patch set 1 08/28/23, 20:28

  2. core-ci voted on patch set 1 V -1 08/28/23, 20:38 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/45943

  3. Benjamin Franzke uploaded patch set 2 V -1 08/28/23, 20:41

  4. core-ci voted on patch set 2 V +1 08/28/23, 20:51 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/45945

  5. Andreas Kienast voted on patch set 2 V +1 CR +1 08/29/23, 07:29

  6. Christian Kuhn commented on patch set 2 V +1 CR +1 08/29/23, 09:13

    looks good to me: applied, used runTests.sh -s clean, then -s buildJavascript to verify.
  7. Benjamin Franzke voted on patch set 2 V +2 CR +2 08/29/23, 10:05

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