Skip to content
Snippets Groups Projects
Commit e356691b authored by Benjamin Franzke's avatar Benjamin Franzke
Browse files

[TASK] Use TypeScript tsconfig include instead of exclude

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

Resolves: #101782
Related: #95046
Releases: main, 12.4
Change-Id: I3ab8b874192d25470bbd5e71cc5d99e853259f89
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/80746


Reviewed-by: default avatarBenjamin Franzke <ben@bnf.dev>
Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarBenjamin Franzke <ben@bnf.dev>
parent f8031744
Branches
Tags
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment