From b0e0de27f45845c46d9c93b01df6b9a007d2d6c5 Mon Sep 17 00:00:00 2001 From: "yuxuan.weng" Date: Fri, 23 Oct 2026 14:26:24 +0800 Subject: [PATCH] docs: explain CLI ignore glob alternatives ref:0 --- .../src/app/docs/reference/cli/page.mdx | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/packages/website/src/app/docs/reference/cli/page.mdx b/packages/website/src/app/docs/reference/cli/page.mdx index b64ad292f34..46805d26aae 100644 --- a/packages/website/src/app/docs/reference/cli/page.mdx +++ b/packages/website/src/app/docs/reference/cli/page.mdx @@ -15,7 +15,7 @@ Specify at least one glob pattern which will be used to search for files. react-docgen ./src/components/Button.tsx # All .ts or .tsx files in src/ or any .js files in components/ -react-docgen "src/**/*.ts?(x) components/**/*.js" +react-docgen "src/**/*.ts?(x)" "components/**/*.js" ``` If you want to know more about glob patterns, check the documentation of @@ -91,7 +91,24 @@ Displays the help for the command with the current default values. **Default**: `["**/node_modules/**", "**/__tests__/**", "**/__mocks__/**"]` Specify glob patterns of path or files, which should not be used to search for -react components. +react components. Pass a comma-separated list or repeat the option: + +```shell filename="Examples" +react-docgen "src/**/*.tsx" --ignore "**/*.test.tsx,**/*.stories.tsx" + +react-docgen "src/**/*.tsx" --ignore "**/*.test.tsx" --ignore "**/*.stories.tsx" +``` + +Commas are always treated as separators, even inside a quoted pattern. For +example, `--ignore "**/*.{test,stories}.tsx"` is split into two incomplete +patterns. Use the separate patterns above or an extglob without commas: + +```shell filename="Example" +react-docgen "src/**/*.tsx" --ignore "**/*.@(test|stories).tsx" +``` + +Quote glob patterns so the shell passes them to the CLI without expanding them. +The comma separator applies to `--ignore` values, not positional glob arguments. ### `--importer `