tsgolint is a TypeScript linter containing only type-aware rules, powered by typescript-go adapted for Oxlint.
This project originated in typescript-eslint/tsgolint. Fork permission is granted by @auvred.
If you want faster typed linting with ESLint, see typescript-eslint/typescript-eslint#10940 Enhancement: Use TypeScript's Go port (tsgo / typescript-go) for type information.
Important
tsgolint is a prototype in the early stages of development. This is a community effort. Feel free to ask to be assigned to any of the good first issues.
- Primitive linter engine
- Lint rules tester
- Source code fixer
- 40 type-aware typescript-eslint's rules
- Basic
tsgolint
CLI
Try running
npx oxlint-tsgolint --help
to see available options.
tsgolint is 20-40 times faster than ESLint + typescript-eslint.
Most of the speedup is due to the following facts:
- Native speed parsing and type-checking (thanks to typescript-go)
- No more TS AST -> ESTree AST conversions. TS AST is directly used in rules.
- Parallel parsing, type checking and linting. tsgolint uses all available CPU cores.
See benchmarks for more info.
- Non-type-aware rules
- Editor extension
- Rich CLI features
- Config file
- Plugin system
See ARCHITECTURE.md for detailed architectural documentation.
git submodule update --init # init typescript-go submodule
cd typescript-go
git am --3way --no-gpg-sign ../patches/*.patch # apply typescript-go patches
cd ..
go build -o tsgolint ./cmd/tsgolint
For troubleshooting and development purposes, tsgolint supports debug logging through the OXC_LOG
environment variable.
To enable verbose debug output, set the OXC_LOG
environment variable to debug
:
OXC_LOG=debug tsgolint
Debug logging provides detailed information about the linting process, including:
- File assignment to TypeScript programs
- Worker distribution and execution
- Performance timing information
- Internal state details
This can be helpful when:
- Diagnosing performance issues
- Understanding how files are being processed
- Troubleshooting TypeScript configuration problems
- Contributing to tsgolint development
tsgolint includes several types of tests to ensure correctness:
Run Go unit tests for individual rules:
go test ./internal/...
./test.sh
- End-to-end snapshot test running all 40+ rules- Runs all tsgolint rules on all fixture files
- Captures diagnostic output in deterministic, sortable format
- Verifies output matches expected snapshot
- consistent-return
- consistent-type-exports
- dot-notation
- naming-convention
- no-deprecated
- no-unnecessary-condition
- no-unnecessary-qualifier
- no-unnecessary-type-conversion
- no-unnecessary-type-parameters
- prefer-destructuring
- prefer-find
- prefer-includes
- prefer-nullish-coalescing
- prefer-optional-chain
- prefer-readonly
- prefer-readonly-parameter-types
- prefer-regexp-exec
- prefer-string-starts-ends-with
- strict-boolean-expressions
- await-thenable
- no-array-delete
- no-base-to-string
- no-confusing-void-expression
- no-duplicate-type-constituents
- no-floating-promises
- no-for-in-array
- no-implied-eval
- no-meaningless-void-operator
- no-misused-promises
- no-misused-spread
- no-mixed-enums
- no-redundant-type-constituents
- no-unnecessary-boolean-literal-compare
- no-unnecessary-template-expression
- no-unnecessary-type-arguments
- no-unnecessary-type-assertion
- no-unsafe-argument
- no-unsafe-assignment
- no-unsafe-call
- no-unsafe-enum-comparison
- no-unsafe-member-access
- no-unsafe-return
- no-unsafe-type-assertion
- no-unsafe-unary-minus
- non-nullable-type-assertion-style
- only-throw-error
- prefer-promise-reject-errors
- prefer-reduce-type-parameter
- prefer-return-this-type
- promise-function-async
- related-getter-setter-pairs
- require-array-sort-compare
- require-await
- restrict-plus-operands
- restrict-template-expressions
- return-await
- switch-exhaustiveness-check
- unbound-method
- use-unknown-in-catch-callback-variable