tslint
- Version 6.1.3
- Published
- 1.89 MB
- 13 dependencies
- Apache-2.0 license
Install
npm i tslint
yarn add tslint
pnpm add tslint
Overview
An extensible static analysis linter for the TypeScript language
Index
Variables
Functions
- ancestorWhere()
- childOfKind()
- doesIntersect()
- findFormatter()
- forEachComment()
- forEachToken()
- getBindingElementVariableDeclaration()
- getEqualsKind()
- getSourceFile()
- hasCommentAfterPosition()
- hasModifier()
- isAssignment()
- isBlockScopeBoundary()
- isBlockScopedBindingElement()
- isBlockScopedVariable()
- isCombinedModifierFlagSet()
- isCombinedNodeFlagSet()
- isLoop()
- isNegativeNumberLiteral()
- isNestedModuleDeclaration()
- isNodeFlagSet()
- isNumeric()
- isObjectFlagSet()
- isScopeBoundary()
- isStrictNullChecksEnabled()
- isSymbolFlagSet()
- isTypedRule()
- isTypeFlagSet()
- isWhiteSpace()
- loadRules()
- removeDisabledFailures()
- someAncestor()
- unwrapParentheses()
Classes
SyntaxWalker
- visitAnyKeyword()
- visitArrayLiteralExpression()
- visitArrayType()
- visitArrowFunction()
- visitBinaryExpression()
- visitBindingElement()
- visitBindingPattern()
- visitBlock()
- visitBreakStatement()
- visitCallExpression()
- visitCallSignature()
- visitCaseClause()
- visitCatchClause()
- visitClassDeclaration()
- visitClassExpression()
- visitConditionalExpression()
- visitConstructorDeclaration()
- visitConstructorType()
- visitConstructSignature()
- visitContinueStatement()
- visitDebuggerStatement()
- visitDefaultClause()
- visitDoStatement()
- visitElementAccessExpression()
- visitEndOfFileToken()
- visitEnumDeclaration()
- visitEnumMember()
- visitExportAssignment()
- visitExpressionStatement()
- visitForInStatement()
- visitForOfStatement()
- visitForStatement()
- visitFunctionDeclaration()
- visitFunctionExpression()
- visitFunctionType()
- visitGetAccessor()
- visitIdentifier()
- visitIfStatement()
- visitImportDeclaration()
- visitImportEqualsDeclaration()
- visitIndexSignatureDeclaration()
- visitInterfaceDeclaration()
- visitJsxAttribute()
- visitJsxElement()
- visitJsxExpression()
- visitJsxSelfClosingElement()
- visitJsxSpreadAttribute()
- visitLabeledStatement()
- visitMethodDeclaration()
- visitMethodSignature()
- visitModuleDeclaration()
- visitNamedImports()
- visitNamespaceImport()
- visitNewExpression()
- visitNode()
- visitNonNullExpression()
- visitNumericLiteral()
- visitObjectLiteralExpression()
- visitParameterDeclaration()
- visitPostfixUnaryExpression()
- visitPrefixUnaryExpression()
- visitPropertyAccessExpression()
- visitPropertyAssignment()
- visitPropertyDeclaration()
- visitPropertySignature()
- visitRegularExpressionLiteral()
- visitReturnStatement()
- visitSetAccessor()
- visitSourceFile()
- visitStringLiteral()
- visitSwitchStatement()
- visitTemplateExpression()
- visitThrowStatement()
- visitTryStatement()
- visitTupleType()
- visitTypeAliasDeclaration()
- visitTypeAssertionExpression()
- visitTypeLiteral()
- visitTypeReference()
- visitVariableDeclaration()
- visitVariableDeclarationList()
- visitVariableStatement()
- visitWhileStatement()
- visitWithStatement()
- walk()
- walkChildren()
Interfaces
Type Aliases
Namespaces
Configuration
- CONFIG_FILENAME
- CONFIG_FILENAMES
- convertRuleOptions()
- DEFAULT_CONFIG
- EMPTY_CONFIG
- extendConfigurationFile()
- findConfiguration()
- findConfigurationPath()
- getRelativePath()
- getRulesDirectories()
- IConfigurationFile
- IConfigurationLoadResult
- isFileExcluded()
- JSON_CONFIG_FILENAME
- loadConfigurationFromPath()
- parseConfigFile()
- RawConfigFile
- RawRuleConfig
- RawRulesConfig
- readConfigurationFile()
- stringifyConfiguration()
- useAsPath()
Utils
- arrayify()
- arraysAreEqual()
- camelize()
- dedent()
- denormalizeWinPath()
- detectBufferEncoding()
- Encoding
- Equal
- escapeRegExp()
- find()
- flatMap()
- getIndentation()
- hasOwnProperty()
- isCamelCased()
- isFunctionScopeBoundary()
- isKebabCased()
- isLowerCase()
- isPascalCased()
- isSnakeCased()
- isUpperCase()
- mapDefined()
- newLineWithIndentation()
- objectify()
- readBufferWithDetectedEncoding()
- stripComments()
- trimSingleQuotes()
- tryResolvePackage()
Variables
variable ENABLE_DISABLE_REGEX
const ENABLE_DISABLE_REGEX: RegExp;
regex is: start of string followed by any amount of whitespace followed by tslint and colon followed by either "enable" or "disable" followed optionally by -line or -next-line followed by either colon, whitespace or end of string
Functions
function ancestorWhere
ancestorWhere: <T extends ts.Node = ts.Node>( node: ts.Node, predicate: ((n: ts.Node) => n is T) | ((n: ts.Node) => boolean)) => T | undefined;
function childOfKind
childOfKind: (node: ts.Node, kind: ts.SyntaxKind) => ts.Node | undefined;
Finds a child of a given node with a given kind. Note: This uses
node.getChildren()
, which does extra parsing work to include tokens.Deprecated
use
getChildOfKind
fromtsutils
function doesIntersect
doesIntersect: ( failure: RuleFailure, disabledIntervals: IDisabledInterval[]) => boolean;
Deprecated
See IDisabledInterval.
function findFormatter
findFormatter: ( name: string | FormatterConstructor, formattersDirectory?: string) => FormatterConstructor | undefined;
function forEachComment
forEachComment: (node: ts.Node, cb: ForEachCommentCallback) => void;
Iterate over all comments owned by
node
or its childrenDeprecated
use
forEachComment
fromtsutils
function forEachToken
forEachToken: ( node: ts.Node, skipTrivia: boolean, cb: ForEachTokenCallback, filter?: FilterCallback) => void;
Iterate over all tokens of
node
JsDoc comments are treated like regular comments and only visited if
skipTrivia
=== false.Parameter node
The node whose tokens should be visited
Parameter skipTrivia
If set to false all trivia preceeding
node
or any of its children is includedParameter cb
Is called for every token of
node
. It gets the full text of the SourceFile and the position of the token within that text.Parameter filter
If provided, will be called for every Node and Token found. If it returns false
cb
will not be called for this subtree.Deprecated
use
forEachToken
orforEachTokenWithTrivia
fromtsutils
function getBindingElementVariableDeclaration
getBindingElementVariableDeclaration: ( node: ts.BindingElement) => ts.VariableDeclaration | null;
Deprecated
use
getDeclarationOfBindingElement
fromtsutils
function getEqualsKind
getEqualsKind: (node: ts.BinaryOperatorToken) => EqualsKind | undefined;
function getSourceFile
getSourceFile: (fileName: string, source: string) => ts.SourceFile;
function hasCommentAfterPosition
hasCommentAfterPosition: (text: string, position: number) => boolean;
Checks if there are any comments between
position
and the next non-trivia tokenParameter text
The text to scan
Parameter position
The position inside
text
where to start scanning. Make sure that this is a valid start position. This value is typically obtained fromnode.getFullStart()
ornode.getEnd()
function hasModifier
hasModifier: ( modifiers: ts.ModifiersArray | undefined, ...modifierKinds: ts.SyntaxKind[]) => boolean;
Returns
true if any modifier kinds passed along exist in the given modifiers array
Deprecated
use
hasModifier
fromtsutils
function isAssignment
isAssignment: (node: ts.Node) => boolean;
Deprecated
use
isBinaryExpression(node) && isAssignmentKind(node.operatorToken.kind)
with functions fromtsutils
function isBlockScopeBoundary
isBlockScopeBoundary: (node: ts.Node) => boolean;
Deprecated
use
isBlockScopeBoundary
fromtsutils
function isBlockScopedBindingElement
isBlockScopedBindingElement: (node: ts.BindingElement) => boolean;
Deprecated
use
isBlockScopedVariableDeclarationList
andgetDeclarationOfBindingElement
fromtsutils
function isBlockScopedVariable
isBlockScopedVariable: ( node: ts.VariableDeclaration | ts.VariableStatement) => boolean;
Determines if the appropriate bit in the parent (VariableDeclarationList) is set, which indicates this is a "let" or "const".
Deprecated
use
isBlockScopedVariableDeclarationList
fromtsutils
function isCombinedModifierFlagSet
isCombinedModifierFlagSet: ( node: ts.Declaration, flagToCheck: ts.ModifierFlags) => boolean;
Bitwise check for combined modifier flags.
Deprecated
no longer used
function isCombinedNodeFlagSet
isCombinedNodeFlagSet: (node: ts.Node, flagToCheck: ts.NodeFlags) => boolean;
Bitwise check for combined node flags.
Deprecated
no longer used
function isLoop
isLoop: (node: ts.Node) => node is ts.IterationStatement;
Deprecated
use
isIterationStatement
fromtsutils
ortypescript
function isNegativeNumberLiteral
isNegativeNumberLiteral: (node: ts.Node) => node is any;
function isNestedModuleDeclaration
isNestedModuleDeclaration: (decl: ts.ModuleDeclaration) => boolean;
Returns
true if decl is a nested module declaration, i.e. represents a segment of a dotted module path.
Deprecated
use
decl.parent!.kind === ts.SyntaxKind.ModuleDeclaration
function isNodeFlagSet
isNodeFlagSet: (node: ts.Node, flagToCheck: ts.NodeFlags) => boolean;
Bitwise check for node flags.
Deprecated
use
isNodeFlagSet
fromtsutils
function isNumeric
isNumeric: (node: ts.Expression) => boolean;
Returns
Whether node is a numeric expression.
function isObjectFlagSet
isObjectFlagSet: ( objectType: ts.ObjectType, flagToCheck: ts.ObjectFlags) => boolean;
Bitwise check for object flags. Does not work with TypeScript 2.0.x
Deprecated
use
isObjectFlagSet
fromtsutils
function isScopeBoundary
isScopeBoundary: (node: ts.Node) => boolean;
Deprecated
use
isFunctionScopeBoundary
fromtsutils
function isStrictNullChecksEnabled
isStrictNullChecksEnabled: (options: ts.CompilerOptions) => boolean;
function isSymbolFlagSet
isSymbolFlagSet: (symbol: ts.Symbol, flagToCheck: ts.SymbolFlags) => boolean;
Bitwise check for symbol flags.
Deprecated
use
isSymbolFlagSet
fromtsutils
function isTypedRule
isTypedRule: (rule: IRule) => rule is ITypedRule;
function isTypeFlagSet
isTypeFlagSet: (type: ts.Type, flagToCheck: ts.TypeFlags) => boolean;
Bitwise check for type flags.
Deprecated
use
isTypeFlagSet
fromtsutils
function isWhiteSpace
isWhiteSpace: (ch: number) => boolean;
Wrapper for compatibility with typescript@<2.3.1
function loadRules
loadRules: ( ruleOptionsList: IOptions[], rulesDirectories?: string | string[], isJs?: boolean) => IRule[];
function removeDisabledFailures
removeDisabledFailures: ( sourceFile: ts.SourceFile, failures: RuleFailure[]) => RuleFailure[];
function someAncestor
someAncestor: (node: ts.Node, predicate: (n: ts.Node) => boolean) => boolean;
Returns
true if some ancestor of
node
satisfiespredicate
, includingnode
itself.Deprecated
no longer used, use a
while
loop instead
function unwrapParentheses
unwrapParentheses: (node: ts.Expression) => ts.Expression;
Classes
class AbstractWalker
abstract class AbstractWalker<T = undefined> extends WalkContext<T> implements IWalker {}
method getFailures
getFailures: () => RuleFailure[];
method getSourceFile
getSourceFile: () => ts.SourceFile;
method walk
abstract walk: (sourceFile: ts.SourceFile) => void;
class BlockScopeAwareRuleWalker
abstract class BlockScopeAwareRuleWalker<T, U> extends ScopeAwareRuleWalker<T> {}
Deprecated
See comment on ScopeAwareRuleWalker.
An AST walker that is aware of block scopes in addition to regular scopes. Block scopes are a superset of regular scopes (new block scopes are created more frequently in a program).
constructor
constructor(sourceFile: ts.SourceFile, options: IOptions);
method createBlockScope
abstract createBlockScope: (node: ts.Node) => U;
method findBlockScope
findBlockScope: (predicate: (scope: U) => boolean) => U | undefined;
method getAllBlockScopes
getAllBlockScopes: () => U[];
method getCurrentBlockDepth
getCurrentBlockDepth: () => number;
method getCurrentBlockScope
getCurrentBlockScope: () => U;
method onBlockScopeEnd
onBlockScopeEnd: () => void;
method onBlockScopeStart
onBlockScopeStart: () => void;
method visitNode
protected visitNode: (node: ts.Node) => void;
class Linter
class Linter {}
Linter that can lint multiple files in consecutive runs.
constructor
constructor(options: ILinterOptions, program?: any);
property findConfiguration
static findConfiguration: { (configFile: string, inputFilePath: string): IConfigurationLoadResult; (configFile: string, inputFilePath?: string): IConfigurationLoadResult;};
property findConfigurationPath
static findConfigurationPath: { (suppliedConfigFilePath: string, inputFilePath: string): string; (suppliedConfigFilePath: string, inputFilePath?: string): string;};
property getRulesDirectories
static getRulesDirectories: ( directories?: string | string[], relativeTo?: string) => string[];
property loadConfigurationFromPath
static loadConfigurationFromPath: ( configFilePath?: string, _originalFilePath?: string) => IConfigurationFile;
property VERSION
static VERSION: string;
method applyFixes
protected applyFixes: ( sourceFilePath: string, source: string, fixableFailures: RuleFailure[]) => string;
method createProgram
static createProgram: ( configFile: string, projectDirectory?: string) => ts.Program;
Creates a TypeScript program object from a tsconfig.json file path and optional project directory.
method getFileNames
static getFileNames: (program: ts.Program) => string[];
Returns a list of source file names from a TypeScript program. This includes all referenced files and excludes declaration (".d.ts") files, as well as JSON files, to avoid problems with
resolveJsonModule
.
method getResult
getResult: () => LintResult;
method lint
lint: ( fileName: string, source: string, configuration?: IConfigurationFile) => void;
class ProgramAwareRuleWalker
class ProgramAwareRuleWalker extends RuleWalker {}
See Also
https://github.com/palantir/tslint/issues/2522
Deprecated
RuleWalker-based rules are slow, so it's generally preferable to use applyWithFunction instead of applyWithWalker.
constructor
constructor(sourceFile: ts.SourceFile, options: IOptions, program: ts.Program);
method getProgram
getProgram: () => ts.Program;
method getTypeChecker
getTypeChecker: () => ts.TypeChecker;
class Replacement
class Replacement {}
constructor
constructor(start: number, length: number, text: string);
property end
readonly end: number;
property length
readonly length: number;
property start
readonly start: number;
property text
readonly text: string;
method appendText
static appendText: (start: number, text: string) => Replacement;
method apply
apply: (content: string) => string;
method applyAll
static applyAll: (content: string, replacements: Replacement[]) => string;
method applyFixes
static applyFixes: (content: string, fixes: Fix[]) => string;
method deleteFromTo
static deleteFromTo: (start: number, end: number) => Replacement;
method deleteText
static deleteText: (start: number, length: number) => Replacement;
method replaceFromTo
static replaceFromTo: (start: number, end: number, text: string) => Replacement;
method replaceNode
static replaceNode: ( node: ts.Node, text: string, sourceFile?: ts.SourceFile) => Replacement;
method toJson
toJson: () => ReplacementJson;
class RuleFailure
class RuleFailure {}
constructor
constructor( sourceFile: ts.SourceFile, start: number, end: number, failure: string, ruleName: string, fix?: Replacement | Replacement[]);
method compare
static compare: (a: RuleFailure, b: RuleFailure) => number;
method equals
equals: (ruleFailure: RuleFailure) => boolean;
method getEndPosition
getEndPosition: () => RuleFailurePosition;
method getFailure
getFailure: () => string;
method getFileName
getFileName: () => string;
method getFix
getFix: () => Replacement | Replacement[] | undefined;
method getRawLines
getRawLines: () => string;
method getRuleName
getRuleName: () => string;
method getRuleSeverity
getRuleSeverity: () => RuleSeverity;
method getStartPosition
getStartPosition: () => RuleFailurePosition;
method hasFix
hasFix: () => boolean;
method setRuleSeverity
setRuleSeverity: (value: RuleSeverity) => void;
method toJson
toJson: () => IRuleFailureJson;
class RuleFailurePosition
class RuleFailurePosition {}
constructor
constructor(position: number, lineAndCharacter: ts.LineAndCharacter);
method equals
equals: (ruleFailurePosition: RuleFailurePosition) => boolean;
method getLineAndCharacter
getLineAndCharacter: () => ts.LineAndCharacter;
method getPosition
getPosition: () => number;
method toJson
toJson: () => IRuleFailurePositionJson;
class RuleWalker
class RuleWalker extends SyntaxWalker implements IWalker {}
See Also
https://github.com/palantir/tslint/issues/2522
Deprecated
RuleWalker-based rules are slow, so it's generally preferable to use applyWithFunction instead of applyWithWalker.
constructor
constructor(sourceFile: ts.SourceFile, options: IOptions);
method addFailure
addFailure: (failure: RuleFailure) => void;
Deprecated
Prefer
addFailureAt
and its variants.
method addFailureAt
addFailureAt: (start: number, width: number, failure: string, fix?: Fix) => void;
Add a failure with any arbitrary span. Prefer
addFailureAtNode
if possible.
method addFailureAtNode
addFailureAtNode: (node: ts.Node, failure: string, fix?: Fix) => void;
Add a failure using a node's span.
method addFailureFromStartToEnd
addFailureFromStartToEnd: ( start: number, end: number, failure: string, fix?: Fix) => void;
Like
addFailureAt
but uses start and end instead of start and width.
method appendText
appendText: (start: number, text: string) => Replacement;
method createFailure
createFailure: ( start: number, width: number, failure: string, fix?: Fix) => RuleFailure;
Deprecated
Prefer
addFailureAt
and its variants.
method createReplacement
createReplacement: (start: number, length: number, text: string) => Replacement;
method deleteFromTo
deleteFromTo: (start: number, end: number) => Replacement;
method deleteText
deleteText: (start: number, length: number) => Replacement;
method getFailures
getFailures: () => RuleFailure[];
method getLimit
getLimit: () => number;
method getLineAndCharacterOfPosition
getLineAndCharacterOfPosition: (position: number) => ts.LineAndCharacter;
method getOptions
getOptions: () => any;
method getRuleName
getRuleName: () => string;
method getSourceFile
getSourceFile: () => ts.SourceFile;
method hasOption
hasOption: (option: string) => boolean;
class ScopeAwareRuleWalker
abstract class ScopeAwareRuleWalker<T> extends RuleWalker {}
Deprecated
Prefer to manually maintain any contextual information.
For example, imagine a
no-break
rule that warns onbreak
infor
but not inswitch
:function walk(ctx: Lint.WalkContext): void { let isInFor = false; ts.forEachChild(ctx.sourceFile, function cb(node: ts.Node): void { switch (node.kind) { case ts.SyntaxKind.Break: if (isInFor) { ctx.addFailureAtNode(node, "!"); } break; case ts.SyntaxKind.ForStatement: { const old = isInFor; isInFor = true; ts.forEachChild(node, cb); isInFor = old; break; } case ts.SyntaxKind.SwitchStatement: { const old = isInFor; isInFor = false; ts.forEachChild(node, cb); isInFor = old; break; } default: ts.forEachChild(node, cb); } }); }
constructor
constructor(sourceFile: ts.SourceFile, options: IOptions);
method createScope
abstract createScope: (node: ts.Node) => T;
method getAllScopes
getAllScopes: () => T[];
method getCurrentDepth
getCurrentDepth: () => number;
method getCurrentScope
getCurrentScope: () => T;
method isScopeBoundary
protected isScopeBoundary: (node: ts.Node) => boolean;
method onScopeEnd
onScopeEnd: () => void;
method onScopeStart
onScopeStart: () => void;
method visitNode
protected visitNode: (node: ts.Node) => void;
class SyntaxWalker
class SyntaxWalker {}
method visitAnyKeyword
protected visitAnyKeyword: (node: ts.Node) => void;
method visitArrayLiteralExpression
protected visitArrayLiteralExpression: (node: ts.ArrayLiteralExpression) => void;
method visitArrayType
protected visitArrayType: (node: ts.ArrayTypeNode) => void;
method visitArrowFunction
protected visitArrowFunction: (node: ts.ArrowFunction) => void;
method visitBinaryExpression
protected visitBinaryExpression: (node: ts.BinaryExpression) => void;
method visitBindingElement
protected visitBindingElement: (node: ts.BindingElement) => void;
method visitBindingPattern
protected visitBindingPattern: (node: ts.BindingPattern) => void;
method visitBlock
protected visitBlock: (node: ts.Block) => void;
method visitBreakStatement
protected visitBreakStatement: (node: ts.BreakOrContinueStatement) => void;
method visitCallExpression
protected visitCallExpression: (node: ts.CallExpression) => void;
method visitCallSignature
protected visitCallSignature: (node: ts.SignatureDeclaration) => void;
method visitCaseClause
protected visitCaseClause: (node: ts.CaseClause) => void;
method visitCatchClause
protected visitCatchClause: (node: ts.CatchClause) => void;
method visitClassDeclaration
protected visitClassDeclaration: (node: ts.ClassDeclaration) => void;
method visitClassExpression
protected visitClassExpression: (node: ts.ClassExpression) => void;
method visitConditionalExpression
protected visitConditionalExpression: (node: ts.ConditionalExpression) => void;
method visitConstructorDeclaration
protected visitConstructorDeclaration: (node: ts.ConstructorDeclaration) => void;
method visitConstructorType
protected visitConstructorType: (node: ts.FunctionOrConstructorTypeNode) => void;
method visitConstructSignature
protected visitConstructSignature: ( node: ts.ConstructSignatureDeclaration) => void;
method visitContinueStatement
protected visitContinueStatement: (node: ts.BreakOrContinueStatement) => void;
method visitDebuggerStatement
protected visitDebuggerStatement: (node: ts.Statement) => void;
method visitDefaultClause
protected visitDefaultClause: (node: ts.DefaultClause) => void;
method visitDoStatement
protected visitDoStatement: (node: ts.DoStatement) => void;
method visitElementAccessExpression
protected visitElementAccessExpression: ( node: ts.ElementAccessExpression) => void;
method visitEndOfFileToken
protected visitEndOfFileToken: (node: ts.Node) => void;
method visitEnumDeclaration
protected visitEnumDeclaration: (node: ts.EnumDeclaration) => void;
method visitEnumMember
protected visitEnumMember: (node: ts.EnumMember) => void;
method visitExportAssignment
protected visitExportAssignment: (node: ts.ExportAssignment) => void;
method visitExpressionStatement
protected visitExpressionStatement: (node: ts.ExpressionStatement) => void;
method visitForInStatement
protected visitForInStatement: (node: ts.ForInStatement) => void;
method visitForOfStatement
protected visitForOfStatement: (node: ts.ForOfStatement) => void;
method visitForStatement
protected visitForStatement: (node: ts.ForStatement) => void;
method visitFunctionDeclaration
protected visitFunctionDeclaration: (node: ts.FunctionDeclaration) => void;
method visitFunctionExpression
protected visitFunctionExpression: (node: ts.FunctionExpression) => void;
method visitFunctionType
protected visitFunctionType: (node: ts.FunctionOrConstructorTypeNode) => void;
method visitGetAccessor
protected visitGetAccessor: (node: ts.AccessorDeclaration) => void;
method visitIdentifier
protected visitIdentifier: (node: ts.Identifier) => void;
method visitIfStatement
protected visitIfStatement: (node: ts.IfStatement) => void;
method visitImportDeclaration
protected visitImportDeclaration: (node: ts.ImportDeclaration) => void;
method visitImportEqualsDeclaration
protected visitImportEqualsDeclaration: ( node: ts.ImportEqualsDeclaration) => void;
method visitIndexSignatureDeclaration
protected visitIndexSignatureDeclaration: ( node: ts.IndexSignatureDeclaration) => void;
method visitInterfaceDeclaration
protected visitInterfaceDeclaration: (node: ts.InterfaceDeclaration) => void;
method visitJsxAttribute
protected visitJsxAttribute: (node: ts.JsxAttribute) => void;
method visitJsxElement
protected visitJsxElement: (node: ts.JsxElement) => void;
method visitJsxExpression
protected visitJsxExpression: (node: ts.JsxExpression) => void;
method visitJsxSelfClosingElement
protected visitJsxSelfClosingElement: (node: ts.JsxSelfClosingElement) => void;
method visitJsxSpreadAttribute
protected visitJsxSpreadAttribute: (node: ts.JsxSpreadAttribute) => void;
method visitLabeledStatement
protected visitLabeledStatement: (node: ts.LabeledStatement) => void;
method visitMethodDeclaration
protected visitMethodDeclaration: (node: ts.MethodDeclaration) => void;
method visitMethodSignature
protected visitMethodSignature: (node: ts.SignatureDeclaration) => void;
method visitModuleDeclaration
protected visitModuleDeclaration: (node: ts.ModuleDeclaration) => void;
method visitNamedImports
protected visitNamedImports: (node: ts.NamedImports) => void;
method visitNamespaceImport
protected visitNamespaceImport: (node: ts.NamespaceImport) => void;
method visitNewExpression
protected visitNewExpression: (node: ts.NewExpression) => void;
method visitNode
protected visitNode: (node: ts.Node) => void;
method visitNonNullExpression
protected visitNonNullExpression: (node: ts.NonNullExpression) => void;
method visitNumericLiteral
protected visitNumericLiteral: (node: ts.NumericLiteral) => void;
method visitObjectLiteralExpression
protected visitObjectLiteralExpression: ( node: ts.ObjectLiteralExpression) => void;
method visitParameterDeclaration
protected visitParameterDeclaration: (node: ts.ParameterDeclaration) => void;
method visitPostfixUnaryExpression
protected visitPostfixUnaryExpression: (node: ts.PostfixUnaryExpression) => void;
method visitPrefixUnaryExpression
protected visitPrefixUnaryExpression: (node: ts.PrefixUnaryExpression) => void;
method visitPropertyAccessExpression
protected visitPropertyAccessExpression: ( node: ts.PropertyAccessExpression) => void;
method visitPropertyAssignment
protected visitPropertyAssignment: (node: ts.PropertyAssignment) => void;
method visitPropertyDeclaration
protected visitPropertyDeclaration: (node: ts.PropertyDeclaration) => void;
method visitPropertySignature
protected visitPropertySignature: (node: ts.Node) => void;
method visitRegularExpressionLiteral
protected visitRegularExpressionLiteral: (node: ts.Node) => void;
method visitReturnStatement
protected visitReturnStatement: (node: ts.ReturnStatement) => void;
method visitSetAccessor
protected visitSetAccessor: (node: ts.AccessorDeclaration) => void;
method visitSourceFile
protected visitSourceFile: (node: ts.SourceFile) => void;
method visitStringLiteral
protected visitStringLiteral: (node: ts.StringLiteral) => void;
method visitSwitchStatement
protected visitSwitchStatement: (node: ts.SwitchStatement) => void;
method visitTemplateExpression
protected visitTemplateExpression: (node: ts.TemplateExpression) => void;
method visitThrowStatement
protected visitThrowStatement: (node: ts.ThrowStatement) => void;
method visitTryStatement
protected visitTryStatement: (node: ts.TryStatement) => void;
method visitTupleType
protected visitTupleType: (node: ts.TupleTypeNode) => void;
method visitTypeAliasDeclaration
protected visitTypeAliasDeclaration: (node: ts.TypeAliasDeclaration) => void;
method visitTypeAssertionExpression
protected visitTypeAssertionExpression: (node: ts.TypeAssertion) => void;
method visitTypeLiteral
protected visitTypeLiteral: (node: ts.TypeLiteralNode) => void;
method visitTypeReference
protected visitTypeReference: (node: ts.TypeReferenceNode) => void;
method visitVariableDeclaration
protected visitVariableDeclaration: (node: ts.VariableDeclaration) => void;
method visitVariableDeclarationList
protected visitVariableDeclarationList: ( node: ts.VariableDeclarationList) => void;
method visitVariableStatement
protected visitVariableStatement: (node: ts.VariableStatement) => void;
method visitWhileStatement
protected visitWhileStatement: (node: ts.WhileStatement) => void;
method visitWithStatement
protected visitWithStatement: (node: ts.WithStatement) => void;
method walk
walk: (node: ts.Node) => void;
method walkChildren
protected walkChildren: (node: ts.Node) => void;
class WalkContext
class WalkContext<T = undefined> {}
constructor
constructor(sourceFile: ts.SourceFile, ruleName: string, options: {});
property failures
readonly failures: RuleFailure[];
property options
readonly options: {};
property ruleName
readonly ruleName: string;
property sourceFile
readonly sourceFile: ts.SourceFile;
method addFailure
addFailure: (start: number, end: number, failure: string, fix?: Fix) => void;
method addFailureAt
addFailureAt: (start: number, width: number, failure: string, fix?: Fix) => void;
Add a failure with any arbitrary span. Prefer
addFailureAtNode
if possible.
method addFailureAtNode
addFailureAtNode: (node: ts.Node, failure: string, fix?: Fix) => void;
Add a failure using a node's span.
Interfaces
interface EqualsKind
interface EqualsKind {}
property isPositive
isPositive: boolean;
property isStrict
isStrict: boolean;
interface FormatterConstructor
interface FormatterConstructor {}
construct signature
new (): IFormatter;
interface ICodeExample
interface ICodeExample {}
property config
config: string;
property description
description: string;
property fail
fail?: string;
property pass
pass: string;
interface IDisabledInterval
interface IDisabledInterval {}
Deprecated
These are now handled internally.
property endPosition
endPosition: number;
property startPosition
startPosition: number;
interface IFormatter
interface IFormatter {}
method format
format: ( failures: RuleFailure[], fixes?: RuleFailure[], fileNames?: string[]) => string;
Formats linter results
Parameter failures
Linter failures that were not fixed
Parameter fixes
Fixed linter failures. Available when the
--fix
argument is used on the command lineParameter fileNames
All of the file paths that were linted
interface IFormatterMetadata
interface IFormatterMetadata {}
property consumer
consumer: ConsumerType;
Sample output from the formatter.
property description
description: string;
A short, one line description of what the formatter does.
property descriptionDetails
descriptionDetails?: string;
More elaborate details about the formatter.
property formatterName
formatterName: string;
The name of the formatter.
property sample
sample: string;
Sample output from the formatter.
interface ILinterOptions
interface ILinterOptions {}
property fix
fix: boolean;
property formatter
formatter?: string | FormatterConstructor;
property formattersDirectory
formattersDirectory?: string;
property quiet
quiet?: boolean;
property rulesDirectory
rulesDirectory?: string | string[];
interface IOptions
interface IOptions {}
property disabledIntervals
disabledIntervals: IDisabledInterval[];
Deprecated
Tslint now handles disables itself. This will be empty.
property ruleArguments
ruleArguments: any[];
property ruleName
ruleName: string;
property ruleSeverity
ruleSeverity: RuleSeverity;
interface IRule
interface IRule {}
method apply
apply: (sourceFile: ts.SourceFile) => RuleFailure[];
method applyWithWalker
applyWithWalker: (walker: IWalker) => RuleFailure[];
method getOptions
getOptions: () => IOptions;
method isEnabled
isEnabled: () => boolean;
interface IRuleFailureJson
interface IRuleFailureJson {}
property endPosition
endPosition: IRuleFailurePositionJson;
property failure
failure: string;
property fix
fix?: FixJson;
property name
name: string;
property ruleName
ruleName: string;
property ruleSeverity
ruleSeverity: string;
property startPosition
startPosition: IRuleFailurePositionJson;
interface IRuleFailurePositionJson
interface IRuleFailurePositionJson {}
interface IRuleMetadata
interface IRuleMetadata {}
property codeExamples
codeExamples?: ICodeExample[];
Examples demonstrating what the lint rule will pass and fail
property deprecationMessage
deprecationMessage?: string;
A rule deprecation message, if applicable.
property description
description: string;
A short, one line description of what the rule does.
property descriptionDetails
descriptionDetails?: string;
More elaborate details about the rule.
property hasFix
hasFix?: boolean;
Whether or not the rule will provide fix suggestions.
property optionExamples
optionExamples?: | Array<true | any[]> | string[] | Array<{ options: any; }>;
Examples of what a standard config for the rule might look like. Using a string[] here is deprecated. Write the options as a JSON object instead.
property options
options: any;
Schema of the options the rule accepts. The first boolean for whether the rule is enabled or not is already implied. This field describes the options after that boolean. If null, this rule has no options and is not configurable.
property optionsDescription
optionsDescription: string;
An explanation of the available options for the rule.
property rationale
rationale?: string;
An explanation of why the rule is useful.
property requiresTypeInfo
requiresTypeInfo?: boolean;
Whether or not the rule requires type info to run.
property ruleName
ruleName: string;
The kebab-case name of the rule.
property type
type: RuleType;
The type of the rule - its overall purpose
property typescriptOnly
typescriptOnly: boolean;
Whether or not the rule use for TypeScript only. If
false
, this rule may be used with .js files.
interface ITypedRule
interface ITypedRule extends IRule {}
method applyWithProgram
applyWithProgram: ( sourceFile: ts.SourceFile, program: ts.Program) => RuleFailure[];
interface IWalker
interface IWalker {}
method getFailures
getFailures: () => RuleFailure[];
method getSourceFile
getSourceFile: () => ts.SourceFile;
method walk
walk: (sourceFile: ts.SourceFile) => void;
interface LintResult
interface LintResult {}
property errorCount
errorCount: number;
property failures
failures: RuleFailure[];
property fixes
fixes?: RuleFailure[];
property format
format: string | FormatterConstructor;
property output
output: string;
property warningCount
warningCount: number;
interface ReplacementJson
interface ReplacementJson {}
property innerLength
innerLength: number;
property innerStart
innerStart: number;
property innerText
innerText: string;
interface RuleConstructor
interface RuleConstructor {}
property metadata
metadata: IRuleMetadata;
construct signature
new (options: IOptions): IRule;
interface TokenPosition
interface TokenPosition {}
property end
end: number;
The end of the token
property fullStart
fullStart: number;
The start of the token including all trivia before it
property tokenStart
tokenStart: number;
The start of the token
Type Aliases
type ConsumerType
type ConsumerType = 'human' | 'machine';
type FilterCallback
type FilterCallback = (node: ts.Node) => boolean;
type Fix
type Fix = Replacement | Replacement[];
type FixJson
type FixJson = ReplacementJson | ReplacementJson[];
type ForEachCommentCallback
type ForEachCommentCallback = ( fullText: string, kind: ts.SyntaxKind, pos: TokenPosition) => void;
type ForEachTokenCallback
type ForEachTokenCallback = ( fullText: string, kind: ts.SyntaxKind, pos: TokenPosition, parent: ts.Node) => void;
type RuleSeverity
type RuleSeverity = 'warning' | 'error' | 'off';
type RuleType
type RuleType = | 'functionality' | 'maintainability' | 'style' | 'typescript' | 'formatting';
Namespaces
namespace Configuration
module 'lib/configuration.d.ts' {}
Copyright 2013 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.
variable CONFIG_FILENAME
const CONFIG_FILENAME: string;
Deprecated
use
JSON_CONFIG_FILENAME
orCONFIG_FILENAMES
instead.
variable CONFIG_FILENAMES
const CONFIG_FILENAMES: string[];
variable DEFAULT_CONFIG
const DEFAULT_CONFIG: IConfigurationFile;
variable EMPTY_CONFIG
const EMPTY_CONFIG: IConfigurationFile;
variable JSON_CONFIG_FILENAME
const JSON_CONFIG_FILENAME: string;
function convertRuleOptions
convertRuleOptions: ( ruleConfiguration: Map<string, Partial<IOptions>>) => IOptions[];
Fills in default values for
IOption
properties and outputs an array ofIOption
function extendConfigurationFile
extendConfigurationFile: ( targetConfig: IConfigurationFile, nextConfigSource: IConfigurationFile) => IConfigurationFile;
function findConfiguration
findConfiguration: { (configFile: string | null, inputFilePath: string): IConfigurationLoadResult; (configFile: string, inputFilePath?: string): IConfigurationLoadResult;};
Searches for a TSLint configuration and returns the data from the config.
Parameter configFile
A path to a config file, this can be null if the location of a config is not known
Parameter inputFilePath
A path containing the current file being linted. This is the starting location of the search for a configuration.
Returns
Load status for a TSLint configuration object
function findConfigurationPath
findConfigurationPath: { (suppliedConfigFilePath: string | null, inputFilePath: string): | string | undefined; (suppliedConfigFilePath: string, inputFilePath?: string): string;};
Searches for a TSLint configuration and returns the path to it. Could return undefined if not configuration is found.
Parameter suppliedConfigFilePath
A path to an known config file supplied by a user. Pass null here if the location of the config file is not known and you want to search for one.
Parameter inputFilePath
A path to the current file being linted. This is the starting location of the search for a configuration.
Returns
An absolute path to a tslint.json or tslint.yml or tslint.yaml file or undefined if neither can be found.
function getRelativePath
getRelativePath: ( directory?: string | null, relativeTo?: string) => string | undefined;
returns the absolute path (contrary to what the name implies)
Deprecated
use
path.resolve
instead
function getRulesDirectories
getRulesDirectories: ( directories?: string | string[], relativeTo?: string) => string[];
Parameter directories
A path(s) to a directory of custom rules
Parameter relativeTo
A path that directories provided are relative to. For example, if the directories come from a tslint.json file, this path should be the path to the tslint.json file. An array of absolute paths to directories potentially containing rules
function isFileExcluded
isFileExcluded: (filepath: string, configFile?: IConfigurationFile) => boolean;
function loadConfigurationFromPath
loadConfigurationFromPath: ( configFilePath?: string, _originalFilePath?: string) => IConfigurationFile;
Used Node semantics to load a configuration file given configFilePath. For example: '/path/to/config' will be treated as an absolute path './path/to/config' will be treated as a relative path 'path/to/config' will attempt to load a to/config file inside a node module named path
Parameter configFilePath
The configuration to load
Parameter originalFilePath
(deprecated) The entry point configuration file
Returns
a configuration object for TSLint loaded from the file at configFilePath
function parseConfigFile
parseConfigFile: ( configFile: RawConfigFile, configFileDir?: string, readConfig?: (path: string) => RawConfigFile) => IConfigurationFile;
Parses a config file and normalizes legacy config settings. If
configFileDir
andreadConfig
are provided, this function will load all base configs and reduce them to the final configuration.Parameter configFile
The raw object read from the JSON of a config file
Parameter configFileDir
The directory of the config file
Parameter readConfig
Will be used to load all base configurations while parsing. The function is called with the resolved path.
function readConfigurationFile
readConfigurationFile: (filepath: string) => RawConfigFile;
Reads the configuration file from disk and parses it as raw JSON, YAML or JS depending on the extension.
function stringifyConfiguration
stringifyConfiguration: (configFile: IConfigurationFile) => string;
function useAsPath
useAsPath: (directory: string) => boolean;
interface IConfigurationFile
interface IConfigurationFile {}
property defaultSeverity
defaultSeverity?: RuleSeverity;
Deprecated
property is never set
The severity that is applied to rules in this config file as well as rules in any inherited config files which have their severity set to "default". Not inherited.
property extends
extends: string[];
An array of config files whose rules are inherited by this config file.
property jsRules
jsRules: Map<string, Partial<IOptions>>;
Rules that are used to lint to JavaScript files.
property linterOptions
linterOptions?: Partial<{ exclude: string[]; format: string;}>;
A subset of the CLI options.
property rules
rules: Map<string, Partial<IOptions>>;
Rules that are used to lint TypeScript files.
property rulesDirectory
rulesDirectory: string[];
Directories containing custom rules. Resolved using node module semantics.
interface IConfigurationLoadResult
interface IConfigurationLoadResult {}
interface RawConfigFile
interface RawConfigFile {}
property defaultSeverity
defaultSeverity?: string;
property extends
extends?: string | string[];
property jsRules
jsRules?: RawRulesConfig | boolean;
property linterOptions
linterOptions?: IConfigurationFile['linterOptions'];
property rules
rules?: RawRulesConfig;
property rulesDirectory
rulesDirectory?: string | string[];
interface RawRulesConfig
interface RawRulesConfig {}
index signature
[key: string]: RawRuleConfig;
type RawRuleConfig
type RawRuleConfig = | null | undefined | boolean | any[] | { severity?: RuleSeverity | 'warn' | 'none' | 'default'; options?: any; };
namespace Formatters
module 'lib/formatters.d.ts' {}
Copyright 2013 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.
class AbstractFormatter
abstract class AbstractFormatter implements IFormatter {}
property metadata
static metadata: IFormatterMetadata;
method format
abstract format: ( failures: RuleFailure[], fixes?: RuleFailure[], fileNames?: string[]) => string;
method sortFailures
protected sortFailures: (failures: RuleFailure[]) => RuleFailure[];
class CodeFrameFormatter
class Formatter extends AbstractFormatter {}
class FileslistFormatter
class Formatter extends AbstractFormatter {}
class JsonFormatter
class Formatter extends AbstractFormatter {}
class JUnitFormatter
class Formatter extends AbstractFormatter {}
class PmdFormatter
class Formatter extends AbstractFormatter {}
class ProseFormatter
class Formatter extends AbstractFormatter {}
class StylishFormatter
class Formatter extends AbstractFormatter {}
class TapFormatter
class Formatter extends AbstractFormatter {}
class VerboseFormatter
class Formatter extends AbstractFormatter {}
namespace Rules
module 'lib/rules.d.ts' {}
Copyright 2013 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.
class AbstractRule
abstract class AbstractRule implements IRule {}
constructor
constructor(options: IOptions);
property metadata
static metadata: IRuleMetadata;
property ruleArguments
protected readonly ruleArguments: any[];
property ruleName
ruleName: string;
property ruleSeverity
protected readonly ruleSeverity: RuleSeverity;
method apply
abstract apply: (sourceFile: ts.SourceFile) => RuleFailure[];
method applyWithFunction
protected applyWithFunction: { ( sourceFile: ts.SourceFile, walkFn: (ctx: WalkContext) => void ): RuleFailure[]; <T>( sourceFile: ts.SourceFile, walkFn: (ctx: WalkContext<T>) => void, options: NoInfer<T> ): RuleFailure[]; <T, U>( sourceFile: ts.SourceFile, walkFn: (ctx: WalkContext<T>, programOrChecker: U) => void, options: NoInfer<T>, checker: NoInfer<U> ): RuleFailure[];};
method applyWithWalker
applyWithWalker: (walker: IWalker) => RuleFailure[];
method filterFailures
protected filterFailures: (failures: RuleFailure[]) => RuleFailure[];
Deprecated
Failures will be filtered based on
tslint:disable
comments by tslint. This method now does nothing.
method getOptions
getOptions: () => IOptions;
method isEnabled
isEnabled: () => boolean;
class OptionallyTypedRule
abstract class OptionallyTypedRule extends AbstractRule implements ITypedRule {}
method applyWithProgram
abstract applyWithProgram: ( sourceFile: ts.SourceFile, program: ts.Program) => RuleFailure[];
class TypedRule
abstract class TypedRule extends AbstractRule implements ITypedRule {}
method apply
apply: () => RuleFailure[];
method applyWithProgram
abstract applyWithProgram: ( sourceFile: ts.SourceFile, program: ts.Program) => RuleFailure[];
type NoInfer
type NoInfer<T> = T & { [K in keyof T]: T[K];};
namespace Test
module 'lib/test.d.ts' {}
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.
function consoleTestResultHandler
consoleTestResultHandler: (testResult: TestResult, logger: Logger) => boolean;
function consoleTestResultsHandler
consoleTestResultsHandler: ( testResults: TestResult[], logger: Logger) => boolean;
function runTest
runTest: ( testDirectory: string, rulesDirectory?: string | string[]) => TestResult;
function runTests
runTests: ( patterns: string[], rulesDirectory?: string | string[]) => TestResult[];
interface SkippedTest
interface SkippedTest {}
property requirement
requirement: string;
property skipped
skipped: true;
interface TestOutput
interface TestOutput {}
property errorsFromLinter
errorsFromLinter: LintError[];
property errorsFromMarkup
errorsFromMarkup: LintError[];
property fixesFromLinter
fixesFromLinter: string;
property fixesFromMarkup
fixesFromMarkup: string;
property markupFromLinter
markupFromLinter: string;
property markupFromMarkup
markupFromMarkup: string;
property skipped
skipped: false;
interface TestResult
interface TestResult {}
namespace Utils
module 'lib/utils.d.ts' {}
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.
function arrayify
arrayify: <T>(arg?: T | T[]) => T[];
Enforces the invariant that the input is an array.
function arraysAreEqual
arraysAreEqual: <T>( a: ReadonlyArray<T> | undefined, b: ReadonlyArray<T> | undefined, eq: Equal<T>) => boolean;
function camelize
camelize: (stringWithHyphens: string) => string;
Replace hyphens in a rule name by upper-casing the letter after them. E.g. "foo-bar" -> "fooBar"
function dedent
dedent: (strings: TemplateStringsArray, ...values: any[]) => string;
Removes leading indents from a template string without removing all leading whitespace
function denormalizeWinPath
denormalizeWinPath: (path: string) => string;
function detectBufferEncoding
detectBufferEncoding: (buffer: Buffer, length?: number) => Encoding;
function escapeRegExp
escapeRegExp: (re: string) => string;
Escapes all special characters in RegExp pattern to avoid broken regular expressions and ensure proper matches
function find
find: <T, U>(inputs: T[], getResult: (t: T) => U | undefined) => U | undefined;
Returns the first non-
undefined
result.
function flatMap
flatMap: <T, U>( inputs: ReadonlyArray<T>, getOutputs: (input: T, index: number) => ReadonlyArray<U>) => U[];
Returns an array that is the concatenation of all output arrays.
function getIndentation
getIndentation: (node: ts.Node, sourceFile: ts.SourceFile) => string;
Gets the full indentation of the provided node
function hasOwnProperty
hasOwnProperty: (arg: {}, key: string) => boolean;
function isCamelCased
isCamelCased: (name: string) => boolean;
function isFunctionScopeBoundary
isFunctionScopeBoundary: (node: ts.Node) => boolean;
Deprecated
Copied from tsutils 2.27.2. This will be removed once TSLint requires tsutils > 3.0.
function isKebabCased
isKebabCased: (name: string) => boolean;
function isLowerCase
isLowerCase: (str: string) => boolean;
function isPascalCased
isPascalCased: (name: string) => boolean;
function isSnakeCased
isSnakeCased: (name: string) => boolean;
function isUpperCase
isUpperCase: (str: string) => boolean;
function mapDefined
mapDefined: <T, U>( inputs: ReadonlyArray<T>, getOutput: (input: T) => U | undefined) => U[];
Returns an array of all outputs that are not
undefined
.
function newLineWithIndentation
newLineWithIndentation: ( node: ts.Node, sourceFile: ts.SourceFile, linesCount?: number) => string;
Creates x new lines with a proper indentation at the last one based on the provided node
function objectify
objectify: (arg: any) => any;
Deprecated
(no longer used) Enforces the invariant that the input is an object.
function readBufferWithDetectedEncoding
readBufferWithDetectedEncoding: (buffer: Buffer) => string;
function stripComments
stripComments: (content: string) => string;
Strip comments from file content.
function trimSingleQuotes
trimSingleQuotes: (str: string) => string;
function tryResolvePackage
tryResolvePackage: ( packageName: string, relativeTo?: string) => string | undefined;
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.
type Encoding
type Encoding = 'utf8' | 'utf8-bom' | 'utf16le' | 'utf16be';
type Equal
type Equal<T> = (a: T, b: T) => boolean;
Return true if both parameters are equal.
Package Files (33)
- lib/configuration.d.ts
- lib/enableDisableRules.d.ts
- lib/formatterLoader.d.ts
- lib/formatters.d.ts
- lib/formatters/codeFrameFormatter.d.ts
- lib/formatters/fileslistFormatter.d.ts
- lib/formatters/jsonFormatter.d.ts
- lib/formatters/junitFormatter.d.ts
- lib/formatters/pmdFormatter.d.ts
- lib/formatters/proseFormatter.d.ts
- lib/formatters/stylishFormatter.d.ts
- lib/formatters/tapFormatter.d.ts
- lib/formatters/verboseFormatter.d.ts
- lib/index.d.ts
- lib/language/formatter/abstractFormatter.d.ts
- lib/language/formatter/formatter.d.ts
- lib/language/rule/abstractRule.d.ts
- lib/language/rule/optionallyTypedRule.d.ts
- lib/language/rule/rule.d.ts
- lib/language/rule/typedRule.d.ts
- lib/language/utils.d.ts
- lib/language/walker/blockScopeAwareRuleWalker.d.ts
- lib/language/walker/programAwareRuleWalker.d.ts
- lib/language/walker/ruleWalker.d.ts
- lib/language/walker/scopeAwareRuleWalker.d.ts
- lib/language/walker/syntaxWalker.d.ts
- lib/language/walker/walkContext.d.ts
- lib/language/walker/walker.d.ts
- lib/linter.d.ts
- lib/ruleLoader.d.ts
- lib/rules.d.ts
- lib/test.d.ts
- lib/utils.d.ts
Dependencies (13)
Dev Dependencies (28)
- @octokit/rest
- @types/babel__code-frame
- @types/chai
- @types/diff
- @types/glob
- @types/js-yaml
- @types/minimatch
- @types/mkdirp
- @types/mocha
- @types/node
- @types/resolve
- @types/rimraf
- @types/semver
- chai
- husky
- json-stringify-pretty-compact
- mocha
- npm-run-all
- nyc
- prettier
- rimraf
- ts-node
- tslint
- tslint-config-prettier
- tslint-plugin-prettier
- tslint-test-config-non-relative
- typescript
- yarn-deduplicate
Peer Dependencies (1)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/tslint
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/tslint)
- HTML<a href="https://www.jsdocs.io/package/tslint"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 5109 ms. - Missing or incorrect documentation? Open an issue for this package.