Type-Aware Linting
Type-aware linting enables rules that rely on TypeScript’s type system, such as detecting unhandled promises or unsafe assignments. In Oxlint, type-aware linting is provided by tsgolint and integrated into the Oxlint CLI and configuration system.
This feature is currently alpha. Rule coverage, performance, and compatibility continue to improve.
Overview
Oxlint separates responsibilities between two components:
Oxlint (Rust) Handles file traversal, ignore logic, configuration, non-type-aware rules, and reporting.
tsgolint (Go) Builds TypeScript programs using
typescript-goand executes type-aware rules, returning structured diagnostics to Oxlint.
Installation
Type-aware linting requires an additional dependency:
npm add -D oxlint-tsgolint@latestpnpm add -D oxlint-tsgolint@latestyarn add -D oxlint-tsgolint@latestbun add -D oxlint-tsgolint@latestRunning type-aware linting
To run Oxlint with type-aware linting, you must pass the --type-aware flag:
oxlint --type-awareWhen enabled, Oxlint runs standard rules and type-aware rules in the typescript/* namespace.
Type-aware linting is opt-in and does not run unless the flag is provided.
In editor and LSP-based integrations like VS Code, type-aware linting can be enabled by setting the typeAware option to true, see the Editors page for more information.
Monorepos and build outputs
Type-aware linting requires resolved type information.
In monorepos:
- Build dependent packages so
.d.tsfiles are available - Ensure dependencies are installed before running
pnpm install
pnpm -r build
oxlint --type-awareType checking diagnostics
Enable type checking to report TypeScript errors alongside lint results:
oxlint --type-aware --type-checkThis mode can replace a separate tsc --noEmit step in CI:
# before
tsc --noEmit
oxlint
# after
oxlint --type-aware --type-checkConfiguring type-aware rules
Type-aware rules are configured like other Oxlint rules.
{
"plugins": ["typescript"],
"rules": {
"typescript/no-floating-promises": "error",
"typescript/no-unsafe-assignment": "warn"
}
}Rules support the same options as their typescript-eslint equivalents.
{
"plugins": ["typescript"],
"rules": {
"typescript/no-floating-promises": ["error", { "ignoreVoid": true }]
}
}Disable comments
Type-aware rules support inline disable comments:
// oxlint-disable-next-line typescript/no-floating-promises
doSomethingAsync();Report unused disable comments with:
oxlint --type-aware --report-unused-disable-directivesTypeScript compatibility
Type-aware linting is powered by typescript-go.
- TypeScript 7.0+ is required
- Some legacy
tsconfigoptions are not supported (likebaseUrlintsconfig.json) - If you're using config options/features that were deprecated in TypeScript 6.0 or removed in TypeScript 7.0, you'll need to migrate your codebase first
- Invalid options are reported when
--type-checkis enabled
See the TypeScript migration guide for more details, and consider using ts5to6 to upgrade your tsconfig file.
Stability notes
Type-aware linting is alpha:
- Rule coverage is incomplete
- Very large codebases may encounter high memory usage
- Performance continues to improve
Troubleshooting
Performance and debugging
If type-aware linting is slow or uses excessive memory:
- Update both tools:
oxlintoxlint-tsgolint
- Enable debug logging:
OXC_LOG=debug oxlint --type-awareExample output (showing key timing milestones):
2026/01/01 12:00:00.000000 Starting tsgolint
2026/01/01 12:00:00.001000 Starting to assign files to programs. Total files: 259
2026/01/01 12:00:01.000000 Done assigning files to programs. Total programs: 8. Unmatched files: 75
2026/01/01 12:00:01.001000 Starting linter with 12 workers
2026/01/01 12:00:01.001000 Workload distribution: 8 programs
2026/01/01 12:00:01.002000 [1/8] Running linter on program: /path/to/project/jsconfig.json
...
2026/01/01 12:00:01.100000 [4/8] Running linter on program: /path/to/project/tsconfig.json
2026/01/01 12:00:02.500000 Program created with 26140 source files
2026/01/01 12:00:14.000000 /path/to/project/oxlint-plugin.mts
...
2026/01/01 12:00:14.100000 [5/8] Running linter on program: /path/to/project/apps/tsconfig.json
...
2026/01/01 12:00:15.000000 Linting Complete
Finished in 16.4s on 259 files with 161 rules using 12 threads.How to interpret the log:
- File assignment phase (
Starting to assign files...→Done assigning files...): Maps source files to their tsconfig projects. This phase should be fast. If slow, please file an issue. - Program linting (
[N/M] Running linter on program...): Each TypeScript project is linted separately. Programs that take significantly longer may indicate expensive type resolution or an overly large project.- Look for programs with an unusually high number of source files (e.g.,
Program created with 26140 source files). This may indicate misconfigured tsconfigincludes/excludespulling in unnecessary files likenode_modules. - Each file path logged indicates when that file is being linted. Large time gaps between files may indicate expensive type resolution for certain files.
- Look for programs with an unusually high number of source files (e.g.,
Next steps
- Check implemented rules
- Report issues to https://github.com/oxc-project/tsgolint
