core: decide the left-out forms of globalThis tracking in the globals and timers walk

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

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript
领域
devtools

调研方向

Start with the checkMod limits row in packages/core/README.md and the listed forms in this issue. Decide which forms should be tracked or remain documented limits, recording the choices in an issue comment; then create an issue for every form chosen for tracking. The acceptance criteria also require tests in packages/core/src/mod-check.test.ts for tracked forms and updated limits wording in the core and four consumer READMEs.

由索引模型根据 Issue 内容生成。

描述

enhancement help wanted
Problem

PR #198 makes the globals and timers rules of checkMod follow globalThis through a name declared once from it and never written afterwards, through a rest pattern taken from it, and through a for ... of head over an array literal holding it. Several forms stay untracked and are listed as limits in the checkMod row of packages/core/README.md, so a mod that uses fetch, process or a timer through them is accepted:

  • an alias of an alias (const g = globalThis; const h = g; h.fetch) and a rest taken from an alias;
  • a loop variable (for (const g of [globalThis]) g.fetch);
  • an alias passed or stored elsewhere (register(g), obj.g = g);
  • flow-sensitive reassignment: a name that is assigned, updated or used as a for ... in/for ... of target after its declaration is dropped as an alias, not followed;
  • a parameter default (function f(g = globalThis) { g.fetch }) and an assignment expression (let g; g = globalThis; g.fetch);
  • a for ... of head over a wrapped array literal ([globalThis] as const, ([globalThis]));
  • the TypeScript form import x = <alias>.name through an alias.

Issue #144 also noted two reports of import x = name.member where TypeScript emits no runtime access: namespace process { export interface X {} } followed by import p = process.X;, and an unused import p = process.env;. They are documented as a known limit too.

Proposal

A maintainer decides, per form, whether to track it or keep it as a documented limit. Recommendation: track the alias of an alias and the wrapped array literal (cheap, no false positives), keep escaping aliases, flow-sensitive reassignment and loop variables as documented limits (they need data-flow analysis a syntactic walk cannot do without false positives), and fix the two import x = name.member over-reports by reporting only when the alias is used as a value. Any form that newly rejects mods needs a BREAKING minor changeset for the five packages that run checkMod (@kwitsch/claude-code-plugin-core, @kwitsch/rolldown-plugin-claude-code, @kwitsch/tsdown-preset-claude-code, @kwitsch/claude-code-plugin-cli, @kwitsch/vitest-plugin-claude-code-mod). Split the chosen forms into one issue each once decided.

Design points

No response

Package

core

Scope

packages/core/src/mod-check/scope-walk.ts, packages/core/src/mod-check.ts, packages/core/src/mod-check.test.ts, the Limits wording of packages/core/README.md and the four consumer READMEs. This issue only decides the scope; each form to build becomes its own issue.

Acceptance
  • Each form in the list is either tracked (a test in packages/core/src/mod-check.test.ts covers it) or stays listed as a limit in packages/core/README.md, with the decision recorded in a comment on this issue.
  • An issue exists for every form chosen to be tracked.
Relations
  • Originating PR: #198
主要语言
TypeScript
星标
0
派生
0
平均合并
29 分钟
30 天内合并 PR
138

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

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

kwitsch/claude-code-plugin-tooling 的其他 Issue

查看 kwitsch/claude-code-plugin-tooling 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

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