# Environment `env.tsconfig`

Creates configuration objects for TypeScript projects (registers a `tsconfig.json` file in the project).

Usually, this environment preset should not be necessary, as the new [project service](https://typescript-eslint.io/blog/announcing-typescript-eslint-v8#project-service) of `typescript-eslint` is enabled by default. However, the ESLint plugin of VSCode sometimes fails to lint files in certain subdirectories and complains about the project service not covering the file to be linted. In these cases, manually setting up this environment preset will help.

## Signature

```ts
function tsconfig(options: EnvTSConfigOptions): ConfigArg
```

## Options

| Name | Type | Default | Description |
| - | - | - | - |
| `basePath` | `string` | `'.'` | Path to a sub directory to apply the environment preset to. |
| `files` | `Array<string\|string[]>` | _required_ | Glob patterns for source files to be included. Use embedded arrays for AND patterns. |
| `ignores` | `string[]` | `[]` | Glob patterns for source files matching `files` to be ignored. |
| `project` | `string` | _required_ | The absolute path to the TypeScript project configuration file (`tsconfig.json`). |
| `rules` | `RulesConfig` | `{}` | Additional linter rules to be added to the configuration. |

## Example

```ts
// eslint.config.ts
import { defineConfig, env } from '@open-xchange/linter-presets/eslint'

export default defineConfig(

  // project configuration options
  { /* ... */ },

  // tsconfig environment
  env.tsconfig({
    files: ['src/**/*.ts'],
    project: resolve('src/tsconfig.json'),
  }),
)
```
