schangxiang@126.com
2025-09-19 0821aa23eabe557c0d9ef5dbe6989c68be35d1fe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/**
 * @license
 * Copyright 2018 Palantir Technologies, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/// <reference types="node" />
import * as ts from "typescript";
/**
 * Enforces the invariant that the input is an array.
 */
export declare function arrayify<T>(arg?: T | T[]): T[];
/**
 * @deprecated (no longer used)
 * Enforces the invariant that the input is an object.
 */
export declare function objectify(arg: any): any;
export declare function hasOwnProperty(arg: {}, key: string): boolean;
/**
 * Replace hyphens in a rule name by upper-casing the letter after them.
 * E.g. "foo-bar" -> "fooBar"
 */
export declare function camelize(stringWithHyphens: string): string;
export declare function isUpperCase(str: string): boolean;
export declare function isLowerCase(str: string): boolean;
/**
 * Removes leading indents from a template string without removing all leading whitespace
 */
export declare function dedent(strings: TemplateStringsArray, ...values: any[]): string;
/**
 * Strip comments from file content.
 */
export declare function stripComments(content: string): string;
/**
 * Escapes all special characters in RegExp pattern to avoid broken regular expressions and ensure proper matches
 */
export declare function escapeRegExp(re: string): string;
/** Return true if both parameters are equal. */
export declare type Equal<T> = (a: T, b: T) => boolean;
export declare function arraysAreEqual<T>(a: ReadonlyArray<T> | undefined, b: ReadonlyArray<T> | undefined, eq: Equal<T>): boolean;
/** Returns the first non-`undefined` result. */
export declare function find<T, U>(inputs: T[], getResult: (t: T) => U | undefined): U | undefined;
/** Returns an array that is the concatenation of all output arrays. */
export declare function flatMap<T, U>(inputs: ReadonlyArray<T>, getOutputs: (input: T, index: number) => ReadonlyArray<U>): U[];
/** Returns an array of all outputs that are not `undefined`. */
export declare function mapDefined<T, U>(inputs: ReadonlyArray<T>, getOutput: (input: T) => U | undefined): U[];
export declare function readBufferWithDetectedEncoding(buffer: Buffer): string;
export declare type Encoding = "utf8" | "utf8-bom" | "utf16le" | "utf16be";
export declare function detectBufferEncoding(buffer: Buffer, length?: number): Encoding;
export declare function denormalizeWinPath(path: string): string;
export declare function isPascalCased(name: string): boolean;
export declare function isCamelCased(name: string): boolean;
export declare function isKebabCased(name: string): boolean;
export declare function isSnakeCased(name: string): boolean;
/**
 * Tries to resolve a package by name, optionally relative to a file path. If the
 * file path is under a symlink, it tries to resolve the package under both the real path and under
 * the symlink path.
 */
export declare function tryResolvePackage(packageName: string, relativeTo?: string): string | undefined;
/**
 * Gets the full indentation of the provided node
 */
export declare function getIndentation(node: ts.Node, sourceFile: ts.SourceFile): string;
/**
 * Creates x new lines with a proper indentation at the last one based on the provided node
 */
export declare function newLineWithIndentation(node: ts.Node, sourceFile: ts.SourceFile, linesCount?: number): string;
/**
 * @deprecated Copied from tsutils 2.27.2. This will be removed once TSLint requires tsutils > 3.0.
 */
export declare function isFunctionScopeBoundary(node: ts.Node): boolean;