You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/blog/2025-12-01-type-aware-alpha.md
+51-23Lines changed: 51 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,14 +16,15 @@ We're excited to announce the alpha release of type-aware linting in Oxlint!
16
16
17
17
Following our [technical preview in August](/blog/2025-08-17-oxlint-type-aware), we're excited to announce that type-aware linting has reached alpha status. This milestone brings significant improvements in stability, configurability, and rule coverage.
18
18
19
-
Type-aware linting enables powerful rules like `no-floating-promises`, `no-misused-promises`, and `await-thenable` that catch bugs by understanding TypeScript's type system. With N type-aware rules now available, you can catch entire categories of runtime errors before they happen.
19
+
Type-aware linting enables powerful rules like `no-floating-promises`, `no-misused-promises`, and `await-thenable` that catch bugs by utilizing TypeScript's type system. With 43 type-aware rules now available, you can catch entire categories of runtime errors before they happen.
20
20
21
21
The alpha release addresses the major limitations from the technical preview:
-**Disable comment support** - Use `eslint-disable` comments to control type-aware rules
25
25
-**IDE support** - Type-aware linting works in VSCode and other supported editors
26
26
-**Improved stability** - Many crashes and edge cases have been fixed
27
+
-**Better performance** - Less memory used and slightly better rule performance in some cases
27
28
28
29
While we're still working on performance for very large monorepos and some advanced rules, the alpha is ready for testing in production codebases.
29
30
@@ -55,16 +56,44 @@ bunx oxlint --type-aware
55
56
56
57
:::
57
58
58
-
To try a specific type-aware rule without other configuration:
59
+
To try a specific type-aware rule without other configuration (`tsgolint` must be installed globally or locally already):
59
60
60
-
```bash
61
+
::: code-group
62
+
63
+
```sh [npm]
61
64
npx oxlint --type-aware -A all -D typescript/no-floating-promises
62
65
```
63
66
67
+
```sh [pnpm]
68
+
pnpx oxlint --type-aware -A all -D typescript/no-floating-promises
69
+
```
70
+
71
+
```sh [bun]
72
+
bunx oxlint --type-aware -A all -D typescript/no-floating-promises
73
+
```
74
+
75
+
:::
76
+
64
77
For more configuration options, see our [usage guide](/docs/guide/usage/linter/type-aware).
65
78
66
79
## What's New
67
80
81
+
### Support for type-checking while linting
82
+
83
+
`tsgolint` now supports emitting type checking errors from TypeScript while linting. Since type-aware rules already require checking all of the types within a file, we are able to use this existing type information rather than discarding it. This means that in some cases, it is possible to skip doing a separate type-check command altogether (e.g., `tsc --noEmit`), reducing total time spent doing linting and type-checking in CI.
84
+
85
+
This is an experimental feature, but you can enable it by adding the `--type-check` and `--type-aware` flag to the `oxlint` command:
86
+
87
+
```
88
+
$ oxlint --type-aware --type-check
89
+
90
+
× typescript(TS2322): Type 'number' is not assignable to type 'string'.
91
+
╭─[index.ts:1:7]
92
+
1 │ const message: string = 1
93
+
· ───────
94
+
╰────
95
+
```
96
+
68
97
### Rule configuration support in `oxlint`
69
98
70
99
Type-aware rules that run in `tsgolint` can be configured in `oxlint` just like any other lint rule. For example, you can configure the `no-floating-promises` rule to allow certain safe calls or ignore `void`:
@@ -83,7 +112,9 @@ Type-aware rules that run in `tsgolint` can be configured in `oxlint` just like
83
112
}
84
113
```
85
114
86
-
Previously, this would silently fail, but now the configuration is actually passed to `tsgolint` and parsed for the lint rule to use.
115
+
The configuration options are aligned with what `typescript-eslint` supports and documentation can be found in the configuration section for each rule (like [`no-floating-promises`](https://oxc.rs/docs/guide/usage/linter/rules/typescript/no-floating-promises.html#configuration)).
116
+
117
+
Previously, configuring this rule would silently fail, but now the configuration is actually passed to `tsgolint` and parsed for the lint rule to use.
87
118
88
119
### Disable comment support in `oxlint`
89
120
@@ -96,36 +127,33 @@ Rules that run in `tsgolint` can now be disabled similar to any other `oxlint` r
96
127
[1, 2, 3].map(asyncx=>x+1);
97
128
```
98
129
99
-
Previously, this didn't actually disable the rule, but now it will.
130
+
Previously, this didn't actually disable the rule, but now it will work as expected.
100
131
101
132
### More supported rules
102
133
103
-
The alpha milestone is largely focused on stability and integrating `tsgolint` more closely with `oxlint`, but we've still ported several rules from `typescript-eslint` which you can now use via `oxlint` as well:
134
+
We've continued to make progress on porting popular rules from `typescript-eslint` which you can now use via `oxlint`. `tsgolint`, combined with `oxlint`, currently supports 43 type-aware rules.
135
+
136
+
Since the initial preview, support for the following rules has also been added:
104
137
105
-
-`no-deprecated`
138
+
-`no-deprecated` (one of the most commonly requested rules)
106
139
-`prefer-includes`
107
140
-`strict-boolean-expressions`
108
141
109
142
### TypeScript program diagnostics are now reported
110
143
111
-
Previously, if TypeScript failed to create and parse a program, these errors were not reported which lead to confusion around why linting was not working. Now, we report any issues with creating a program as a diagnostic. For example, if a `tsconfig.json` file contains `baseUrl`, that will be reported now:
144
+
Previously, if TypeScript failed to create and parse a program, these errors were not reported which lead to confusion around why linting was not working. Now, we report any issues with creating a program as a diagnostic, including if there is a configuration issue in the `tsconfig.json` file.
145
+
146
+
For example, if a `tsconfig.json` file contains `baseUrl`, that will be reported as an error, since `baseUrl` has been removed from TypeScript:
112
147
113
148
```
114
149
$ oxlint --type-aware
115
150
116
-
× Invalid tsconfig
117
-
╭─[docs/tsconfig.json:1:1]
118
-
1 │ {
119
-
· ▲
120
-
2 │ "compilerOptions": {
121
-
╰────
122
-
help: Non-relative paths are not allowed. Did you forget a leading './'?
123
-
124
-
× Invalid tsconfig
125
-
╭─[test/ui/tsconfig.json:1:1]
126
-
1 │ {
127
-
· ▲
128
-
2 │ "extends": "../../tsconfig.base.json",
151
+
× typescript(tsconfig-error): Invalid tsconfig
152
+
╭─[tsconfig.json:4:3]
153
+
3 │ "compilerOptions": {
154
+
4 │ "baseUrl": ".",
155
+
· ─────────
156
+
5 │ "experimentalDecorators": true,
129
157
╰────
130
158
help: Option 'baseUrl' has been removed. Please remove it from your configuration.
131
159
See https://github.com/oxc-project/tsgolint/issues/351 for more information.
@@ -148,7 +176,7 @@ oxlint CLI (Rust)
148
176
└─ Formats and displays results
149
177
150
178
tsgolint (Go)
151
-
├─ Uses typescript-go for type checking
179
+
├─ Uses typescript-go directly for type checking
152
180
├─ Executes type-aware rules
153
181
└─ Returns structured diagnostics
154
182
```
@@ -157,7 +185,7 @@ This design keeps Oxlint's core fast while leveraging TypeScript's type system t
157
185
158
186
### TypeScript Compatibility
159
187
160
-
`tsgolint` is based on [typescript-go](https://github.com/microsoft/typescript-go), Microsoft's TypeScript v7.0 rewrite in Go, not the original TypeScript compiler.
188
+
`tsgolint` is based on [typescript-go](https://github.com/microsoft/typescript-go), Microsoft's TypeScript v7.0 rewrite in Go, not the original TypeScript compiler. This means that you encounter some features which are no longer supported.
0 commit comments