-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Labels
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/eslint-plugin specifically.
Output example
import eslintPlugin from '@code-pushup/eslint-plugin';
import type { CoreConfig } from '@code-pushup/models';
const config: CoreConfig = {
plugins: [
await eslintPlugin({
config: 'eslint.config.js',
patterns: ['src/**/*.ts', 'src/**/*.html'],
}),
],
categories: [
{
slug: 'bug-prevention',
title: 'Bug prevention',
description: 'Lint rules that find **potential bugs** in your code.',
refs: [
{ type: 'group', plugin: 'eslint', slug: 'problems', weight: 1 },
],
},
{
slug: 'code-style',
title: 'Code style',
description:
'Lint rules that promote **good practices** and consistency in your code.',
refs: [
{ type: 'group', plugin: 'eslint', slug: 'suggestions', weight: 1 },
],
},
],
};
export default config;Acceptance criteria
- The ESLint plugin is auto-selected if
eslintis installed or aneslint.config.jsfile exists in the root directory. Otherwise, it is unselected by default. - The user is prompted (or provides a CLI argument) for their ESLint config file.
- Any
eslint.config.jsfile in the project directory is suggested as the default option.
- Any
- The user is prompted (or provides a CLI argument) for the file patterns to be linted.
- The default pattern is
srcif this folder exists in the project directory. Otherwise, the default is.(everything in CWD).
- The default pattern is
- 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, 2 categories are created - Bug prevention (from
problemsgroup) and Code style (fromsuggestionsgroup). - If denied, no categories are created.
- All of the above logic lives in
@code-pushup/eslint-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.
Reactions are currently unavailable