Skip to main content

@typescript-eslint/utils

npm: @typescript-eslint/utils v8.30.1

一起使用 TypeScript + ESLint 的实用程序。✨

¥Utilities for working with TypeScript + ESLint together. ✨

该包包含用于在 TypeScript 中编写自定义规则和插件的公共实用程序。使用这些实用函数创建在 @typescript-eslint/eslint-plugin 中声明的规则。你通常编写的任何自定义规则也将如此。

¥This package contains public utilities for writing custom rules and plugins in TypeScript. Rules declared in @typescript-eslint/eslint-plugin are created using these utility functions. Any custom rules you write generally will be as well.

请参阅 自定义规则 以获取有关为 TypeScript 代码创建自己的自定义 ESLint 规则的文档。

¥See Custom Rules for documentation on creating your own custom ESLint rules for TypeScript code.

导出

¥Exports

名称描述
AST_NODE_TYPES带有在 TSESTree 中找到的每个节点名称的枚举。
AST_TOKEN_TYPES带有在 TSESTree 中找到的每个标记名称的枚举。
ASTUtils用于在 ESTree AST 上操作的工具。还包括 @eslint-community/eslint-utils 包,正确输入以与 TSESTree 中的类型一起使用
ESLintUtils使用 TypeScript 创建 ESLint 规则的工具。
JSONSchemaJSON Schema v4 规范的严格类型 - ESLint 用于验证所有规则的版本。
ParserServices使用 @typescript-eslint/typescript-estree 解析文件时提供的解析器服务的类型。
TSESLintESLint 的类型,正确输入以与 TSESTree 中找到的类型一起使用。
TSESLintScopeeslint-scope 包,正确输入以与 TSESTreeTSESLint 中的类型一起使用
TSESTree@typescript-eslint/typescript-estree 创建的 TypeScript 风格的 ESTree 的类型。