UNPKG

eslint-codemod-utils

Version:

A collection of AST helper functions for more complex ESLint rule fixes.

171 lines (170 loc) 4.47 kB
import { TSESTree } from '@typescript-eslint/types'; import type { StringableASTNodeFn } from './types'; /** * __TSAsExpression__ * * @example * ```ts * const x = 'hello' as string * ^^^^^^^^^^^^^^^^^ * ``` * * @returns {TSESTree.TSAsExpression} */ export declare const tsAsExpression: StringableASTNodeFn<TSESTree.TSAsExpression>; /** * __TSStringKeyword__ * * @example * ```ts * const x = 'hello' as string * ^^^^^^ * ``` * * @returns {TSESTree.TSStringKeyword} */ export declare const tsStringKeyword: StringableASTNodeFn<TSESTree.TSStringKeyword>; /** * __TSAnyKeyword__ * * @example * ```ts * const x = 'hello' as any * ^^^ * ``` * * @returns {TSESTree.TSAnyKeyword} */ export declare const tsAnyKeyword: StringableASTNodeFn<TSESTree.TSAnyKeyword>; /** * __TSTypeReference__ * * @example * ```ts * type World = string * * const x = 'hello' as World * ^^^^^^^ * ``` * * @returns {TSESTree.TSTypeReference} */ export declare const tsTypeReference: StringableASTNodeFn<TSESTree.TSTypeReference>; /** * __TSNullKeyword__ * * @example * ```ts * const x = 'hello' as null * ^^^^ * ``` * * @returns {TSESTree.TSNullKeyword} */ export declare const tsNullKeyword: StringableASTNodeFn<TSESTree.TSNullKeyword>; export declare const tsUnknownKeyword: StringableASTNodeFn<TSESTree.TSUnknownKeyword>; export declare const tsBooleanKeyword: StringableASTNodeFn<TSESTree.TSBooleanKeyword>; export declare const tsReadonlyKeyword: StringableASTNodeFn<TSESTree.TSReadonlyKeyword>; export declare const tsEmptyBodyFunctionExpression: StringableASTNodeFn<TSESTree.TSEmptyBodyFunctionExpression>; export declare const tsQualifiedName: StringableASTNodeFn<TSESTree.TSQualifiedName>; export declare const tsTypeParameterInstantiation: StringableASTNodeFn<TSESTree.TSTypeParameterInstantiation>; export declare const tsTypeParameterDeclaration: StringableASTNodeFn<TSESTree.TSTypeParameterDeclaration>; /** * __TSTypeOperator__ * * @example * ``` * type X = 'hello' * type Y = typeof X * ^^^^^^^^ * ``` */ export declare const tsTypeOperator: StringableASTNodeFn<TSESTree.TSTypeOperator>; /** * __TSTypeQuery__ * * @example * ``` * type X = typeof 'hello' * ``` */ export declare const tsTypeQuery: StringableASTNodeFn<TSESTree.TSTypeQuery>; /** * FIXME Implementation does not meet spec */ export declare const tsTypeParameter: StringableASTNodeFn<TSESTree.TSTypeParameter>; export declare const tsLiteralType: StringableASTNodeFn<TSESTree.TSLiteralType>; /** * @example * ``` * element!.select() * ^^^^^^^^ * ``` */ export declare const tsNonNullExpression: StringableASTNodeFn<TSESTree.TSNonNullExpression>; /** * __TSTypeAliasDeclaration__ * @example * ``` * type Alias = number | boolean * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ * ``` */ export declare const tsTypeAliasDeclaration: StringableASTNodeFn<TSESTree.TSTypeAliasDeclaration>; /** * __TSUnionType__ * @example * ``` * type Alias = number | boolean * ^^^^^^^^^^^^^^^^ * ``` */ export declare const tsUnionType: StringableASTNodeFn<TSESTree.TSUnionType>; /** * __TSIntersectionType__ * @example * ``` * type Alias = number & boolean * ^^^^^^^^^^^^^^^^ * ``` */ export declare const tsIntersectionType: StringableASTNodeFn<TSESTree.TSIntersectionType>; /** * __TSArrayType__ * @example * ``` * type Alias = number[] * ^^^^^^^^ * ``` */ export declare const tsArrayType: StringableASTNodeFn<TSESTree.TSArrayType>; /** * __TSSatisfiesExpression__ */ export declare const tsSatisfiesExpression: StringableASTNodeFn<TSESTree.TSSatisfiesExpression>; /** * __TSConditionalType__ */ export declare const tsConditionalType: StringableASTNodeFn<TSESTree.TSConditionalType>; /** * __TSVoidKeyword__ * @example * ``` * function x(): void {} * ^^^^ * ``` */ export declare const tsVoidKeyword: StringableASTNodeFn<TSESTree.TSVoidKeyword>; /** * __TSAbstractKeyword__ * * @example * ``` * abstract class X {} * ^^^^^^^^ * ``` */ export declare const tsAbstractKeyword: StringableASTNodeFn<TSESTree.TSAbstractKeyword>; export declare const tsUndefinedKeyword: StringableASTNodeFn<TSESTree.TSUndefinedKeyword>; export declare const tsNeverKeyword: StringableASTNodeFn<TSESTree.TSNeverKeyword>; export declare const tsAsyncKeyword: StringableASTNodeFn<TSESTree.TSAsyncKeyword>;