Type-Aware Linting
Read our technical preview announcement for background details, and the rationale for the architecture we have chosen for type-aware linting.
Installation
npm add -D oxlint-tsgolint@latestpnpm add -D oxlint-tsgolint@latestyarn add -D oxlint-tsgolint@latestbun add -D oxlint-tsgolint@latestRun oxlint with --type-aware
oxlint --type-awareUnimplemented Rules
See https://github.com/oxc-project/tsgolint/issues/104
Supported Rules
List of supported rules:
- typescript/await-thenable
- typescript/no-array-delete
- typescript/no-base-to-string
- typescript/no-confusing-void-expression
- typescript/no-deprecated
- typescript/no-duplicate-type-constituents
- typescript/no-floating-promises
- typescript/no-for-in-array
- typescript/no-implied-eval
- typescript/no-meaningless-void-operator
- typescript/no-misused-promises
- typescript/no-misused-spread
- typescript/no-mixed-enums
- typescript/no-redundant-type-constituents
- typescript/no-unnecessary-boolean-literal-compare
- typescript/no-unnecessary-template-expression
- typescript/no-unnecessary-type-arguments
- typescript/no-unnecessary-type-assertion
- typescript/no-unsafe-argument
- typescript/no-unsafe-assignment
- typescript/no-unsafe-call
- typescript/no-unsafe-enum-comparison
- typescript/no-unsafe-member-access
- typescript/no-unsafe-return
- typescript/no-unsafe-type-assertion
- typescript/no-unsafe-unary-minus
- typescript/non-nullable-type-assertion-style
- typescript/only-throw-error
- typescript/prefer-includes
- typescript/prefer-promise-reject-errors
- typescript/prefer-reduce-type-parameter
- typescript/prefer-return-this-type
- typescript/promise-function-async
- typescript/related-getter-setter-pairs
- typescript/require-array-sort-compare
- typescript/require-await
- typescript/restrict-plus-operands
- typescript/restrict-template-expressions
- typescript/return-await
- typescript/strict-boolean-expressions
- typescript/switch-exhaustiveness-check
- typescript/unbound-method
- typescript/use-unknown-in-catch-callback-variable
TypeScript Compatibility
tsgolint is based on typescript-go (Microsoft's TypeScript v7.0 rewrite in Go), not the original TypeScript compiler written in TypeScript.
Key implications:
- Only TypeScript 7.0+ features are supported
- Pre-7.0 syntax and features (like
baseUrlintsconfig.json) are not supported - If you're using deprecated features that were deprecated in TypeScript 6.0 or removed in TypeScript 7.0, you'll need to migrate your codebase first
For help migrating deprecated tsconfig options, see the TypeScript migration guide.
Architecture
Type-aware linting in Oxlint uses a unique two-binary architecture:
oxlint CLI (Rust)
├─ Handles file traversal, ignore logic, and diagnostics
├─ Runs non-type-aware rules and custom JS plugins
├─ Passes paths and configuration to tsgolint
└─ Formats and displays results
tsgolint (Go)
├─ Uses typescript-go directly for type checking
├─ Executes type-aware rules
└─ Returns structured diagnosticsThis design keeps Oxlint's core fast while leveraging TypeScript's type system through typescript-go. The frontend-backend separation means oxlint controls the user experience while tsgolint handles the heavy lifting of type analysis.