What is typescript-eslint?
typescript-eslint is a set of tools that allows you to use ESLint to lint TypeScript code. It provides a parser that can read TypeScript code and a set of rules that are specific to TypeScript, enabling you to enforce coding standards and catch potential issues in your TypeScript projects.
What are typescript-eslint's main functionalities?
Linting TypeScript Code
This configuration file sets up ESLint to use the TypeScript parser and includes recommended rules from the @typescript-eslint plugin. It also adds a custom rule to error on unused variables.
module.exports = {
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended'
],
rules: {
'@typescript-eslint/no-unused-vars': 'error'
}
};
Type-Aware Rules
This configuration enables type-aware linting rules by specifying a TypeScript project. The rule '@typescript-eslint/no-floating-promises' ensures that promises are properly handled.
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json'
},
plugins: ['@typescript-eslint'],
extends: [
'plugin:@typescript-eslint/recommended-requiring-type-checking'
],
rules: {
'@typescript-eslint/no-floating-promises': 'error'
}
};
Custom Rules
This configuration enforces explicit return types on functions, but allows expressions to omit the return type. This helps in maintaining clear and predictable function signatures.
module.exports = {
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
rules: {
'@typescript-eslint/explicit-function-return-type': ['error', {
allowExpressions: true
}]
}
};
Other packages similar to typescript-eslint
tslint
TSLint is an extensible static analysis tool that checks TypeScript code for readability, maintainability, and functionality errors. However, TSLint has been deprecated in favor of ESLint and typescript-eslint, as the latter provides a more flexible and extensible architecture.
eslint
ESLint is a widely-used linting tool for JavaScript. While it does not natively support TypeScript, it can be extended with the typescript-eslint parser and plugin to lint TypeScript code. This makes ESLint a versatile tool for projects that use both JavaScript and TypeScript.
prettier
Prettier is an opinionated code formatter that supports multiple languages, including TypeScript. While it is not a linter, it can be used alongside typescript-eslint to ensure consistent code formatting. Prettier focuses on code style, whereas typescript-eslint focuses on code quality and potential errors.
typescript-eslint
Tooling which enables you to use TypeScript with ESLint

👉 See https://typescript-eslint.io/packages/typescript-eslint for documentation on this package.
See https://typescript-eslint.io for general documentation on typescript-eslint, the tooling that allows you to run ESLint and Prettier on TypeScript code.
7.13.0 (2024-06-10)
🚀 Features
- eslint-plugin: [no-dynamic-delete] allow all string literals as index (#9280)
- parser, typescript-estree: export withoutProjectParserOptions utility (#9233)
- typescript-estree: require
import = require()
argument to be a string literal (#9226)
- typescript-estree: forbid
.body
, .async
, .generator
on declare function
(#9225)
🩹 Fixes
- ast-spec: function-call-like callee should be Expression not LeftHandSideExpression (#9231)
- eslint-plugin: [init-declarations] refine report locations (#8893)
- eslint-plugin: [no-base-to-string] make error message more nuanced (#9281)
- eslint-plugin: [no-unsafe-assignment] be more specific about error types (#8304)
- eslint-plugin: [no-magic-numbers] fix implementation of the
ignore
option (#9167)
- scope-manager: handle index signature in class (#9054)
❤️ Thank You
- Fotis Papadogeorgopoulos
- Joshua Chen
- Kirk Waiblinger
- Tobiloba Adedeji @tobySolutions
- Vinccool96
- YeonJuan @yeonjuan
You can read about our versioning strategy and releases on our website.