Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI: Skip prompting for eslint plugin with --yes flag #22651

Merged
merged 1 commit into from
May 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 8 additions & 3 deletions code/lib/cli/src/generators/baseGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,13 @@ const hasFrameworkTemplates = (framework?: SupportedFrameworks) =>
export async function baseGenerator(
packageManager: JsPackageManager,
npmOptions: NpmOptions,
{ language, builder = CoreBuilder.Webpack5, pnp, frameworkPreviewParts }: GeneratorOptions,
{
language,
builder = CoreBuilder.Webpack5,
pnp,
frameworkPreviewParts,
yes: skipPrompts,
}: GeneratorOptions,
renderer: SupportedRenderers,
options: FrameworkOptions = defaultOptions,
framework?: SupportedFrameworks
Expand Down Expand Up @@ -358,8 +364,7 @@ export async function baseGenerator(
);

if (hasEslint && !isStorybookPluginInstalled) {
const shouldInstallESLintPlugin = await suggestESLintPlugin();
if (shouldInstallESLintPlugin) {
if (skipPrompts || (await suggestESLintPlugin())) {
Copy link
Contributor

@chakAs3 chakAs3 May 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is almost what i did. to bpass the prompts, however we agreed, we still need to fix this issue.

depsToInstall.push('eslint-plugin-storybook');
await configureEslintPlugin(eslintConfigFile, packageManager);
}
Expand Down
2 changes: 2 additions & 0 deletions code/lib/cli/src/generators/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export type GeneratorOptions = {
linkable: boolean;
pnp: boolean;
frameworkPreviewParts?: FrameworkPreviewParts;
// skip prompting the user
yes: boolean;
};

export interface FrameworkOptions {
Expand Down
1 change: 1 addition & 0 deletions code/lib/cli/src/initiate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const installStorybook = async <Project extends ProjectType>(
builder: options.builder || (await detectBuilder(packageManager, projectType)),
linkable: !!options.linkable,
pnp: pnp || options.usePnp,
yes: options.yes,
};

const runGenerator: () => Promise<any> = async () => {
Expand Down