Initial checklist
Thanks for this great tool! I ran into an issue with --ignore-pattern and wanted to share both the problem and two possible approaches to fix it.
Problem
--ignore-pattern values are parsed through commaParse (comma-separated-tokens), which splits on commas. This makes it impossible to use gitignore brace expansion like {a,b} in patterns.
Reproduction
remark . --ignore-pattern "**/{src,dist}/examples/**"
Expected: ignores src/examples/ and dist/examples/ under all directories.
Actual: nothing is ignored, because commaParse splits the value into two invalid patterns:
"**/{src" ← broken
"dist}/examples/**" ← broken
Current solutions
Root cause
lib/parse-argv.js line 187-189:
const ignorePattern =
parseIfString(joinIfArray(undefinedIfBoolean(config['ignore-pattern']))) ||
[]
The parseIfString → commaParse roundtrip exists to support --ignore-pattern "a,b" syntax. But --ignore-pattern already supports repeated flags:
--ignore-pattern a --ignore-pattern b # already works
The comma-split is redundant and actively breaks valid gitignore syntax.
Two possible fixes
Fix A: unified-args (upstream)
Change one line in lib/parse-argv.js:
const ignorePattern = toArray(undefinedIfBoolean(config['ignore-pattern'])) || []
toArray is already in the file. Single values → [value], repeated flags → [value1, value2], no comma split. This fixes it at the root for all downstream CLI tools (remark-cli, retext-cli, rehype-cli). But it's technically breaking for anyone currently relying on --ignore-pattern "a,b" semantics.
Fix B: remark-cli (downstream workaround)
Pre-expand brace patterns in cli.js before handing off to unified-args:
// See remarkjs/remark for the full implementation
// --ignore-pattern "**/{a,b}/**"
// → expands to:
// --ignore-pattern "**/a/**" --ignore-pattern "**/b/**"
No breaking change, no dependency on upstream. But only fixes remark-cli, not other tools that use unified-args.
Proposed solutions
I prefer Fix A:
-
Fixes the root cause, not the symptom — the parser shouldn't treat commas as delimiters in values where commas are valid gitignore syntax.
-
The impact is minimal — --ignore-pattern a --ignore-pattern b is already the established idiom (ESLint, Prettier, etc.), and anyone who happens to use the comma form would get a clean break rather than silently broken brace expansion.
-
Only unified-args needs to change; otherwise every downstream CLI has to carry its own workaround.
Initial checklist
Problem
--ignore-patternvalues are parsed throughcommaParse(comma-separated-tokens), which splits on commas. This makes it impossible to use gitignore brace expansion like{a,b}in patterns.Reproduction
Expected: ignores
src/examples/anddist/examples/under all directories.Actual: nothing is ignored, because
commaParsesplits the value into two invalid patterns:Current solutions
Root cause
lib/parse-argv.jsline 187-189:The
parseIfString→commaParseroundtrip exists to support--ignore-pattern "a,b"syntax. But--ignore-patternalready supports repeated flags:--ignore-pattern a --ignore-pattern b # already worksThe comma-split is redundant and actively breaks valid gitignore syntax.
Two possible fixes
Fix A:
unified-args(upstream)Change one line in
lib/parse-argv.js:toArrayis already in the file. Single values →[value], repeated flags →[value1, value2], no comma split. This fixes it at the root for all downstream CLI tools (remark-cli, retext-cli, rehype-cli). But it's technically breaking for anyone currently relying on--ignore-pattern "a,b"semantics.Fix B:
remark-cli(downstream workaround)Pre-expand brace patterns in
cli.jsbefore handing off tounified-args:No breaking change, no dependency on upstream. But only fixes remark-cli, not other tools that use
unified-args.Proposed solutions
I prefer Fix A:
Fixes the root cause, not the symptom — the parser shouldn't treat commas as delimiters in values where commas are valid gitignore syntax.
The impact is minimal —
--ignore-pattern a --ignore-pattern bis already the established idiom (ESLint, Prettier, etc.), and anyone who happens to use the comma form would get a clean break rather than silently broken brace expansion.Only
unified-argsneeds to change; otherwise every downstream CLI has to carry its own workaround.