Skip to content

📝 prefer ESM imports in most samples - #496

Merged
ianardee merged 1 commit into
mainfrom
fix-samples
Sep 23, 2026
Merged

ianardee merged 1 commit into
mainfrom
fix-samples

Conversation

@ianardee

Copy link
Copy Markdown
Collaborator

Description

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Requires a change to the official Guide documentation.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 High severity

Open (17)
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";
@ianardee
ianardee merged commit a81f738 into main Sep 23, 2026
24 checks passed
@ianardee
ianardee deleted the fix-samples branch September 23, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants