-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Labels
🤓 UXUX improvement for CLI usersUX improvement for CLI users🧩 create-cli🧩 typescript-pluginTypeScript pluginTypeScript plugin
Description
User story
The main advantage of integrating @code-pushup/typescript-plugin is that it allows setting a strict aspirational tsconfig.json, even though the current codebase isn't prepared to meet those standards. This can be set up with 2 tsconfigs - the old config that currently passes compilation, and a derived config with added strict flags for Code PushUp. This facilitates incremental improvements over a longer period of time, with progress being tracked and no blocking build errors.
Real-world example
tsconfig.json
{
"extends": "@strapi/typescript-utils/tsconfigs/server",
"compilerOptions": {
"jsx": "react",
"outDir": "dist",
"rootDir": ".",
"allowJs": true,
"baseUrl": "./",
"target": "esnext",
"skipLibCheck": true,
"strictNullChecks": true,
"noUncheckedIndexedAccess": true
},
"include": ["./"],
"exclude": ["node_modules/", "build/", "dist/", ".cache/", ".tmp/"]
}tsconfig.strict.json
{
"extends": "./tsconfig.json",
"compilerOptions": {
"strict": true,
"noUncheckedIndexedAccess": true
}
}Acceptance criteria
- If the TypeScript plugin is selected in the setup wizard, then there is a further prompt (or CLI argument) to enable additional type-checking flags.
- The user may choose any subset of the Type Checking compiler options.
- The
strict,noUncheckedIndexedAccess, andexactOptionalPropertyTypescompiler options are pre-selected. - The list of available options is filtered. Only options that aren't already enabled are listed.
- If the
strictflag is enabled but other flags within this family are disabled (e.g.,strictNullChecksornoImplicitAny), then these flags are pre-selected. - If the user selects some additional compiler flags, then a new
tsconfig.strict.jsonis created.- The
tsconfig.strict.jsonextends the existing tsconfig (previously selected by the user in TypeScript plugin setup wizard #1256). - The
tsconfig.strict.jsonenables the selected compiler options. - The
@code-pushup/typescript-pluginsetup incode-pushup.config.tsuses the newtsconfig.strict.jsoninstead of the user-provided existing tsconfig.
- The
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
🤓 UXUX improvement for CLI usersUX improvement for CLI users🧩 create-cli🧩 typescript-pluginTypeScript pluginTypeScript plugin