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
docs(linter): add troubleshooting section for type-aware linting (#708)
Add documentation for debugging unexpected errors and slow performance
when using type-aware linting, including example debug log output and
interpretation guidance.
If you encounter unexpected errors or rules not triggering when expected, types may not be resolving correctly. Run with `--type-check` to verify that all imports are being resolved:
91
+
92
+
```bash
93
+
oxlint --type-aware --type-check
94
+
```
95
+
96
+
This will report TypeScript errors alongside lint diagnostics, helping identify missing or unresolved types.
97
+
98
+
**Common causes of unresolved types:**
99
+
100
+
-**Monorepo with bundler (tsdown, tsup, etc.)**: Pre-build dependent packages so their types are available. For example, if package `A` depends on package `B`, build `B` first so its `.d.ts` files exist.
101
+
-**Missing dependencies**: Ensure all dependencies are installed (`npm install` / `pnpm install`)
102
+
103
+
### Debugging Slow Performance
104
+
105
+
If type-aware linting is running slower than expected:
106
+
107
+
1.**Update to the latest versions** of both `oxlint` and `oxlint-tsgolint`
108
+
109
+
2.**Enable debug logging** to see detailed timing information:
110
+
111
+
```bash
112
+
OXC_LOG=debug oxlint --type-aware
113
+
```
114
+
115
+
Example output (showing key timing milestones):
116
+
117
+
```
118
+
2025/01/01 12:00:00.000000 Starting tsgolint
119
+
2025/01/01 12:00:00.001000 Starting to assign files to programs. Total files: 259
120
+
2025/01/01 12:00:01.000000 Done assigning files to programs. Total programs: 8. Unmatched files: 75
121
+
2025/01/01 12:00:01.001000 Starting linter with 12 workers
2025/01/01 12:00:14.100000 [5/8] Running linter on program: /path/to/project/apps/tsconfig.json
130
+
...
131
+
2025/01/01 12:00:15.000000 Linting Complete
132
+
Finished in 16.4s on 259 files with 161 rules using 12 threads.
133
+
```
134
+
135
+
**How to interpret the log:**
136
+
137
+
-**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.
138
+
-**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.
139
+
- Look for programs with an unusually high number of source files (e.g., `Program created with 26140 source files`). This may indicate misconfigured tsconfig `includes`/`excludes` pulling in unnecessary files like `node_modules`.
140
+
- Each file path logged indicates when that file is being linted. Large time gaps between files may indicate expensive type resolution for certain files.
141
+
86
142
## TypeScript Compatibility
87
143
88
144
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 written in TypeScript.
0 commit comments