Scripts2026年7月2日·1 分钟阅读

typescript-eslint — TypeScript Support for ESLint

The tooling that enables ESLint to lint and auto-fix TypeScript code with full type-aware analysis and over 100 TypeScript-specific rules.

Agent 就绪

Agent 可直接安装

这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
typescript-eslint
直接安装命令
npx -y tokrepo@latest install 6d74a45b-75ce-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run 确认安装计划,再运行此命令。

Introduction

typescript-eslint is the project that makes ESLint and TypeScript work together. It provides the parser, plugin, and rule sets that let you lint TypeScript code with full type information, catching bugs that the TypeScript compiler alone does not flag.

What typescript-eslint Does

  • Parses TypeScript and TSX files into an ESLint-compatible AST
  • Provides over 100 TypeScript-specific lint rules for common mistakes
  • Enables type-aware rules that use the TypeScript compiler API for deep analysis
  • Ships preset configurations from recommended to strict for quick setup
  • Supports ESLint flat config and legacy config formats

Architecture Overview

The project consists of three packages: the parser converts TypeScript source into an ESTree-compatible AST, the plugin exposes TypeScript-specific rules, and the utils package provides helpers for rule authors. Type-aware rules access the TypeScript type checker through a services bridge, enabling analysis that plain AST rules cannot perform.

Self-Hosting & Configuration

  • Install the typescript-eslint package which bundles parser, plugin, and configs
  • Use the flat config format with tseslint.config() for ESLint v9 and later
  • Enable type-aware linting by adding parserOptions.project pointing to tsconfig
  • Extend preset configs like recommended, strict, or stylistic based on team preference
  • Configure individual rules in the rules object to match your coding standards

Key Features

  • Type-aware analysis catches async errors, type mismatches, and unsafe any usage
  • Preset configurations from lenient to strict for progressive adoption
  • Full support for ESLint flat config and shared config extension
  • Automatic fixing for many rules including type imports and naming conventions
  • Active maintenance with regular releases aligned to TypeScript and ESLint updates

Comparison with Similar Tools

  • ESLint — core linter for JavaScript; typescript-eslint extends it to TypeScript
  • Biome — all-in-one linter and formatter; typescript-eslint integrates with the ESLint ecosystem
  • TSLint — deprecated TypeScript linter; typescript-eslint is its official successor
  • Oxlint — Rust-based fast linter; typescript-eslint offers deeper type-aware analysis
  • Prettier — code formatter only; typescript-eslint is a linter with optional style rules

FAQ

Q: Do I still need ESLint if I use typescript-eslint? A: Yes. typescript-eslint is a plugin and parser for ESLint, not a standalone tool.

Q: Does type-aware linting slow down my editor? A: It adds some overhead since it runs the TypeScript type checker. Most projects see acceptable performance with project references.

Q: Can I use it with JavaScript files too? A: Yes. The parser handles both TypeScript and JavaScript, and many rules apply to both.

Q: Should I migrate from TSLint? A: Yes. TSLint is deprecated and typescript-eslint is the officially recommended replacement.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产