Skip to content

fix(cli): reject file-only options with --stdin - #170

Merged
luojiyin1987 merged 1 commit into
masterfrom
fix/reject-file-only-options-with-stdin
Aug 22, 2026
Merged

fix(cli): reject file-only options with --stdin#170
luojiyin1987 merged 1 commit into
masterfrom
fix/reject-file-only-options-with-stdin

Conversation

@luojiyin1987

Copy link
Copy Markdown
Contributor

Closes #169

改动

--threads--max-file-size--stdin 同时出现时拒绝,不再静默接受无效参数:

单个冲突:

[lint-md] --threads cannot be used with --stdin.

两个同时出现,一次聚合:

[lint-md] The following options cannot be used with --stdin:
--threads
--max-file-size

细节:

  • 复用 CONFLICTING_INPUT 错误码,检查放在 action 前段(配置加载、stdin 读取之前),冲突命令零副作用
  • --threads abc 现在报冲突而不是 INVALID_THREADS——参数根本不会使用,值校验已无意义
  • stdin 下仍合法:--config--fix--dev--suppress-warnings

测试(新增 3 个,更新 2 个)

新增:

  • --stdin --threads abc → 冲突消息(且断言不是 INVALID_THREADS)
  • --stdin --max-file-size 5mb → 单项冲突
  • 两个选项同时出现 → 聚合输出

更新 threads-validation.spec.ts 两个用例:它们锁定的正是本 PR 有意移除的旧契约(stdin 下走数值校验 / auto 跳过校验)。

验证

检查项 结果
npm run typecheck 通过
npm test -- --runInBand 25 suites / 217 tests 通过
手动:单项 / 聚合 / 合法组合(--stdin --fix --suppress-warnings exit 1 / 1 / 0,符合预期

@luojiyin1987
luojiyin1987 merged commit 0d1d5af into master Aug 22, 2026
6 checks passed
@luojiyin1987
luojiyin1987 deleted the fix/reject-file-only-options-with-stdin branch August 22, 2026 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(cli): reject file-only options with --stdin

1 participant