Typed Linting with Project Service
"Typed linting", or enabling ESLint rules to understand TypeScript types, is one of the best parts of typescript-eslint. It enables a slew of more powerful lint rules that check for nuanced bugs, best practice violations, and other code issues that can only be detected using type information.
Typed linting hasn't always been straightforward to configure or performant at runtime.
We've seen users have to manage separate tsconfig.eslint.json
files to enable typed linting — sometimes with different compiler options than the rest of the project.
Not ideal.
In typescript-eslint 8.0, we stabilized a parserOptions.projectService
option that uses more powerful, streamlined TypeScript APIs than before.
The "Project Service" brings several benefits:
- ✍️ Configuration: simpler ESLint configs for typed linting with no ESLint-specific TSConfig files
- 🧠 Predictability: uses the same type information services as editors, including more reliability
- 🚀 Scalability: supporting TypeScript project references for larger repositories (i.e. monorepos)
This blog post will cover how parserOptions.projectService
simplifies configurations and aligns linting type information to what editors such as VS Code run with.
See Getting Started to learn how to lint JavaScript and TypeScript code with typescript-eslint, then Linting with Type Information to onboard to typed linting.