web-infra-dev / web-infra-dev/rslint
[Feature]: Support typeCheck in config
- Dominant language
- Go
- Stars
- 459
- Forks
- 33
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 376
Description
## Motivation
Rslint already supports `--type-check`. Allow projects to enable it in their config without adding the flag to every invocation.
## Proposal
Add `typeCheck?: boolean` alongside `languageOptions` and `rules`:
```ts
export default defineConfig([
{
typeCheck: true,
languageOptions: {
parserOptions: {
project: ['./packages/*/tsconfig.json'],
},
},
},
]);
```
- Default to `false`. Disabling it does not disable type-aware lint rules.
- Treat it as a config-file-level option, consistent with Rslint's current owner-wide collection of `parserOptions.project`. The last explicit value in the config array wins.
- Check all Programs associated with an enabled config. Entry-level `files`, `ignores`, and `basePath` do not scope this option; project path resolution remains unchanged.
- Resolve each discovered config independently. If multiple configs reference the same tsconfig, check it once when any associated config enables type checking.
- Preserve the existing CLI overrides: `--type-check` checks all Programs in the effective config catalog; `--type-check-only` also skips lint.
- Reuse existing diagnostics, exit codes, and post-fix checking. Keep each Program's diagnostics independent of lint targets and ignore patterns.
Initially apply this option to CLI runs only. API/LSP integration and automatic project-reference following are separate work.
## Alternatives
- **`options.typeCheck`**: Matches [Oxlint](https://oxc.rs/docs/guide/usage/linter/config-file-reference.html#options-typecheck) and leaves room for more execution options. Adds a generic container for a single feature and still requires explicit scope rules in a flat config array.
- **`linterOptions.typeCheck`**: Follows ESLint's naming for options controlling the lint process. However, ESLint's `linterOptions` can be scoped by file, which may imply different semantics from program-wide type checking. This would still be a Rslint-specific extension.
A direct `typeCheck` field keeps the feature explicit without introducing another configuration layer.
Contributor guide
Assessment
This issue has not been assessed yet.