oxlint-tsgolint 0.16.0 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +89 -38
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -7,28 +7,51 @@
|
|
|
7
7
|
[![MIT licensed][license-badge]][license-url]
|
|
8
8
|
[![Build Status][ci-badge]][ci-url]
|
|
9
9
|
[![Discord chat][discord-badge]][discord-url]
|
|
10
|
-
[![npm
|
|
10
|
+
[![npm weekly downloads][npm-badge]][npm-url]
|
|
11
11
|
|
|
12
12
|
</div>
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
High-performance **type-aware linting** for Oxlint.
|
|
15
|
+
|
|
16
|
+
`tsgolint` executes lint rules that require **TypeScript semantic analysis**, using [typescript-go](https://github.com/microsoft/typescript-go) for full compatibility with the TypeScript type system, and targets **TypeScript 7** (codenamed **Project Corsa**).
|
|
17
|
+
|
|
18
|
+
It is designed to integrate seamlessly with Oxlint's fast syntax linting, enabling projects to run deeper semantic checks without sacrificing performance.
|
|
15
19
|
|
|
16
20
|
Key highlights:
|
|
17
21
|
|
|
18
|
-
- **Performance**: 20-40x faster than ESLint + typescript-eslint
|
|
19
|
-
- **
|
|
20
|
-
- **Parallel**:
|
|
21
|
-
- **
|
|
22
|
+
- **Performance**: 20-40x faster than ESLint + typescript-eslint on large repositories
|
|
23
|
+
- **Coverage**: 59/61 targeted `typescript-eslint` type-aware rules implemented
|
|
24
|
+
- **Parallel**: Multi-core rule execution for scalable analysis
|
|
25
|
+
- **High impact**: catches production-grade bugs that syntax-only linting misses (for example `no-floating-promises`)
|
|
26
|
+
|
|
27
|
+
This project originated in [typescript-eslint/tsgolint](https://github.com/typescript-eslint/tsgolint), with fork permission granted by [@auvred](https://github.com/auvred).
|
|
28
|
+
|
|
29
|
+
## Why Teams Upgrade to Type-Aware Linting
|
|
30
|
+
|
|
31
|
+
If you ship TypeScript, running `oxlint --type-aware` in CI is a high-leverage upgrade that catches bug classes syntax linting cannot.
|
|
22
32
|
|
|
23
|
-
|
|
33
|
+
For example, `typescript/no-floating-promises` catches silently dropped async failures:
|
|
34
|
+
|
|
35
|
+
```js
|
|
36
|
+
async function saveUser(user) {
|
|
37
|
+
const res = await fetch('/api/users', {
|
|
38
|
+
method: 'POST',
|
|
39
|
+
body: JSON.stringify(user),
|
|
40
|
+
});
|
|
41
|
+
if (!res.ok) throw new Error('save failed');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function onSubmit(user) {
|
|
45
|
+
saveUser(user); // no-floating-promises: Promise is created but never handled
|
|
46
|
+
showToast('Saved!'); // UI claims success even if the request rejects
|
|
47
|
+
}
|
|
48
|
+
```
|
|
24
49
|
|
|
25
|
-
|
|
26
|
-
> **tsgolint** is currently in alpha.
|
|
27
|
-
> This is a community effort. Feel free to ask to be assigned to any of the [good first issues](https://github.com/oxc-project/tsgolint/contribute).
|
|
50
|
+
Without this rule, rejected promises can be missed and reach production as flaky, hard-to-debug failures.
|
|
28
51
|
|
|
29
52
|
## Installation & Usage
|
|
30
53
|
|
|
31
|
-
|
|
54
|
+
`tsgolint` is integrated into Oxlint as the type-aware backend. Install and use via Oxlint:
|
|
32
55
|
|
|
33
56
|
```shell
|
|
34
57
|
# Install oxlint with type-aware support
|
|
@@ -39,19 +62,32 @@ pnpm dlx oxlint --type-aware
|
|
|
39
62
|
|
|
40
63
|
# Or run on your project
|
|
41
64
|
oxlint --type-aware
|
|
65
|
+
|
|
66
|
+
# Optionally also run typechecking at the same time
|
|
67
|
+
oxlint --type-aware --type-check
|
|
42
68
|
```
|
|
43
69
|
|
|
70
|
+
### What these flags do
|
|
71
|
+
|
|
72
|
+
- `--type-aware`: enables `typescript/*` rules that require TypeScript semantic analysis via `tsgolint`
|
|
73
|
+
- `--type-check`: includes type diagnostics from `typescript-go` in type-aware runs
|
|
74
|
+
|
|
44
75
|
### Configuration
|
|
45
76
|
|
|
46
77
|
Configure type-aware rules in `.oxlintrc.json`:
|
|
47
78
|
|
|
48
|
-
```
|
|
79
|
+
```jsonc
|
|
49
80
|
{
|
|
50
81
|
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
82
|
+
// alternatively, configure via options field
|
|
83
|
+
"options": {
|
|
84
|
+
"typeAware": true,
|
|
85
|
+
"typeCheck": true,
|
|
86
|
+
},
|
|
51
87
|
"rules": {
|
|
52
88
|
"typescript/no-floating-promises": "error",
|
|
53
|
-
"typescript/no-misused-promises": "error"
|
|
54
|
-
}
|
|
89
|
+
"typescript/no-misused-promises": "error",
|
|
90
|
+
},
|
|
55
91
|
}
|
|
56
92
|
```
|
|
57
93
|
|
|
@@ -60,39 +96,54 @@ Over 50 TypeScript-specific type-aware rules are available. For detailed setup a
|
|
|
60
96
|
> [!NOTE]
|
|
61
97
|
> Non-type-aware TypeScript rules can be found in [Oxlint's TypeScript rules](https://oxc.rs/docs/guide/usage/linter/rules.html) under the TypeScript source.
|
|
62
98
|
|
|
63
|
-
##
|
|
99
|
+
## How it fits into Oxlint
|
|
64
100
|
|
|
65
|
-
|
|
101
|
+
Oxlint separates linting into two layers:
|
|
66
102
|
|
|
67
|
-
|
|
103
|
+
| Layer | Purpose | Speed |
|
|
104
|
+
| ------------ | ---------------------------- | ---------------------- |
|
|
105
|
+
| **Oxlint** | Syntax & structural analysis | Instant |
|
|
106
|
+
| **tsgolint** | Type-aware semantic rules | Requires type analysis |
|
|
68
107
|
|
|
69
|
-
|
|
70
|
-
-
|
|
71
|
-
- **rolldown** (314 files): 1.5s
|
|
72
|
-
- **bluesky** (1152 files): 7.0s
|
|
108
|
+
This architecture keeps the common case extremely fast while enabling powerful type-aware checks when needed.
|
|
109
|
+
Oxlint handles file discovery, configuration, and output formatting, while `tsgolint` executes type-aware rules and emits semantic diagnostics.
|
|
73
110
|
|
|
74
|
-
|
|
111
|
+
## Why tsgolint exists
|
|
75
112
|
|
|
76
|
-
-
|
|
77
|
-
- **Zero Conversion**: Direct TypeScript AST usage without ESTree conversion overhead
|
|
78
|
-
- **Parallel Processing**: Multi-core execution utilizing all available CPU cores
|
|
79
|
-
- **Efficient Memory**: Streaming diagnostics and optimized resource usage
|
|
113
|
+
Traditional type-aware linting in the JavaScript ecosystem typically works by embedding TypeScript's type-analysis engine inside a JavaScript linter.
|
|
80
114
|
|
|
81
|
-
|
|
115
|
+
This approach introduces several bottlenecks:
|
|
116
|
+
|
|
117
|
+
- slow startup due to compiler initialization
|
|
118
|
+
- AST conversion between toolchains
|
|
119
|
+
- limited parallelism
|
|
120
|
+
- high memory overhead on large repositories
|
|
82
121
|
|
|
83
|
-
|
|
122
|
+
`tsgolint` takes a different approach: it runs directly on `typescript-go`, avoiding these bottlenecks and allowing semantic analysis to run efficiently alongside Oxlint.
|
|
123
|
+
|
|
124
|
+
Recent benchmark results (`eslint` + `typescript-eslint` vs `tsgolint`) show consistent large speedups:
|
|
125
|
+
|
|
126
|
+
| Repository | ESLint + typescript-eslint | tsgolint | Speedup |
|
|
127
|
+
| -------------------- | -------------------------- | -------- | ------- |
|
|
128
|
+
| microsoft/vscode | 167.8s | 4.89s | **34x** |
|
|
129
|
+
| microsoft/typescript | 47.4s | 2.10s | **23x** |
|
|
130
|
+
| typeorm/typeorm | 27.3s | 0.93s | **29x** |
|
|
131
|
+
| vuejs/core | 20.7s | 0.95s | **22x** |
|
|
132
|
+
|
|
133
|
+
See [benchmarks](./benchmarks/README.md) for detailed performance comparisons.
|
|
84
134
|
|
|
85
|
-
|
|
135
|
+
## Status
|
|
86
136
|
|
|
87
|
-
|
|
137
|
+
`tsgolint` is under active development.
|
|
88
138
|
|
|
89
|
-
|
|
139
|
+
The core architecture is stable and already powers Oxlint's type-aware linting mode. Current development focuses on expanding rule coverage and ecosystem integration:
|
|
90
140
|
|
|
91
|
-
|
|
141
|
+
- additional `typescript-eslint` rule support
|
|
142
|
+
- editor integration improvements
|
|
143
|
+
- configuration and rule customization
|
|
144
|
+
- performance improvements for large monorepos
|
|
92
145
|
|
|
93
|
-
|
|
94
|
-
- **tsgolint backend** provides type-aware rule execution and diagnostics
|
|
95
|
-
- **TypeScript integration** via typescript-go for native performance
|
|
146
|
+
Because `tsgolint` relies on `typescript-go`, its long-term stability evolves alongside TypeScript itself.
|
|
96
147
|
|
|
97
148
|
For detailed technical documentation, see [ARCHITECTURE.md](./ARCHITECTURE.md).
|
|
98
149
|
|
|
@@ -176,13 +227,13 @@ Implemented 59/61.
|
|
|
176
227
|
- [ARCHITECTURE.md](./ARCHITECTURE.md) - Detailed technical documentation
|
|
177
228
|
- [CONTRIBUTING.md](./CONTRIBUTING.md) - Development and contribution guidelines
|
|
178
229
|
- [Benchmarks](./benchmarks/README.md) - Performance comparison data
|
|
179
|
-
- [
|
|
230
|
+
- [typescript-go](https://github.com/microsoft/typescript-go) - Underlying type-analysis backend
|
|
180
231
|
- [Oxlint](https://oxc.rs/docs/guide/usage/linter.html) - Frontend linter integration
|
|
181
232
|
|
|
182
233
|
<!-- Badge definitions -->
|
|
183
234
|
|
|
184
|
-
[npm-badge]: https://img.shields.io/npm/
|
|
185
|
-
[npm-url]: https://www.
|
|
235
|
+
[npm-badge]: https://img.shields.io/npm/dw/oxlint-tsgolint.svg
|
|
236
|
+
[npm-url]: https://www.npmx.dev/package/oxlint-tsgolint
|
|
186
237
|
[license-badge]: https://img.shields.io/badge/license-MIT-blue.svg
|
|
187
238
|
[license-url]: LICENSE
|
|
188
239
|
[ci-badge]: https://github.com/oxc-project/tsgolint/actions/workflows/ci.yml/badge.svg
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.17.1",
|
|
3
3
|
"description": "High-performance type-aware TypeScript linter powered by typescript-go, for use with oxlint.",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "auvred <aauvred@gmail.com>",
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
"tsgolint": "./bin/tsgolint.js"
|
|
15
15
|
},
|
|
16
16
|
"optionalDependencies": {
|
|
17
|
-
"@oxlint-tsgolint/win32-x64": "0.
|
|
18
|
-
"@oxlint-tsgolint/win32-arm64": "0.
|
|
19
|
-
"@oxlint-tsgolint/linux-x64": "0.
|
|
20
|
-
"@oxlint-tsgolint/linux-arm64": "0.
|
|
21
|
-
"@oxlint-tsgolint/darwin-x64": "0.
|
|
22
|
-
"@oxlint-tsgolint/darwin-arm64": "0.
|
|
17
|
+
"@oxlint-tsgolint/win32-x64": "0.17.1",
|
|
18
|
+
"@oxlint-tsgolint/win32-arm64": "0.17.1",
|
|
19
|
+
"@oxlint-tsgolint/linux-x64": "0.17.1",
|
|
20
|
+
"@oxlint-tsgolint/linux-arm64": "0.17.1",
|
|
21
|
+
"@oxlint-tsgolint/darwin-x64": "0.17.1",
|
|
22
|
+
"@oxlint-tsgolint/darwin-arm64": "0.17.1"
|
|
23
23
|
}
|
|
24
24
|
}
|