Linter
Interfaces and helpers for writing and testing custom lint rules.
Functions
Interfaces
Arrow function expression
Declares a class in the current scope
Similar to ClassDeclaration but for declaring a class as an expression. The main difference is that the class name(=id) can be omitted.
Terminates the current loop and continues with the next iteration.
Declares a function in the current scope
Declare a function as an expression. Similar to FunctionDeclaration,
with an optional name (=id).
Custom named node by the developer. Can be a variable name, a function name, parameter, etc.
Execute a statement the test passes, otherwise the alternate statement, if it was defined.
An import declaration, examples:
The closing tag of a JSXElement. Only used when the element is not self-closing.
Usually a passthrough node to pass multiple sibling elements as the JSX syntax requires one root element.
The opening tag of a JSXElement
Match an expression against a series of cases.
Throw a user defined exception. Stops execution of the current function.
Namespaces
Type Aliases
interface Deno.lint.AccessorProperty
Properties #
#accessibility: Accessibility | undefined #value: Expression | null interface Deno.lint.ArrayExpression
interface Deno.lint.ArrayPattern
Destructure an array.
Properties #
#typeAnnotation: TSTypeAnnotation | undefined #elements: Array<ArrayPattern
| AssignmentPattern
| Identifier
| MemberExpression
| ObjectPattern
| RestElement
| null> interface Deno.lint.ArrowFunctionExpression
Arrow function expression
Properties #
#typeParameters: TSTypeParameterDeclaration | undefined #returnType: TSTypeAnnotation | undefined interface Deno.lint.AssignmentExpression
interface Deno.lint.BinaryExpression
Compare left and right value with the specifier operator.
Properties #
interface Deno.lint.BreakStatement
Break any loop or labeled statement, example:
while (true) {
break;
}
for (let i = 0; i < 10; i++) {
if (i > 5) break;
}
Properties #
#label: Identifier | null interface Deno.lint.CallExpression
A function call.
Properties #
#arguments: Array<Expression | SpreadElement> interface Deno.lint.CatchClause
interface Deno.lint.ClassBody
Represents the body of a class and contains all members
Properties #
interface Deno.lint.ClassDeclaration
Declares a class in the current scope
Properties #
#id: Identifier | null #superClass: ArrayExpression
| ArrayPattern
| ArrowFunctionExpression
| CallExpression
| ClassExpression
| FunctionExpression
| Identifier
| JSXElement
| JSXFragment
| Literal
| TemplateLiteral
| MemberExpression
| MetaProperty
| ObjectExpression
| ObjectPattern
| SequenceExpression
| Super
| TaggedTemplateExpression
| ThisExpression
| TSAsExpression
| TSNonNullExpression
| TSTypeAssertion
| null interface Deno.lint.ClassExpression
Similar to ClassDeclaration but for declaring a class as an expression. The main difference is that the class name(=id) can be omitted.
Properties #
#id: Identifier | null #superClass: ArrayExpression
| ArrayPattern
| ArrowFunctionExpression
| CallExpression
| ClassExpression
| FunctionExpression
| Identifier
| JSXElement
| JSXFragment
| Literal
| TemplateLiteral
| MemberExpression
| MetaProperty
| ObjectExpression
| ObjectPattern
| SequenceExpression
| Super
| TaggedTemplateExpression
| ThisExpression
| TSAsExpression
| TSNonNullExpression
| TSTypeAssertion
| null #superTypeArguments: TSTypeParameterInstantiation | undefined #typeParameters: TSTypeParameterDeclaration | undefined interface Deno.lint.ContinueStatement
Terminates the current loop and continues with the next iteration.
Properties #
#label: Identifier | null interface Deno.lint.Decorator
Experimental: Decorators
Properties #
#expression: ArrayExpression
| ArrayPattern
| ArrowFunctionExpression
| CallExpression
| ClassExpression
| FunctionExpression
| Identifier
| JSXElement
| JSXFragment
| Literal
| TemplateLiteral
| MemberExpression
| MetaProperty
| ObjectExpression
| ObjectPattern
| SequenceExpression
| Super
| TaggedTemplateExpression
| ThisExpression
| TSAsExpression
| TSNonNullExpression
| TSTypeAssertion interface Deno.lint.DoWhileStatement
Re-run loop for as long as test expression is truthy.
Properties #
interface Deno.lint.ExportAllDeclaration
Properties #
#exportKind: "type" | "value" #exported: Identifier | null interface Deno.lint.ExportNamedDeclaration
Properties #
interface Deno.lint.Fixer
Methods #
#insertTextAfter(node: Node,text: string,): Fix #insertTextAfterRange(range: Range,text: string,): Fix #insertTextBefore(node: Node,text: string,): Fix #insertTextBeforeRange(range: Range,text: string,): Fix #removeRange(range: Range): Fix #replaceText(node: Node,text: string,): Fix #replaceTextRange(range: Range,text: string,): Fix interface Deno.lint.ForInStatement
Enumerate over all enumerable string properties of an object.
Properties #
interface Deno.lint.ForOfStatement
Iterate over sequence of values from an iterator.
Properties #
interface Deno.lint.ForStatement
Classic for-loop.
Properties #
interface Deno.lint.FunctionDeclaration
Declares a function in the current scope
Properties #
#id: Identifier | null #typeParameters: TSTypeParameterDeclaration | undefined #returnType: TSTypeAnnotation | undefined #body: BlockStatement | null interface Deno.lint.FunctionExpression
Declare a function as an expression. Similar to FunctionDeclaration,
with an optional name (=id).
Properties #
#id: Identifier | null #typeParameters: TSTypeParameterDeclaration | undefined #returnType: TSTypeAnnotation | undefined interface Deno.lint.IfStatement
Execute a statement the test passes, otherwise the alternate statement, if it was defined.
Properties #
interface Deno.lint.ImportDeclaration
An import declaration, examples:
Properties #
#importKind: "type" | "value" interface Deno.lint.ImportDefaultSpecifier
interface Deno.lint.ImportNamespaceSpecifier
interface Deno.lint.JSXClosingElement
The closing tag of a JSXElement. Only used when the element is not self-closing.
Properties #
interface Deno.lint.JSXClosingFragment
interface Deno.lint.JSXElement
A JSX element.
Properties #
#closingElement: JSXClosingElement | null interface Deno.lint.JSXExpressionContainer
Inserts a normal JS expression into JSX.
Properties #
interface Deno.lint.JSXFragment
Usually a passthrough node to pass multiple sibling elements as the JSX syntax requires one root element.
Properties #
interface Deno.lint.JSXOpeningElement
The opening tag of a JSXElement
Properties #
#selfClosing: boolean #attributes: Array<JSXAttribute | JSXSpreadAttribute> #typeArguments: TSTypeParameterInstantiation | undefined interface Deno.lint.JSXOpeningFragment
interface Deno.lint.JSXSpreadAttribute
interface Deno.lint.JSXText
interface Deno.lint.MemberExpression
interface Deno.lint.NewExpression
Create a new instance of a class.
Properties #
#typeArguments: TSTypeParameterInstantiation | undefined #arguments: Array<Expression | SpreadElement> interface Deno.lint.ObjectExpression
interface Deno.lint.ObjectPattern
Destructure an object.
Properties #
#typeAnnotation: TSTypeAnnotation | undefined #properties: Array<Property | RestElement> interface Deno.lint.PrivateIdentifier
Private members inside of classes, must start with #.
Properties #
interface Deno.lint.Program
Properties #
#sourceType: "module" | "script" #comments: Array<LineComment | BlockComment> interface Deno.lint.PropertyDefinition
Properties #
#accessibility: Accessibility | undefined #value: Expression | null #typeAnnotation: TSTypeAnnotation | undefined interface Deno.lint.RestElement
The rest of function parameters.
Properties #
#typeAnnotation: TSTypeAnnotation | undefined interface Deno.lint.ReturnStatement
Returns a value from a function.
Properties #
#argument: Expression | null interface Deno.lint.Rule
Methods #
#create(ctx: RuleContext): LintVisitor #destroy(ctx: RuleContext): void interface Deno.lint.RuleContext
Properties #
Helper methods for working with the raw source code.
Methods #
#report(data: ReportData): void Report a lint error.
#getFilename(): string #getSourceCode(): SourceCode interface Deno.lint.SequenceExpression
interface Deno.lint.SourceCode
Properties #
Methods #
#getAncestors(node: Node): Node[] Returns array of ancestors of the current node, excluding the current node.
#getAllComments(): Array<LineComment | BlockComment> Get all comments inside the source.
#getCommentsBefore(node: Node): Array<LineComment | BlockComment> Get leading comments before a node.
#getCommentsAfter(node: Node): Array<LineComment | BlockComment> Get trailing comments after a node.
#getCommentsInside(node: Node): Array<LineComment | BlockComment> Get comments inside a node.
interface Deno.lint.SwitchCase
A single case of a SwitchStatement.
Properties #
#test: Expression | null interface Deno.lint.SwitchStatement
Match an expression against a series of cases.
Properties #
#cases: SwitchCase[] interface Deno.lint.TaggedTemplateExpression
Tagged template expression.
Properties #
#typeArguments: TSTypeParameterInstantiation | undefined interface Deno.lint.ThrowStatement
Throw a user defined exception. Stops execution of the current function.
Properties #
interface Deno.lint.TryStatement
Try/catch statement
Properties #
#handler: CatchClause | null #finalizer: BlockStatement | null interface Deno.lint.TSAbstractMethodDefinition
Properties #
#accessibility: Accessibility | undefined interface Deno.lint.TSAbstractPropertyDefinition
Properties #
#accessibility: Accessibility | undefined #typeAnnotation: TSTypeAnnotation | undefined #value: Expression | null interface Deno.lint.TSCallSignatureDeclaration
Properties #
#typeParameters: TSTypeParameterDeclaration | undefined #returnType: TSTypeAnnotation | undefined interface Deno.lint.TSClassImplements
Properties #
#typeArguments: TSTypeParameterInstantiation | undefined interface Deno.lint.TSConstructSignatureDeclaration
Properties #
#typeParameters: TSTypeParameterDeclaration | undefined interface Deno.lint.TSDeclareFunction
interface Deno.lint.TSEmptyBodyFunctionExpression
Properties #
#expression: boolean #typeParameters: TSTypeParameterDeclaration | undefined #returnType: TSTypeAnnotation | undefined interface Deno.lint.TSEnumBody
interface Deno.lint.TSEnumMember
A member of a TSEnumDeclaration
Properties #
#initializer: Expression | undefined interface Deno.lint.TSExportAssignment
interface Deno.lint.TSExternalModuleReference
interface Deno.lint.TSFunctionType
Properties #
#returnType: TSTypeAnnotation | undefined #typeParameters: TSTypeParameterDeclaration | undefined interface Deno.lint.TSIndexSignature
Properties #
#typeAnnotation: TSTypeAnnotation | undefined interface Deno.lint.TSInferType
interface Deno.lint.TSInterfaceDeclaration
Properties #
#typeParameters: TSTypeParameterDeclaration | undefined interface Deno.lint.TSInterfaceHeritage
Properties #
#typeArguments: TSTypeParameterInstantiation | undefined interface Deno.lint.TSMethodSignature
Properties #
#returnType: TSTypeAnnotation | undefined #typeParameters: TSTypeParameterDeclaration | undefined interface Deno.lint.TSNonNullExpression
interface Deno.lint.TSParameterProperty
Properties #
#accessibility: Accessibility | undefined interface Deno.lint.TSPropertySignature
Properties #
#typeAnnotation: TSTypeAnnotation | undefined interface Deno.lint.TSTypeAliasDeclaration
Properties #
#typeParameters: TSTypeParameterDeclaration | undefined interface Deno.lint.TSTypeParameter
interface Deno.lint.TSTypePredicate
Properties #
#typeAnnotation: TSTypeAnnotation | undefined interface Deno.lint.TSTypeQuery
Properties #
#typeArguments: TSTypeParameterInstantiation | undefined interface Deno.lint.TSTypeReference
Properties #
#typeArguments: TSTypeParameterInstantiation | undefined interface Deno.lint.VariableDeclarator
A VariableDeclaration can declare multiple variables. This node represents a single declaration out of that.
Properties #
#init: Expression | null interface Deno.lint.WhileStatement
Run a loop while the test expression is truthy.
Properties #
interface Deno.lint.WithStatement
Legacy JavaScript feature, that's discouraged from being used today.
Properties #
namespace Deno.lint
Functions #
Interfaces #
Arrow function expression
Declares a class in the current scope
Similar to ClassDeclaration but for declaring a class as an expression. The main difference is that the class name(=id) can be omitted.
Terminates the current loop and continues with the next iteration.
Declares a function in the current scope
Declare a function as an expression. Similar to FunctionDeclaration,
with an optional name (=id).
Custom named node by the developer. Can be a variable name, a function name, parameter, etc.
Execute a statement the test passes, otherwise the alternate statement, if it was defined.
An import declaration, examples:
The closing tag of a JSXElement. Only used when the element is not self-closing.
Usually a passthrough node to pass multiple sibling elements as the JSX syntax requires one root element.
The opening tag of a JSXElement
Match an expression against a series of cases.
Throw a user defined exception. Stops execution of the current function.
Type Aliases #
type alias Deno.lint.Accessibility
TypeScript accessibility modifiers used in classes
Definition #
"private"
| "protected"
| "public" type alias Deno.lint.Expression
Union type of all possible expression nodes
Definition #
ArrayExpression
| ArrayPattern
| ArrowFunctionExpression
| AssignmentExpression
| AwaitExpression
| BinaryExpression
| CallExpression
| ChainExpression
| ClassExpression
| ConditionalExpression
| FunctionExpression
| Identifier
| ImportExpression
| JSXElement
| JSXFragment
| Literal
| TemplateLiteral
| LogicalExpression
| MemberExpression
| MetaProperty
| NewExpression
| ObjectExpression
| ObjectPattern
| SequenceExpression
| Super
| TaggedTemplateExpression
| TemplateLiteral
| ThisExpression
| TSAsExpression
| TSInstantiationExpression
| TSNonNullExpression
| TSSatisfiesExpression
| TSTypeAssertion
| UnaryExpression
| UpdateExpression
| YieldExpression type alias Deno.lint.Node
Union type of all possible AST nodes
Definition #
Program
| Expression
| Statement
| TypeNode
| ImportSpecifier
| ImportDefaultSpecifier
| ImportNamespaceSpecifier
| ImportAttribute
| TSExternalModuleReference
| ExportSpecifier
| VariableDeclarator
| Decorator
| ClassBody
| StaticBlock
| PropertyDefinition
| MethodDefinition
| SwitchCase
| CatchClause
| TemplateElement
| PrivateIdentifier
| AssignmentPattern
| RestElement
| SpreadElement
| Property
| JSXIdentifier
| JSXNamespacedName
| JSXEmptyExpression
| JSXOpeningElement
| JSXAttribute
| JSXSpreadAttribute
| JSXClosingElement
| JSXOpeningFragment
| JSXClosingFragment
| JSXExpressionContainer
| JSXText
| JSXMemberExpression
| TSModuleBlock
| TSClassImplements
| TSAbstractMethodDefinition
| TSAbstractPropertyDefinition
| TSEmptyBodyFunctionExpression
| TSCallSignatureDeclaration
| TSPropertySignature
| TSEnumBody
| TSEnumMember
| TSTypeParameterInstantiation
| TSInterfaceBody
| TSConstructSignatureDeclaration
| TSMethodSignature
| TSInterfaceHeritage
| TSIndexSignature
| TSTypeAnnotation
| TSTypeParameterDeclaration
| TSTypeParameter
| LineComment
| BlockComment type alias Deno.lint.Statement
Union type of all possible statement nodes
Definition #
BlockStatement
| BreakStatement
| ClassDeclaration
| ContinueStatement
| DebuggerStatement
| DoWhileStatement
| ExportAllDeclaration
| ExportDefaultDeclaration
| ExportNamedDeclaration
| ExpressionStatement
| ForInStatement
| ForOfStatement
| ForStatement
| FunctionDeclaration
| IfStatement
| ImportDeclaration
| LabeledStatement
| ReturnStatement
| SwitchStatement
| ThrowStatement
| TryStatement
| TSDeclareFunction
| TSEnumDeclaration
| TSExportAssignment
| TSImportEqualsDeclaration
| TSInterfaceDeclaration
| TSModuleDeclaration
| TSNamespaceExportDeclaration
| TSTypeAliasDeclaration
| VariableDeclaration
| WhileStatement
| WithStatement type alias Deno.lint.TypeNode
Union type of all possible type nodes in TypeScript
Definition #
TSAnyKeyword
| TSArrayType
| TSBigIntKeyword
| TSBooleanKeyword
| TSConditionalType
| TSFunctionType
| TSImportType
| TSIndexedAccessType
| TSInferType
| TSIntersectionType
| TSIntrinsicKeyword
| TSLiteralType
| TSMappedType
| TSNamedTupleMember
| TSNeverKeyword
| TSNullKeyword
| TSNumberKeyword
| TSObjectKeyword
| TSOptionalType
| TSQualifiedName
| TSRestType
| TSStringKeyword
| TSSymbolKeyword
| TSTemplateLiteralType
| TSThisType
| TSTupleType
| TSTypeLiteral
| TSTypeOperator
| TSTypePredicate
| TSTypeQuery
| TSTypeReference
| TSUndefinedKeyword
| TSUnionType
| TSUnknownKeyword
| TSVoidKeyword