Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: schema.json in node_modules #9832

Merged
merged 2 commits into from
Jan 31, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions docs/repo-docs/getting-started/editor-integration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,43 @@ Turborepo uses [JSON Schema](https://json-schema.org/) to give you auto-complete
`turbo.json` file. By including the `$schema` key in your `turbo.json`, your editor is able to
provide full documentation and linting in case you have invalid shapes or missing keys.

### Sourcing from the web

A `schema.json` is accessible at the URL shown below. This has the advantage of not needing to run your package manager's install command to see in-editor validation.

```json title="./turbo.json"
{
"$schema": "https://turbo.build/schema.json"
}
```

### Older versions

If you are using Turborepo v1, use `schema.v1.json`.
There is also a major versioned `schema.json` available, following the format of `https://turbo.build/schema.<version>.json`.

```json title="./turbo.json"
{
"$schema": "https://turbo.build/schema.v1.json"
}
```

### Sourcing from `node_modules`

Starting in Turborepo 2.4, `schema.json` is available in `node_modules` once you've run your package manager's install command:

```json title="turbo.json"
{
"$schema": "./node_modules/turbo/schema.json"
}
```

<Callout title="node_modules location">
We recommend installing `turbo` at the root of your repository, so the path
for the schema should point to `node_modules` at the root of your repository.
In [Package Configurations](/repo/docs/reference/package-configurations), you
may need to use a path like `../../node_modules/turbo/schema.json`.
</Callout>

## Linting for environment variables

Handling environment variables is an important part of building applications in a Turborepo.

[The `eslint-config-turbo` package](/repo/docs/reference/eslint-config-turbo) extends your ESLint setup to help you make sure you've taken care of all of your environment variables.
Expand Down
Loading