Proposal: add oxlint, which finds 19 unhandled promises and 170 other likely mistakes on main
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 35/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- javascript, typescript
调研方向
Read the repository's tsconfig.json and package scripts to see how TypeScript checks and npm tasks are configured. The proposal describes adding oxlint dependencies, .oxlintrc.json, a lint script, and fixing 189 findings across 88 files; it also raises separate test type-checking and formatting options. Done means the maintainers choose a scope and its lint or type-check commands work with the proposed findings addressed.
由索引模型根据 Issue 内容生成。
描述
A first run of oxlint's type-aware rules on main (10e316d9) reports 189 findings in 88 files that point at bugs or dead code: 19 promises that are neither awaited nor handled, 43 awaits on values that are not promises, 10 switch statements that miss members of a union, 38 assignments whose value is never read, 68 unused variables, 5 rethrown errors that drop the original error, and 6 duplicate imports. 99 are in src/, 76 in __tests__/ and 14 in scripts/. I spot-checked a few: the unhandled promises are async calls such as this.flush() inside a timer, where a rejection would surface as an unhandled rejection; some of the switch findings will be intentional.
Would you take pull requests that add linting, and possibly formatting? I'm asking before opening any, since it changes how everyone contributes.
What I'd propose, most useful first
- oxlint with only those correctness rules. One PR adds
oxlintandoxlint-tsgolintas dev dependencies, a.oxlintrc.jsonwith just the rules above, annpm run lintscript, and fixes for the 189 findings. It reads your existingtsconfig.json, so the type-aware rules see the same types as the build. It checks the whole repository in a few seconds. - Type-check the tests.
tscalready checkssrc/in strict mode with no errors, but__tests__/isn't type-checked. Running the same settings over it gives 689 errors in 149 test files, including 102 calls with the wrong number of arguments and 50 names that don't exist, which may be tests that drifted from the code. This would be a separate PR with atypecheckscript. - Formatting with oxfmt, only if you want it. With no formatter today, adopting one rewrites most files once: keeping single quotes and 120-column lines, 818 of 930 source files change (about 42,000 lines added and 24,000 removed). That conflicts with every open pull request, so it's only worth doing at a moment you pick, or not at all.
Style-only rules would stay off unless you want them, for example curly (11,128 findings) and the node: import prefix (1,840); both fix themselves with --fix. There's no CI on pull requests today; a small workflow running npm run lint could follow if you'd like one.
I'm happy to do the work and keep each PR to the scope you choose. If you'd rather not add tooling, I can send only the fixes for the bugs it found.
How this was measured
main at 10e316d9; oxlint 1.88.0 with oxlint-tsgolint 7.0.2004; oxfmt 0.73.0; TypeScript 5.9.3 from the lockfile. __tests__/fixtures/ was excluded from every count. The type check used the repository's tsconfig.json with include widened to __tests__/**/* and noEmit.
| Rule | Findings | In src/ |
|---|---|---|
typescript/no-floating-promises |
19 | 5 |
typescript/await-thenable |
43 | 3 |
typescript/switch-exhaustiveness-check |
10 | 9 |
eslint/no-useless-assignment |
38 | 36 |
eslint/no-unused-vars |
68 | 41 |
eslint/preserve-caught-error |
5 | 4 |
import/no-duplicates (plus one repeated type import) |
6 | 1 |
- 主要语言
- C
- 星标
- 73.2k
- 派生
- 4.7k
- 平均合并
- 3 小时 15 分钟
- 30 天内合并 PR
- 576
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
colbymchenry/codegraph 的其他 Issue
-
mcp: a projectPath naming a file inside a project returns isError ("Path is not a directory")可能已有人在做 @maxmilian 于 1 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
colbymchenry/codegraph#2982 ·
维护者通常 1 天内回复
-
mcp: a non-object tools/call arguments crashes the handler and is reported as an internal error to retry可能已有人在做 @kjgggggg 于 1 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
colbymchenry/codegraph#2981 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
colbymchenry/codegraph#2974 ·
维护者通常 1 天内回复
-
search: FTS special characters are deleted, not separated, so leaf(entry) matches nothing可能已有人在做 @kjgggggg 于 1 天前认领。 未关闭
难度 1/5 1 小时以内 新手友好度 88/100
colbymchenry/codegraph#2971 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
colbymchenry/codegraph#2959 · 1 条评论 ·
维护者通常 1 天内回复
查看 colbymchenry/codegraph 的全部 Issue
相似的 Issue
-
Type: Bug
难度 2/5 1-3 小时 新手友好度 76/100
apache/nuttx-apps#3942 ·
维护者通常 1 天内回复
-
Add missing unit tests for IsAdmissionPolicyName and IsCertManagerResourceName可能已有人在做 @a1h8 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
kubernetes-sigs/security-profiles-operator#3644 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 70/100
ly05010419/MacNativeGames#1340 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复