-
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
Our setup wizard should be able to configure a basic working version of each of our official plugins. Each plugin may prompt for its own specific configuration options and infer smart defaults from the user's repo. The resulting configuration code adds the plugin to the user's config and sets up some basic categories.
This issue is about @code-pushup/typescript-plugin specifically.
Output example
import typescriptPlugin from '@code-pushup/typescript-plugin';
import type { CoreConfig } from '@code-pushup/models';
const config: CoreConfig = {
plugins: [
typescriptPlugin({ tsconfig: 'tsconfig.json' }),
],
categories: [
{
slug: 'bug-prevention',
title: 'Bug prevention',
description: 'Type checks that find **potential bugs** in your code.',
refs: [
{ type: 'group', plugin: 'typescript', slug: 'problems', weight: 1 },
],
},
],
};
export default config;Category merging
import eslintPlugin from '@code-pushup/eslint-plugin';
import typescriptPlugin from '@code-pushup/typescript-plugin';
import type { CoreConfig } from '@code-pushup/models';
const config: CoreConfig = {
plugins: [
await eslintPlugin(),
typescriptPlugin(),
],
categories: [
{
slug: 'bug-prevention',
title: 'Bug prevention',
description: 'Type checks and lint rules that find **potential bugs** in your code.',
refs: [
{ type: 'group', plugin: 'typescript', slug: 'problems', weight: 1 },
{ type: 'group', plugin: 'eslint', slug: 'problems', weight: 1 },
],
},
],
};
export default config;Acceptance criteria
- The TypeScript plugin is auto-selected if a
tsconfig.jsonortsconfig.base.jsonfile exists in the root directory. Otherwise, it is unselected by default. - The user is prompted (or provides a CLI argument) for their TypeScript config file.
- Any
tsconfig.jsonfile in the project directory is suggested as the default option.
- Any
- The user should confirm (via prompt or CLI argument) if they want to also generate basic categories.
- The default answer is yes (create the categories).
- If confirmed, 1 category is created - Bug prevention (from
problemsgroup). - If denied, no categories are created.
- All of the above logic lives in
@code-pushup/typescript-plugin. The core of the setup wizard in@code-pushup/create-cliorchestrates plugin selection and generation, but doesn't know any specifics about individual plugins. - In general, it's possible for plugins to create the same category. This needs to be handled by the core logic in
@code-pushup/create-cli- the refs are merged into 1 category.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
🤓 UXUX improvement for CLI usersUX improvement for CLI users🧩 create-cli🧩 typescript-pluginTypeScript pluginTypeScript plugin