Skip to content

fix(map): resolve GeoJSON namespace so release pipeline typechecks on fresh install#1246

Merged
ding113 merged 1 commit into
mainfrom
dev
Jun 4, 2026
Merged

fix(map): resolve GeoJSON namespace so release pipeline typechecks on fresh install#1246
ding113 merged 1 commit into
mainfrom
dev

Conversation

@ding113

@ding113 ding113 commented Jun 4, 2026

Copy link
Copy Markdown
Owner

问题

Release 流水线(Auto Release Pipeline)在 Install dependencies, type check, and format code 步骤失败:

src/components/ui/map.tsx(1292,37): error TS2503: Cannot find namespace 'GeoJSON'.
... (共 12 处)

失败 run: https://github.com/ding113/claude-code-hub/actions/runs/26948118648/job/79506098306

根因

  • src/components/ui/map.tsx 使用了全局 GeoJSON 命名空间(GeoJSON.Point / GeoJSON.Feature / GeoJSON.FeatureCollection / GeoJSON.GeoJsonProperties)。
  • 该全局命名空间仅来自 @types/geojson,而它只是 maplibre-gl间接依赖(通过 export as namespace GeoJSON 提供 UMD 全局)。
  • 本仓库 bun.lock.gitignore 忽略、未提交,因此 CI 每次都是全新的非冻结 bun install。在 maplibre-gl 由 5.23 升到 5.24 等依赖变动后,全新安装下 tsgo(@typescript/native-preview)不再稳定地把 @types/geojson 的 UMD 全局自动纳入,导致找不到 GeoJSON 命名空间。
  • 本地已复现:删除 node_modules+lockfile 全新 bun install 后,bun run typecheck 报出与 CI 完全一致的 12 处错误。

修复

  1. src/components/ui/map.tsx:新增显式 import type * as GeoJSON from "geojson";,让 GeoJSON.* 通过模块解析获取,不再依赖会被破坏的 ambient UMD 全局。无需改动 12 处使用点。
  2. package.json:将 @types/geojson 声明为直接 devDependency,保证 "geojson" specifier 在全新安装下始终可解析(不再依赖间接依赖的提升)。

本地验证(与 CI 相同条件:删 node_modules + 无 lockfile 全新安装)

  • bun run typecheck (修复前复现 12 处报错,修复后通过)
  • bun run build Compiled successfully
  • bun run test 702 files / 6321 tests passed,13 skipped
  • bun run lint
  • bun run format:check

Related


Description enhanced by Claude AI

The GeoJSON global namespace used in map.tsx came only from @types/geojson,
a transitive dep of maplibre-gl. Since bun.lock is gitignored, CI runs a fresh
non-frozen install where the ambient UMD global is no longer reliably picked up
by tsgo, breaking 'Cannot find namespace GeoJSON' on the release pipeline.

Add an explicit 'import type * as GeoJSON from "geojson"' so the namespace
resolves via module resolution instead of the ambient global, and declare
@types/geojson as a direct devDependency so the specifier always resolves.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b7946d3a-2135-48b7-ba02-2b375d9fc6ef

📥 Commits

Reviewing files that changed from the base of the PR and between d575b9a and 3e9c94a.

📒 Files selected for processing (2)
  • package.json
  • src/components/ui/map.tsx

📝 Walkthrough

走查

package.json中新增GeoJSON类型定义包的开发依赖,并在map组件中导入GeoJSON类型以支持类型注解。

改动

GeoJSON类型支持

Layer / File(s) 摘要
GeoJSON类型定义与导入
package.jsonsrc/components/ui/map.tsx
devDependencies中添加@types/geojson包,map组件导入GeoJSON命名空间类型以支持文件内的GeoJSON类型引用。

代码审查工作量估计

🎯 1 (Trivial) | ⏱️ ~3 分钟

可能相关的PR

  • ding113/claude-code-hub#1098:两个PR都涉及src/components/ui/map.tsx中的GeoJSON相关代码——本PR添加GeoJSON类型导入,而该PR重构MapClusterLayer和GeoJSON数据源处理,改动位置相邻。
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed Pull request title accurately and specifically describes the main change: fixing TypeScript namespace resolution for GeoJSON in the map component to ensure CI/CD type checking passes on fresh installs.
Description check ✅ Passed Pull request description is comprehensive and directly related to the changeset, detailing the problem, root cause analysis, implemented fixes, and local validation results.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds the @types/geojson dependency to package.json and imports the GeoJSON type in src/components/ui/map.tsx. There are no review comments, and I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@github-actions github-actions Bot added bug Something isn't working area:UI labels Jun 4, 2026
@ding113 ding113 merged commit 1726964 into main Jun 4, 2026
19 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Claude Code Hub Roadmap Jun 4, 2026
@github-actions github-actions Bot added the size/XS Extra Small PR (< 50 lines) label Jun 4, 2026
@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

🧪 测试结果

测试类型 状态
代码质量
单元测试
集成测试
API 测试

总体结果: ✅ 所有测试通过

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

No significant issues identified in this PR.

PR Size: XS

  • Lines changed: 2
  • Files changed: 2

Review Coverage

  • Logic and correctness - Clean
  • Security (OWASP Top 10) - Clean
  • Error handling - Clean
  • Type safety - Clean
  • Documentation accuracy - Clean
  • Test coverage - Adequate
  • Code clarity - Good

Automated review by Codex AI

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed PR #1246 and posted the GitHub review summary.

  • Applied the size/XS label.
  • No validated issues met the reporting threshold after checking the diff and surrounding context.
  • No inline comments were added because I didn’t find any high-confidence defects in the changed lines.

If you want, I can also help draft a small follow-up test for the GeoJSON import path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:UI bug Something isn't working size/XS Extra Small PR (< 50 lines)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant