📝 prefer ESM imports in most samples - #496
Merged
Merged
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Multiple ESM samples are executed by a CommonJS harness and will fail with syntax errors.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 17
Open (17)
ESM import syntax breaks CommonJS sample harness · New ESM import syntax breaks CommonJS sample harness · New ESM import syntax breaks CommonJS sample harness · New ESM import syntax breaks CommonJS sample harness · New ESM import syntax breaks CommonJS sample harness · New ESM import syntax breaks CommonJS sample harness · New ESM import syntax breaks CommonJS sample harness · New ESM import syntax breaks CommonJS sample harness · New ESM import syntax breaks CommonJS sample harness · New ESM import syntax breaks CommonJS sample harness · New ESM import syntax breaks CommonJS sample harness · New ESM import syntax breaks CommonJS sample harness · New ESM import syntax breaks CommonJS sample harness · New ESM import syntax breaks CommonJS sample harness · New ESM import syntax breaks CommonJS sample harness · New ESM import syntax breaks CommonJS sample harness · New ESM import syntax breaks CommonJS sample harness · New
What changed in this PR
Updates documentation samples to prefer ESM imports and renames V2 test input variables for clarity.
Changes:
- Makes ESM imports primary in most samples.
- Retains or clarifies CommonJS alternatives in selected samples.
- Renames test inputs to
inputSource.
| File | Summary |
|---|---|
tests/v2/client/foreignDispatcher.integration.ts |
Renames input variables. |
tests/v2/client/client.spec.ts |
Renames test input variables. |
tests/v2/client/client.integration.ts |
Renames integration-test inputs. |
docs/code_samples/workflow_polling.txt |
Prefers ESM imports. |
docs/code_samples/workflow_ots_rag.txt |
Prefers ESM imports. |
docs/code_samples/workflow_execution.txt |
Prefers ESM imports. |
docs/code_samples/v2_split.txt |
Prefers ESM imports. |
docs/code_samples/v2_ocr.txt |
Prefers ESM imports. |
docs/code_samples/v2_extraction.txt |
Prefers ESM imports. |
docs/code_samples/v2_crop.txt |
Prefers ESM imports. |
docs/code_samples/v2_classification.txt |
Prefers ESM imports. |
docs/code_samples/resume_v1_async.txt |
Critical: ESM syntax breaks the CommonJS sample harness. |
docs/code_samples/passport_v1.txt |
Critical: ESM syntax breaks the CommonJS sample harness. |
docs/code_samples/multi_receipts_detector_v1.txt |
Critical: ESM syntax breaks the CommonJS sample harness. |
docs/code_samples/invoices_v4.txt |
Reorders module guidance. |
docs/code_samples/invoices_v4_async.txt |
Critical: ESM syntax breaks the CommonJS sample harness. |
docs/code_samples/invoice_splitter_v1_async.txt |
Critical: ESM syntax breaks the CommonJS sample harness. |
docs/code_samples/international_id_v2_async.txt |
Critical: ESM syntax breaks the CommonJS sample harness. |
docs/code_samples/idcard_fr_v2.txt |
Critical: ESM syntax breaks the CommonJS sample harness. |
docs/code_samples/financial_document_v1.txt |
Reorders module guidance. |
docs/code_samples/financial_document_v1_async.txt |
Critical: ESM syntax breaks the CommonJS sample harness. |
docs/code_samples/expense_receipts_v5.txt |
Reorders module guidance. |
docs/code_samples/expense_receipts_v5_async.txt |
Critical: ESM syntax breaks the CommonJS sample harness. |
docs/code_samples/driver_license_v1_async.txt |
Critical: ESM syntax breaks the CommonJS sample harness. |
docs/code_samples/default.txt |
Critical: ESM syntax breaks the CommonJS sample harness. |
docs/code_samples/default_async.txt |
Critical: ESM syntax breaks the CommonJS sample harness. |
docs/code_samples/cropper_v1.txt |
Critical: ESM syntax breaks the CommonJS sample harness. |
docs/code_samples/carte_grise_v1.txt |
Critical: ESM syntax breaks the CommonJS sample harness. |
docs/code_samples/barcode_reader_v1.txt |
Critical: ESM syntax breaks the CommonJS sample harness. |
docs/code_samples/bank_check_v1.txt |
Critical: ESM syntax breaks the CommonJS sample harness. |
docs/code_samples/bank_account_details_v2.txt |
Critical: ESM syntax breaks the CommonJS sample harness. |
docs/code_samples/bank_account_details_v1.txt |
Reorders module guidance. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| // for TS or modules: | ||
| // import * as mindee from "mindee"; | ||
| // ESM or TypeScript (Recommended) | ||
| import * as mindee from "mindee"; |
| // for TS or modules: | ||
| // import * as mindee from "mindee"; | ||
| // ESM or TypeScript (Recommended) | ||
| import * as mindee from "mindee"; |
| // for TS or modules: | ||
| // import * as mindee from "mindee"; | ||
| // ESM or TypeScript (Recommended) | ||
| import * as mindee from "mindee"; |
| // for TS or modules: | ||
| // import * as mindee from "mindee"; | ||
| // ESM or TypeScript (Recommended) | ||
| import * as mindee from "mindee"; |
| // for TS or modules: | ||
| // import * as mindee from "mindee"; | ||
| // ESM or TypeScript (Recommended) | ||
| import * as mindee from "mindee"; |
| // for TS or modules: | ||
| // import * as mindee from "mindee"; | ||
| // ESM or TypeScript (Recommended) | ||
| import * as mindee from "mindee"; |
| // for TS or modules: | ||
| // import * as mindee from "mindee"; | ||
| // ESM or TypeScript (Recommended) | ||
| import * as mindee from "mindee"; |
| // for TS or modules: | ||
| // import * as mindee from "mindee"; | ||
| // ESM or TypeScript (Recommended) | ||
| import * as mindee from "mindee"; |
| // for TS or modules: | ||
| // import * as mindee from "mindee"; | ||
| // ESM or TypeScript (Recommended) | ||
| import * as mindee from "mindee"; |
| // for TS or modules: | ||
| // import * as mindee from "mindee"; | ||
| // ESM or TypeScript (Recommended) | ||
| import * as mindee from "mindee"; |
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.

Description
Types of changes