UNPKG

eslint-codemod-utils

Version:

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

142 lines (141 loc) 3.69 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>; export declare const tsSatisfiesExpression: StringableASTNodeFn<TSESTree.TSSatisfiesExpression>;