Skip to main content

Linter

Interfaces and helpers for writing and testing custom lint rules.

Eg Deno.lint.Plugin

Functions

f
Deno.lint.runPlugin

This API is useful for testing lint plugins.

    Interfaces

    I
    Deno.lint.AssignmentPattern

    Assign default values in parameters.

    I
    Deno.lint.AwaitExpression

    Await a Promise and get its fulfilled value.

    I
    Deno.lint.BigIntLiteral

    Represents numbers that are too high or too low to be represented by the number type.

    I
    Deno.lint.BinaryExpression

    Compare left and right value with the specifier operator.

    I
    Deno.lint.BlockComment

    A potentially multi-line block comment

    I
    Deno.lint.BreakStatement

    Break any loop or labeled statement, example:

    I
    Deno.lint.CatchClause

    The catch clause of a try/catch statement

    I
    Deno.lint.ClassBody

    Represents the body of a class and contains all members

    I
    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.

    I
    Deno.lint.ContinueStatement

    Terminates the current loop and continues with the next iteration.

    I
    Deno.lint.DoWhileStatement

    Re-run loop for as long as test expression is truthy.

    I
    I
    Deno.lint.Fix
    No documentation available
    I
    Deno.lint.ForInStatement

    Enumerate over all enumerable string properties of an object.

    I
    Deno.lint.ForOfStatement

    Iterate over sequence of values from an iterator.

    I
    Deno.lint.FunctionExpression

    Declare a function as an expression. Similar to FunctionDeclaration, with an optional name (=id).

    I
    Deno.lint.Identifier

    Custom named node by the developer. Can be a variable name, a function name, parameter, etc.

    I
    Deno.lint.IfStatement

    Execute a statement the test passes, otherwise the alternate statement, if it was defined.

    I
    Deno.lint.JSXClosingElement

    The closing tag of a JSXElement. Only used when the element is not self-closing.

    I
    Deno.lint.JSXClosingFragment

    The closing tag of a JSXFragment.

    I
    Deno.lint.JSXExpressionContainer

    Inserts a normal JS expression into JSX.

    I
    Deno.lint.JSXFragment

    Usually a passthrough node to pass multiple sibling elements as the JSX syntax requires one root element.

    I
    Deno.lint.JSXIdentifier

    User named identifier inside JSX.

    I
    Deno.lint.JSXOpeningFragment

    The opening tag of a JSXFragment.

    I
    Deno.lint.JSXSpreadAttribute

    Spreads an object as JSX attributes.

    I
    Deno.lint.LabeledStatement

    Custom control flow based on labels.

    I
    Deno.lint.LogicalExpression

    Chain expressions based on the operator specified

    I
    Deno.lint.MetaProperty

    Can either be import.meta or new.target.

    I
    Deno.lint.Plugin

    In your plugins file do something like

    I
    Deno.lint.PrivateIdentifier

    Private members inside of classes, must start with #.

    I
    Deno.lint.ReturnStatement

    Returns a value from a function.

    I
    Deno.lint.Rule
    No documentation available
    I
    Deno.lint.SequenceExpression

    Execute multiple expressions in sequence.

    I
    Deno.lint.StaticBlock

    Static class initializiation block.

    I
    Deno.lint.Super

    The super keyword used in classes.

    I
    Deno.lint.SwitchCase

    A single case of a SwitchStatement.

    I
    Deno.lint.SwitchStatement

    Match an expression against a series of cases.

    I
    Deno.lint.TemplateElement

    The static portion of a template literal.

    I
    Deno.lint.ThisExpression

    The this keyword used in classes.

    I
    Deno.lint.ThrowStatement

    Throw a user defined exception. Stops execution of the current function.

    I
    Deno.lint.TSAnyKeyword
    No documentation available
    I
    I
    Deno.lint.TSEnumBody

    The body of a TSEnumDeclaration

    I
    Deno.lint.TSModuleBlock

    Body of a TSModuleDeclaration

    I
    Deno.lint.TSNeverKeyword
    No documentation available
    I
    Deno.lint.TSNullKeyword
    No documentation available
    I
    I
    I
    I
    I
    Deno.lint.TSThisType
    No documentation available
    I
    Deno.lint.TSVoidKeyword
    No documentation available
    I
    Deno.lint.UnaryExpression

    Apply operand on value based on the specified operator.

    I
    Deno.lint.UpdateExpression

    Syntactic sugar to increment or decrement a value.

    I
    Deno.lint.VariableDeclarator

    A VariableDeclaration can declare multiple variables. This node represents a single declaration out of that.

    I
    Deno.lint.WhileStatement

    Run a loop while the test expression is truthy.

    I
    I
    Deno.lint.WithStatement

    Legacy JavaScript feature, that's discouraged from being used today.

    Namespaces

    N
    Deno.lint
    No documentation available

      Type Aliases

      T
      Deno.lint.Accessibility

      TypeScript accessibility modifiers used in classes

        T
        Deno.lint.Expression

        Union type of all possible expression nodes

          T
          Deno.lint.JSXChild

          Union type of all possible child nodes in JSX

            T
            Deno.lint.LintVisitor
            No documentation available
              T
              Deno.lint.Literal

              Union type of all Literals

                T
                Deno.lint.Node

                Union type of all possible AST nodes

                  T
                  Deno.lint.Parameter

                  Function/Method parameter

                    T
                    Deno.lint.Range
                    No documentation available
                      T
                      Deno.lint.Statement

                      Union type of all possible statement nodes

                        T
                        Deno.lint.TypeNode

                        Union type of all possible type nodes in TypeScript


                          function Deno.lint.runPlugin

                          unstable
                          #runPlugin(
                          plugin: Plugin,
                          fileName: string,
                          source: string,
                          ): Diagnostic[]

                          This API is useful for testing lint plugins.

                          It throws an error if it's not used in deno test subcommand.

                          Parameters #

                          #plugin: Plugin
                          #fileName: string
                          #source: string

                          Return Type #




















                          interface Deno.lint.ClassExpression

                          unstable




















































                          interface Deno.lint.Plugin

                          unstable

                          In your plugins file do something like

                          export default {
                            name: "my-plugin",
                            rules: {
                              "no-foo": {
                                 create(ctx) {
                                   return {
                                      VariableDeclaration(node) {}
                                   }
                                 }
                              }
                            }
                          } satisfies Deno.lint.Plugin
                          

                          Properties #

                          #name: string
                          #rules: Record<string, Rule>












                          interface Deno.lint.SourceCode

                          unstable

                          Properties #

                          #text: string

                          Get the full source code.

                          Get the root node of the file. It's always the Program node.

                          Methods #

                          #getText(node?: Node): string

                          Get the source test of a node. Omit node to get the full source code.

                          Returns array of ancestors of the current node, excluding the current node.

                          Get all comments inside the source.

                          Get leading comments before a node.

                          Get trailing comments after a node.

                          Get comments inside a node.

























































































                          namespace Deno.lint

                          unstable

                          Functions #

                          f
                          Deno.lint.runPlugin

                          This API is useful for testing lint plugins.

                            Interfaces #

                            I
                            Deno.lint.AssignmentPattern

                            Assign default values in parameters.

                            I
                            Deno.lint.AwaitExpression

                            Await a Promise and get its fulfilled value.

                            I
                            Deno.lint.BigIntLiteral

                            Represents numbers that are too high or too low to be represented by the number type.

                            I
                            Deno.lint.BinaryExpression

                            Compare left and right value with the specifier operator.

                            I
                            Deno.lint.BlockComment

                            A potentially multi-line block comment

                            I
                            Deno.lint.BreakStatement

                            Break any loop or labeled statement, example:

                            I
                            Deno.lint.CatchClause

                            The catch clause of a try/catch statement

                            I
                            Deno.lint.ClassBody

                            Represents the body of a class and contains all members

                            I
                            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.

                            I
                            Deno.lint.ContinueStatement

                            Terminates the current loop and continues with the next iteration.

                            I
                            Deno.lint.DoWhileStatement

                            Re-run loop for as long as test expression is truthy.

                            I
                            I
                            Deno.lint.Fix
                            No documentation available
                            I
                            Deno.lint.ForInStatement

                            Enumerate over all enumerable string properties of an object.

                            I
                            Deno.lint.ForOfStatement

                            Iterate over sequence of values from an iterator.

                            I
                            Deno.lint.FunctionExpression

                            Declare a function as an expression. Similar to FunctionDeclaration, with an optional name (=id).

                            I
                            Deno.lint.Identifier

                            Custom named node by the developer. Can be a variable name, a function name, parameter, etc.

                            I
                            Deno.lint.IfStatement

                            Execute a statement the test passes, otherwise the alternate statement, if it was defined.

                            I
                            Deno.lint.JSXClosingElement

                            The closing tag of a JSXElement. Only used when the element is not self-closing.

                            I
                            Deno.lint.JSXClosingFragment

                            The closing tag of a JSXFragment.

                            I
                            Deno.lint.JSXExpressionContainer

                            Inserts a normal JS expression into JSX.

                            I
                            Deno.lint.JSXFragment

                            Usually a passthrough node to pass multiple sibling elements as the JSX syntax requires one root element.

                            I
                            Deno.lint.JSXIdentifier

                            User named identifier inside JSX.

                            I
                            Deno.lint.JSXOpeningFragment

                            The opening tag of a JSXFragment.

                            I
                            Deno.lint.JSXSpreadAttribute

                            Spreads an object as JSX attributes.

                            I
                            Deno.lint.LabeledStatement

                            Custom control flow based on labels.

                            I
                            Deno.lint.LogicalExpression

                            Chain expressions based on the operator specified

                            I
                            Deno.lint.MetaProperty

                            Can either be import.meta or new.target.

                            I
                            Deno.lint.Plugin

                            In your plugins file do something like

                            I
                            Deno.lint.PrivateIdentifier

                            Private members inside of classes, must start with #.

                            I
                            Deno.lint.ReturnStatement

                            Returns a value from a function.

                            I
                            Deno.lint.Rule
                            No documentation available
                            I
                            Deno.lint.SequenceExpression

                            Execute multiple expressions in sequence.

                            I
                            Deno.lint.StaticBlock

                            Static class initializiation block.

                            I
                            Deno.lint.Super

                            The super keyword used in classes.

                            I
                            Deno.lint.SwitchCase

                            A single case of a SwitchStatement.

                            I
                            Deno.lint.SwitchStatement

                            Match an expression against a series of cases.

                            I
                            Deno.lint.TemplateElement

                            The static portion of a template literal.

                            I
                            Deno.lint.ThisExpression

                            The this keyword used in classes.

                            I
                            Deno.lint.ThrowStatement

                            Throw a user defined exception. Stops execution of the current function.

                            I
                            Deno.lint.TSAnyKeyword
                            No documentation available
                            I
                            I
                            Deno.lint.TSEnumBody

                            The body of a TSEnumDeclaration

                            I
                            Deno.lint.TSModuleBlock

                            Body of a TSModuleDeclaration

                            I
                            Deno.lint.TSNeverKeyword
                            No documentation available
                            I
                            Deno.lint.TSNullKeyword
                            No documentation available
                            I
                            I
                            I
                            I
                            I
                            Deno.lint.TSThisType
                            No documentation available
                            I
                            Deno.lint.TSVoidKeyword
                            No documentation available
                            I
                            Deno.lint.UnaryExpression

                            Apply operand on value based on the specified operator.

                            I
                            Deno.lint.UpdateExpression

                            Syntactic sugar to increment or decrement a value.

                            I
                            Deno.lint.VariableDeclarator

                            A VariableDeclaration can declare multiple variables. This node represents a single declaration out of that.

                            I
                            Deno.lint.WhileStatement

                            Run a loop while the test expression is truthy.

                            I
                            I
                            Deno.lint.WithStatement

                            Legacy JavaScript feature, that's discouraged from being used today.

                            Type Aliases #

                            T
                            Deno.lint.Accessibility

                            TypeScript accessibility modifiers used in classes

                              T
                              Deno.lint.Expression

                              Union type of all possible expression nodes

                                T
                                Deno.lint.JSXChild

                                Union type of all possible child nodes in JSX

                                  T
                                  Deno.lint.LintVisitor
                                  No documentation available
                                    T
                                    Deno.lint.Literal

                                    Union type of all Literals

                                      T
                                      Deno.lint.Node

                                      Union type of all possible AST nodes

                                        T
                                        Deno.lint.Parameter

                                        Function/Method parameter

                                          T
                                          Deno.lint.Range
                                          No documentation available
                                            T
                                            Deno.lint.Statement

                                            Union type of all possible statement nodes

                                              T
                                              Deno.lint.TypeNode

                                              Union type of all possible type nodes in TypeScript


                                                type alias Deno.lint.Accessibility

                                                unstable

                                                TypeScript accessibility modifiers used in classes

                                                Definition #

                                                "private"
                                                | "protected"
                                                | "public"



                                                type alias Deno.lint.LintVisitor

                                                unstable

                                                Definition #

                                                [P in Node["type"]]?: (node: Extract<Node, { type: P; }>) => void
                                                & [P in Node["type"] in keyof `${P}:exit`]?: (node: Extract<Node, { type: P; }>) => void
                                                & Partial<{ [key: string]: (node: any) => void; }>


                                                type alias Deno.lint.Node

                                                unstable





                                                Did you find what you needed?

                                                Privacy policy