fix(lint): providers.ts 模型列表正则去掉多余转义(修 CI 红) - #22
Merged
Conversation
The regex /(?:supported|available)\s+models?\s*[:\-]?\s*([^\n.]{5,})/i (added
in 44a03d9) used \- inside a character class, which eslint no-useless-escape
flags. \- is unnecessary there (a trailing - in [] is literal). CI failed on
main after merging #21 because that commit was the first to run the full
lint pipeline over 44a03d9's change. Change [:\-]? -> [:-]? — identical
match behavior (optional : or -), just no useless escape.
Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
main 上的 CI 全红(3 个平台全 fail),挂在一条 lint 错:
根因
44a03d9(hostProvidesPlanStore + provider error hints)在providers.ts:218引入了:\-在字符组里不必要(-在末尾/开头本就是字面量)。no-useless-escape规则报它。为什么之前没挂
44a03d9是直接 push 到 main 的(没走 PR/没触发 CI),所以这条 lint 错从未被 CI 抓过。PR #21(完成门死锁修复)merge 时触发的新 CI 是第一个完整跑44a03d9+ lint 的,于是挂在 #21 的 merge commit 上 —— 但代码错不在 #21,在44a03d9。Fix
[:\-]?→[:-]?(去\)。正则匹配行为完全不变([:-]?和[:\-]?都匹配可选的:或-),只是去掉多余转义。已验证:三个测试用例(
Supported models: [a,b]/Available models- gpt-4/supported model foo)新旧正则匹配结果一模一样;lint EXIT=0;build ok。影响
修这个 main 才能恢复 CI 绿(否则后续任何 PR 合进 main 都被这条拖红)。一行修。
🤖 Generated with Claude Code