docs icon indicating copy to clipboard operation
docs copied to clipboard

Add command options for avoiding vscode error checking problems

Open jy-joung-bitor opened this issue 2 months ago β€’ 2 comments

I encountered a bunch of errors from vscode because the default configurations don't match to esm. (see: prisma/prisma#28279) This changes can:

  • Set type option in package.json file to module. Ref: https://docs.npmjs.com/cli/v11/commands/npm-init#init-type
  • Set compilerOptions.types in tsconfig.json to ["node"] for accepting node:-prefixed modules. Ref: https://www.typescriptlang.org/docs/handbook/compiler-options.html

Summary by CodeRabbit

  • Documentation
    • Updated multiple getting-started guides to initialize new projects with ES module support by default (uses npm init --init-type=module -y).
    • Clarified TypeScript setup to include Node.js type definitions when initializing the TS config (uses npx tsc --init --types node).

jy-joung-bitor avatar Oct 19 '25 14:10 jy-joung-bitor

Walkthrough

Documentation updates across multiple getting-started guides to initialize Node.js projects with ES module support by changing npm init -y to npm init --init-type=module -y, and to include Node.js type definitions in TypeScript setup by changing npx tsc --init to npx tsc --init --types=node.

Changes

Cohort / File(s) Change Summary
Quickstart (SQLite)
content/100-getting-started/01-quickstart-sqlite.mdx
Replaced npm init -y with npm init --init-type=module -y
Relational DBs β€” Node (multiple DBs)
content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-node-*.mdx
Replaced npm init -y with npm init --init-type=module -y across Node guides (Postgres, MySQL, SQL Server, CockroachDB, PlanetScale)
Relational DBs β€” TypeScript (multiple DBs)
content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-*.mdx
Replaced npm init -y with npm init --init-type=module -y and changed npx tsc --init to npx tsc --init --types=node across TypeScript guides
MongoDB β€” Node
content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb-node-mongodb.mdx, content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb/125-introspection-node-mongodb.mdx
Replaced npm init -y with npm init --init-type=module -y
MongoDB β€” TypeScript
content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb-typescript-mongodb.mdx, content/100-getting-started/02-setup-prisma/200-add-to-existing-project/120-mongodb/125-introspection-typescript-mongodb.mdx
Replaced npm init -y with npm init --init-type=module -y and npx tsc --init with npx tsc --init --types=node
Postgres CLI Guide
content/100-getting-started/03-prisma-postgres/100-from-the-cli.mdx
Replaced npm init -y with npm init --init-type=module -y and npx tsc --init with npx tsc --init --types=node

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Pre-merge checks

βœ… Passed checks (3 passed)
Check name Status Explanation
Description Check βœ… Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check βœ… Passed The PR title "Add command options for avoiding vscode error checking problems" directly describes the main change in the pull request. The changeset updates multiple documentation files to add command-line options (--init-type=module for npm and --types node for TypeScript) that configure ES module support and Node.js type definitions to resolve VS Code error checking issues. The title accurately captures both the action (adding command options) and the purpose (avoiding VS Code errors), making it clear and relevant to a reviewer scanning the history.
Docstring Coverage βœ… Passed No functions found in the changes. Docstring coverage check skipped.

πŸ“œ Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 32d20502c99a97a57e27a118551ae3d107bdaf97 and 101f6152a2d1bf940423a6f5ceba928ae8520899.

β›” Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
πŸ“’ Files selected for processing (9)
  • content/100-getting-started/01-quickstart-sqlite.mdx (2 hunks)
  • content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-cockroachdb.mdx (2 hunks)
  • content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-mysql.mdx (2 hunks)
  • content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-planetscale.mdx (2 hunks)
  • content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-postgresql.mdx (2 hunks)
  • content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-prismaPostgres.mdx (2 hunks)
  • content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-sqlserver.mdx (2 hunks)
  • content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb-typescript-mongodb.mdx (2 hunks)
  • content/100-getting-started/03-prisma-postgres/100-from-the-cli.mdx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-mysql.mdx
  • content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-planetscale.mdx
  • content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-postgresql.mdx
  • content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-cockroachdb.mdx
  • content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-prismaPostgres.mdx
