Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Proposal: add oxlint, which finds 19 unhandled promises and 170 other likely mistakes on main

未关闭
#2,643 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
领域
testing, tooling

调研方向

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

  1. oxlint with only those correctness rules. One PR adds oxlint and oxlint-tsgolint as dev dependencies, a .oxlintrc.json with just the rules above, an npm run lint script, and fixes for the 189 findings. It reads your existing tsconfig.json, so the type-aware rules see the same types as the build. It checks the whole repository in a few seconds.
  2. Type-check the tests. tsc already checks src/ 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 a typecheck script.
  3. 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,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

colbymchenry/codegraph 的其他 Issue

查看 colbymchenry/codegraph 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。