Linter
Interfaces and helpers for writing and testing custom lint rules.
function Deno.lint.runPlugin
runPlugin(): Diagnostic[]This API is useful for testing lint plugins.
It throws an error if it's not used in deno test subcommand.
Parameters
Return Type
interface Deno.lint.AccessorProperty
Properties
type: "AccessorProperty" declare: boolean computed: boolean optional: boolean override: boolean readonly: boolean static: boolean accessibility: Accessibility | undefined value: Expression | null interface Deno.lint.ArrayPattern
Destructure an array.
Properties
type: "ArrayPattern" optional: boolean typeAnnotation: TSTypeAnnotation | undefined elements: Array<
ArrayPattern
| AssignmentPattern
| Identifier
| MemberExpression
| ObjectPattern
| RestElement
| null
> interface Deno.lint.ArrowFunctionExpression
Arrow function expression
Properties
type: "ArrowFunctionExpression" async: boolean generator: boolean id: null typeParameters: TSTypeParameterDeclaration | undefined returnType: TSTypeAnnotation | undefined interface Deno.lint.AssignmentExpression
interface Deno.lint.AssignmentPattern
Assign default values in parameters.
Properties
type: "AssignmentPattern" interface Deno.lint.AwaitExpression
interface Deno.lint.BinaryExpression
interface Deno.lint.BlockComment
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
type: "BreakStatement" label: Identifier | null interface Deno.lint.CallExpression
A function call.
Properties
interface Deno.lint.CatchClause
interface Deno.lint.ClassBody
Represents the body of a class and contains all members
Properties
type: "ClassBody" interface Deno.lint.ClassDeclaration
Declares a class in the current scope
Properties
type: "ClassDeclaration" declare: boolean abstract: boolean 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
type: "ClassExpression" declare: boolean abstract: boolean 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.ConditionalExpression
Inline if-statement.
Properties
type: "ConditionalExpression" interface Deno.lint.ContinueStatement
Terminates the current loop and continues with the next iteration.
Properties
type: "ContinueStatement" label: Identifier | null interface Deno.lint.DebuggerStatement
The debugger; statement.
Properties
type: "DebuggerStatement" interface Deno.lint.Decorator
Experimental: Decorators
Properties
type: "Decorator" 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
type: "DoWhileStatement" interface Deno.lint.ExportAllDeclaration
Properties
interface Deno.lint.ExportDefaultDeclaration
Properties
interface Deno.lint.ExportNamedDeclaration
Properties
interface Deno.lint.ExportSpecifier
Properties
type: "ExportSpecifier" exportKind: "type" | "value" interface Deno.lint.ExpressionStatement
Statement that holds an expression.
Properties
type: "ExpressionStatement" 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
type: "ForInStatement" interface Deno.lint.ForOfStatement
interface Deno.lint.ForStatement
Classic for-loop.
Properties
interface Deno.lint.FunctionDeclaration
Declares a function in the current scope
Properties
type: "FunctionDeclaration" declare: boolean async: boolean generator: boolean 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
type: "FunctionExpression" async: boolean generator: boolean id: Identifier | null typeParameters: TSTypeParameterDeclaration | undefined returnType: TSTypeAnnotation | undefined interface Deno.lint.Identifier
Custom named node by the developer. Can be a variable name, a function name, parameter, etc.
Properties
interface Deno.lint.IfStatement
Execute a statement the test passes, otherwise the alternate statement, if it was defined.
Properties
type: "IfStatement" interface Deno.lint.ImportAttribute
Properties
type: "ImportAttribute" key: Identifier | Literal interface Deno.lint.ImportDeclaration
An import declaration, examples:
Properties
type: "ImportDeclaration" importKind: "type" | "value" interface Deno.lint.ImportSpecifier
Properties
type: "ImportSpecifier" importKind: "type" | "value" interface Deno.lint.JSXClosingElement
The closing tag of a JSXElement. Only used when the element is not self-closing.
Properties
type: "JSXClosingElement" interface Deno.lint.JSXElement
A JSX element.
Properties
type: "JSXElement" closingElement: JSXClosingElement | null interface Deno.lint.JSXExpressionContainer
Inserts a normal JS expression into JSX.
Properties
type: "JSXExpressionContainer" interface Deno.lint.JSXFragment
Usually a passthrough node to pass multiple sibling elements as the JSX syntax requires one root element.
Properties
type: "JSXFragment" interface Deno.lint.JSXIdentifier
interface Deno.lint.JSXMemberExpression
JSX member expression.
Properties
type: "JSXMemberExpression" interface Deno.lint.JSXNamespacedName
Namespaced name in JSX
Properties
type: "JSXNamespacedName" interface Deno.lint.JSXOpeningElement
The opening tag of a JSXElement
Properties
type: "JSXOpeningElement" selfClosing: boolean attributes: Array<JSXAttribute | JSXSpreadAttribute> typeArguments: TSTypeParameterInstantiation | undefined interface Deno.lint.LabeledStatement
Custom control flow based on labels.
Properties
type: "LabeledStatement" interface Deno.lint.LineComment
interface Deno.lint.LogicalExpression
interface Deno.lint.MemberExpression
interface Deno.lint.MethodDefinition
Properties
type: "MethodDefinition" declare: boolean computed: boolean optional: boolean override: boolean readonly: boolean static: boolean kind:
"constructor"
| "get"
| "method"
| "set"
accessibility: Accessibility | undefined interface Deno.lint.NewExpression
Create a new instance of a class.
Properties
type: "NewExpression" typeArguments: TSTypeParameterInstantiation | undefined arguments: Array<Expression | SpreadElement> interface Deno.lint.ObjectPattern
Destructure an object.
Properties
type: "ObjectPattern" optional: boolean typeAnnotation: TSTypeAnnotation | undefined properties: Array<Property | RestElement> interface Deno.lint.Plugin
interface Deno.lint.PrivateIdentifier
interface Deno.lint.Program
Properties
interface Deno.lint.PropertyDefinition
Properties
type: "PropertyDefinition" declare: boolean computed: boolean optional: boolean override: boolean readonly: boolean static: boolean accessibility: Accessibility | undefined value: Expression | null typeAnnotation: TSTypeAnnotation | undefined interface Deno.lint.RestElement
The rest of function parameters.
Properties
interface Deno.lint.ReturnStatement
Returns a value from a function.
Properties
type: "ReturnStatement" argument: Expression | null interface Deno.lint.Rule
Methods
create(ctx: RuleContext): LintVisitor destroy(ctx: RuleContext): void interface Deno.lint.RuleContext
Properties
Methods
report(data: ReportData): void Report a lint error.
getFilename(): string getSourceCode(): SourceCode interface Deno.lint.SequenceExpression
Execute multiple expressions in sequence.
Properties
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
type: "SwitchCase" test: Expression | null interface Deno.lint.SwitchStatement
Match an expression against a series of cases.
Properties
type: "SwitchStatement" cases: SwitchCase[] interface Deno.lint.TaggedTemplateExpression
Tagged template expression.
Properties
type: "TaggedTemplateExpression" typeArguments: TSTypeParameterInstantiation | undefined interface Deno.lint.TemplateElement
interface Deno.lint.TemplateLiteral
A template literal string.
Properties
type: "TemplateLiteral" interface Deno.lint.ThrowStatement
Throw a user defined exception. Stops execution of the current function.
Properties
type: "ThrowStatement" interface Deno.lint.TryStatement
Try/catch statement
Properties
interface Deno.lint.TSAbstractMethodDefinition
Properties
type: "TSAbstractMethodDefinition" computed: boolean optional: boolean override: boolean static: boolean accessibility: Accessibility | undefined kind: "method" interface Deno.lint.TSAbstractPropertyDefinition
Properties
type: "TSAbstractPropertyDefinition" computed: boolean optional: boolean override: boolean static: boolean definite: boolean declare: boolean readonly: boolean accessibility: Accessibility | undefined typeAnnotation: TSTypeAnnotation | undefined value: Expression | null interface Deno.lint.TSArrayType
interface Deno.lint.TSCallSignatureDeclaration
Properties
type: "TSCallSignatureDeclaration" typeParameters: TSTypeParameterDeclaration | undefined returnType: TSTypeAnnotation | undefined interface Deno.lint.TSClassImplements
Properties
type: "TSClassImplements" typeArguments: TSTypeParameterInstantiation | undefined interface Deno.lint.TSConstructSignatureDeclaration
Properties
type: "TSConstructSignatureDeclaration" typeParameters: TSTypeParameterDeclaration | undefined interface Deno.lint.TSDeclareFunction
Properties
type: "TSDeclareFunction" async: boolean declare: boolean generator: boolean body: undefined id: Identifier | null returnType: TSTypeAnnotation | undefined typeParameters: TSTypeParameterDeclaration | undefined interface Deno.lint.TSEmptyBodyFunctionExpression
Properties
type: "TSEmptyBodyFunctionExpression" declare: boolean expression: boolean async: boolean generator: boolean id: null body: null typeParameters: TSTypeParameterDeclaration | undefined returnType: TSTypeAnnotation | undefined interface Deno.lint.TSEnumDeclaration
interface Deno.lint.TSEnumMember
A member of a TSEnumDeclaration
Properties
type: "TSEnumMember" initializer: Expression | undefined interface Deno.lint.TSFunctionType
Properties
type: "TSFunctionType" returnType: TSTypeAnnotation | undefined typeParameters: TSTypeParameterDeclaration | undefined interface Deno.lint.TSImportEqualsDeclaration
Properties
type: "TSImportEqualsDeclaration" importKind: "type" | "value" interface Deno.lint.TSIndexedAccessType
interface Deno.lint.TSIndexSignature
Properties
type: "TSIndexSignature" readonly: boolean static: boolean typeAnnotation: TSTypeAnnotation | undefined interface Deno.lint.TSInterfaceDeclaration
Properties
type: "TSInterfaceDeclaration" declare: boolean typeParameters: TSTypeParameterDeclaration | undefined interface Deno.lint.TSInterfaceHeritage
Properties
type: "TSInterfaceHeritage" typeArguments: TSTypeParameterInstantiation | undefined interface Deno.lint.TSMappedType
Properties
interface Deno.lint.TSMethodSignature
Properties
type: "TSMethodSignature" computed: boolean optional: boolean readonly: boolean static: boolean kind:
"get"
| "set"
| "method"
returnType: TSTypeAnnotation | undefined typeParameters: TSTypeParameterDeclaration | undefined interface Deno.lint.TSModuleBlock
Body of a TSModuleDeclaration
Properties
type: "TSModuleBlock" interface Deno.lint.TSModuleDeclaration
Properties
type: "TSModuleDeclaration" declare: boolean kind:
"global"
| "module"
| "namespace"
body: TSModuleBlock | undefined interface Deno.lint.TSNamedTupleMember
interface Deno.lint.TSNamespaceExportDeclaration
interface Deno.lint.TSOptionalType
interface Deno.lint.TSParameterProperty
Properties
type: "TSParameterProperty" override: boolean readonly: boolean static: boolean accessibility: Accessibility | undefined interface Deno.lint.TSPropertySignature
Properties
type: "TSPropertySignature" computed: boolean optional: boolean readonly: boolean static: boolean typeAnnotation: TSTypeAnnotation | undefined interface Deno.lint.TSRestType
interface Deno.lint.TSTemplateLiteralType
interface Deno.lint.TSTupleType
interface Deno.lint.TSTypeAliasDeclaration
Properties
type: "TSTypeAliasDeclaration" declare: boolean typeParameters: TSTypeParameterDeclaration | undefined interface Deno.lint.TSTypeAnnotation
interface Deno.lint.TSTypeOperator
interface Deno.lint.TSTypeParameter
interface Deno.lint.TSTypeParameterDeclaration
interface Deno.lint.TSTypeParameterInstantiation
Properties
type: "TSTypeParameterInstantiation" interface Deno.lint.TSTypePredicate
Properties
interface Deno.lint.TSTypeQuery
Properties
type: "TSTypeQuery" typeArguments: TSTypeParameterInstantiation | undefined interface Deno.lint.TSTypeReference
Properties
type: "TSTypeReference" typeArguments: TSTypeParameterInstantiation | undefined interface Deno.lint.UnaryExpression
interface Deno.lint.UpdateExpression
interface Deno.lint.VariableDeclaration
interface Deno.lint.VariableDeclarator
A VariableDeclaration can declare multiple variables. This node represents a single declaration out of that.
Properties
interface Deno.lint.WhileStatement
Run a loop while the test expression is truthy.
Properties
type: "WhileStatement" interface Deno.lint.YieldExpression
interface Deno.lint.WithStatement
Legacy JavaScript feature, that's discouraged from being used today.
Properties
type: "WithStatement" namespace Deno.lint
Functions
This API is useful for testing lint plugins.
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.
Inserts a normal JS expression into JSX.
Usually a passthrough node to pass multiple sibling elements as the JSX syntax requires one root element.
The opening tag of a JSXElement
Create a new instance of a class.
Private members inside of classes, must start with #.
Match an expression against a series of cases.
Tagged template expression.
Throw a user defined exception. Stops execution of the current function.
Type Aliases
TypeScript accessibility modifiers used in classes
Union type of all possible expression nodes
Union type of all possible child nodes in JSX
Union type of all Literals
Union type of all possible AST nodes
Function/Method parameter
Union type of all possible statement nodes
Union type of all possible type nodes in TypeScript
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.LintVisitor
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
© 2018–2025 the Deno authors
Licensed under the MIT License.
https://docs.deno.com/api/deno/linter