🧰 Additional context used
🧠 Learnings (4)
πŸ““ Common learnings
Learnt from: jy-joung-bitor
PR: prisma/docs#0
File: :0-0
Timestamp: 2025-10-15T06:36:42.423Z
Learning: The `npm init` command supports the `--init-type=module` flag to initialize a project with ES module type in package.json. This is a valid npm CLI option documented at https://docs.npmjs.com/cli/v11/commands/npm-init#init-type
Learnt from: jy-joung-bitor
PR: prisma/docs#0
File: :0-0
Timestamp: 2025-10-15T06:36:42.423Z
Learning: The `tsc --init` command requires the `--types node` flag to properly include Node.js type definitions from `types/node` in the generated tsconfig.json, even when types/node is already installed. Without this flag, TypeScript may not automatically pick up Node.js typings.
πŸ“š Learning: 2025-10-15T06:36:42.423Z
Learnt from: jy-joung-bitor
PR: prisma/docs#0
File: :0-0
Timestamp: 2025-10-15T06:36:42.423Z
Learning: The `tsc --init` command requires the `--types node` flag to properly include Node.js type definitions from `types/node` in the generated tsconfig.json, even when types/node is already installed. Without this flag, TypeScript may not automatically pick up Node.js typings.

Applied to files:

  • content/100-getting-started/01-quickstart-sqlite.mdx
  • content/100-getting-started/03-prisma-postgres/100-from-the-cli.mdx
  • content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-sqlserver.mdx
  • content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb-typescript-mongodb.mdx
πŸ“š Learning: 2025-10-15T06:36:42.423Z
Learnt from: jy-joung-bitor
PR: prisma/docs#0
File: :0-0
Timestamp: 2025-10-15T06:36:42.423Z
Learning: The `npm init` command supports the `--init-type=module` flag to initialize a project with ES module type in package.json. This is a valid npm CLI option documented at https://docs.npmjs.com/cli/v11/commands/npm-init#init-type

Applied to files:

  • content/100-getting-started/01-quickstart-sqlite.mdx
  • content/100-getting-started/03-prisma-postgres/100-from-the-cli.mdx
πŸ“š Learning: 2025-10-09T21:32:50.340Z
Learnt from: aidankmcalister
PR: prisma/docs#7167
File: content/900-ai/prompts/astro.mdx:84-84
Timestamp: 2025-10-09T21:32:50.340Z
Learning: The `npx prisma init` command supports the following flags: `--db` (shorthand for `--datasource-provider prisma+postgres`), `--output` (specifies output location for generated client), `--generator-provider` (defines the generator provider), `--datasource-provider`, `--url`, `--preview-feature`, and `--with-model`. These are documented valid CLI options for Prisma init command.

Applied to files:

  • content/100-getting-started/03-prisma-postgres/100-from-the-cli.mdx
πŸ”‡ Additional comments (8)
content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases-typescript-sqlserver.mdx (2)

45-48: Correct ES module initialization with npm flag.

The --init-type=module flag properly sets "type": "module" in package.json, enabling ES module support as intended. Based on learnings


54-56: Correct Node.js typings configuration with tsc flag.

The --types node flag correctly configures TypeScript to include Node.js type definitions in tsconfig.json. Based on learnings

content/100-getting-started/02-setup-prisma/100-start-from-scratch/120-mongodb-typescript-mongodb.mdx (2)

44-47: Correct ES module initialization with npm flag.

The --init-type=module flag properly sets "type": "module" in package.json for ES module support, consistent with other guides in this PR. Based on learnings


53-55: Correct Node.js typings configuration with tsc flag.

The --types node flag correctly configures TypeScript to include Node.js type definitions, consistent with other guides in this PR. Based on learnings

content/100-getting-started/01-quickstart-sqlite.mdx (2)

36-39: Correct ES module initialization with npm flag.

The --init-type=module flag properly configures ES module support in package.json. This is important for the Quickstart guide as it's a high-visibility entry point. Based on learnings


51-53: Correct Node.js typings configuration with tsc flag.

The --types node flag correctly includes Node.js type definitions in tsconfig.json. Based on learnings

content/100-getting-started/03-prisma-postgres/100-from-the-cli.mdx (2)

103-106: Correct ES module initialization with npm flag.

The --init-type=module flag properly configures ES module support in package.json, consistent with other setup guides in this PR. Based on learnings


112-114: Correct Node.js typings configuration with tsc flag.

The --types node flag correctly includes Node.js type definitions in tsconfig.json, consistent with other setup guides in this PR. Based on learnings


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.

coderabbitai[bot] avatar Oct 19 '25 14:10 coderabbitai[bot]

Thanks for opening a PR! There are some conflicts with the recent updates for Prisma 7. Would you be able to resolve those?

aidankmcalister avatar Nov 19 '25 23:11 aidankmcalister