Repository navigation
fix(lib): unify tombi-lib and wasm-lib interfaces - #2242
Merged
Merged
Conversation
- Python: export `Position`/`Range` from `tombi_lib` (they were only declared in the stub), add `ConfigFile`/`Options` TypedDicts, and type `Diagnostic.level` as `Literal["error", "warning"]`. - JS (Node.js/wasm): rename `Diagnostic.source_file` to `sourceFile`. - wasm-lib: add the `ConfigFile` type shared with `@tombi-toml/lib`, and keep `Config` as a deprecated alias. BREAKING CHANGE: `Diagnostic.source_file` is now `sourceFile` in `@tombi-toml/wasm-lib` / `tombi-wasm-lib`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
各言語の実装・型定義・実行時テストが整合しており、未解決の問題は確認されませんでした。
Review effort: Balanced
Findings: None
What changed in this PR
Python・Node.js・WASM の公開 API を統一する変更です。
Changes:
- Python の型・公開エクスポートを整備
- JS の
Diagnostic.sourceFileを camelCase に統一 - WASM の設定型を Node.js API と整合
| File | Description |
|---|---|
crates/tombi-diagnostic/src/lib.rs |
WASM 診断を camelCase で直列化 |
rust/tombi-lib-node/src/lib.rs |
Node.js の診断フィールド名を更新 |
rust/tombi-wasm/tests/lib-smoke.mjs |
WASM の sourceFile を検証 |
typescript/@tombi-toml/lib/binding.d.ts |
生成済み Node.js 型定義を更新 |
typescript/@tombi-toml/lib/tests/smoke.test.mjs |
Node.js の新フィールド名を検証 |
typescript/@tombi-toml/wasm-lib/types.d.ts |
診断・設定型を統一 |
python/tombi-lib/src/tombi_lib/_options.py |
Python の設定用 TypedDict を追加 |
python/tombi-lib/src/tombi_lib/__init__.py |
新しい公開型を実行時に再エクスポート |
python/tombi-lib/src/tombi_lib/__init__.pyi |
Python スタブを精密化 |
python/tombi-lib/tests/tombi_lib/test_lint.py |
Position・Range の公開を検証 |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
ya7010
added a commit
that referenced
this pull request
Sep 29, 2026
* fix(wasm-lib): keep Diagnostic.source_file as a deprecated alias #2242 renamed `Diagnostic.source_file` to `sourceFile`, but `@tombi-toml/wasm-lib` / `tombi-wasm-lib` have shipped `source_file` since #2105. Serialize both keys with the same value and mark `source_file` as `@deprecated`, like `TombiWasmError` and `Config`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(wasm): split lint out of formatter.rs (#2244) `formatter.rs` defined both `format` and `lint`. Move `lint` to `linter.rs`, and the JS <-> `tombi_lib` conversions both use (`serialize`, `tombi_error`, `deserialize_options`) to `convert.rs`. No behavior change. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
Aligns the public interfaces of the Python/Node.js
tombi-liband@tombi-toml/wasm-lib, which share therust/tombi-libcore. The sync/async naming (formatis sync in Python, a Promise in JS) is left as-is, since each follows its language's convention.Position/Rangeare now importable fromtombi_lib. The stub declared them, but__init__.pydidn't re-export them, sofrom tombi_lib import Positionfailed at runtime.ConfigFile/OptionsTypedDicts in_options.py, re-exported at runtime, and used them for theoptionsargument.Diagnostic.levelis now typed asLiteral["error", "warning"].Diagnostic.source_fileis renamed tosourceFileto follow the JS naming convention. It is stillnull, not missing, when there is no source file.ConfigFileinterface shared with@tombi-toml/lib, and typedOptions.configasstring | ConfigFile.Configstays as a@deprecatedalias.Breaking change
Diagnostic.source_filebecomessourceFilein@tombi-toml/wasm-lib/tombi-wasm-lib, which shippedsource_filein 1.5.8.@tombi-toml/libis unreleased, so it is unaffected.Validation
pnpm --dir typescript/@tombi-toml/lib build && pnpm --dir typescript/@tombi-toml/lib test(8 pass; regeneratedbinding.d.tsmatches the committed file)pnpm --dir typescript/@tombi-toml/wasm-lib build && pnpm --dir typescript/@tombi-toml/wasm-lib testuv run --frozen --package tombi-lib pytest python/tombi-lib/tests(8 passed)ruff format --check/ruff check --no-fixcargo fmt --all --check,cargo clippy -p tombi-lib-node -p tombi-diagnostic -p tombi-lib -p tombi-lib-python --features tombi-diagnostic/wasm -- -D warningstsc --strict --noEmitagainst both packages'.d.ts🤖 Generated with Claude Code