fix(lint): clear warnings in version-check scripts#37
Closed
eouzoe wants to merge 1 commit into
Closed
Conversation
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.
修改了什麼
修復
scripts/check-env.mjs與scripts/check-versions.mjs兩個 lint/邏輯警告:check-env.mjs:移除未使用的readdirSyncimport;版本正則[-+][0-9A-Za-z.\-]+改為[-+][0-9A-Za-z.-]+(.與-在字元類別中順序無關,原寫法多一個冗餘跳脫)。check-versions.mjs:[...directDeps.entries()].sort()改為顯式.sort((a, b) => a[0].localeCompare(b[0])),避免對[name, range]陣列做不可靠的預設字典序排序。為什麼要修改
no-unused-vars警告。.sort()對[string, string]陣列用預設比較,行為依賴實作且會對整個 tuple 而非鍵名排序,改為按套件名localeCompare才正確穩定。功能
涉及檔案
scripts/check-env.mjs(2 行)scripts/check-versions.mjs(1 行)影響
check-versions.mjs輸出順序改為依套件名字母排序(更可讀),不影響過期判斷邏輯。exit 0(無過期時)/exit 1(有過期時)。參考文件 / 依據
no-unused-vars;JSArray.prototype.sort預設行為。測試
node --check兩腳本語法通過。bun scripts/check-env.mjs實際執行 exit 0。bun scripts/check-versions.mjs實際執行 exit 0,過期列表正常輸出(sort 修復生效)。