Linter
Интерфейсы и вспомогательные средства для написания и тестирования пользовательских правил линтинга.
Например: Deno.lint.Plugin
функция Deno.lint.runPlugin
runPlugin(): Diagnostic[]Этот API полезен для тестирования плагинов линтинга.
Выбрасывает ошибку, если используется не в подкоманде deno test.
Параметры
Тип возвращаемого значения
интерфейс Deno.lint.AccessorProperty
Свойства
type: "AccessorProperty" declare: boolean computed: boolean optional: boolean override: boolean readonly: boolean static: boolean accessibility: Accessibility | undefined value: Expression | null интерфейс Deno.lint.ArrayPattern
Деструктуризация массива.
Свойства
type: "ArrayPattern" optional: boolean typeAnnotation: TSTypeAnnotation | undefined elements: Array<
ArrayPattern
| AssignmentPattern
| Identifier
| MemberExpression
| ObjectPattern
| RestElement
| null
> интерфейс Deno.lint.ArrowFunctionExpression
Выражение стрелочной функции
Свойства
type: "ArrowFunctionExpression" async: boolean generator: boolean id: null typeParameters: TSTypeParameterDeclaration | undefined returnType: TSTypeAnnotation | undefined интерфейс Deno.lint.AssignmentExpression
интерфейс Deno.lint.AssignmentPattern
Задание значений по умолчанию в параметрах.
Свойства
type: "AssignmentPattern" интерфейс Deno.lint.AwaitExpression
интерфейс Deno.lint.BinaryExpression
интерфейс Deno.lint.BlockComment
интерфейс Deno.lint.BreakStatement
Прерывает любой цикл или помеченный оператор, например:
while (true) {
break;
}
for (let i = 0; i < 10; i++) {
if (i > 5) break;
}
Свойства
type: "BreakStatement" label: Identifier | null интерфейс Deno.lint.CallExpression
Вызов функции.
Свойства
интерфейс Deno.lint.CatchClause
интерфейс Deno.lint.ClassBody
Представляет тело класса и содержит все его члены
Свойства
type: "ClassBody" интерфейс Deno.lint.ClassDeclaration
Объявляет класс в текущей области видимости
Свойства
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
интерфейс Deno.lint.ClassExpression
Аналогичен ClassDeclaration, но объявляет класс в виде выражения. Главное отличие состоит в том, что имя класса (=id) можно опустить.
Свойства
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 интерфейс Deno.lint.ConditionalExpression
Условный оператор в строке.
Свойства
type: "ConditionalExpression" интерфейс Deno.lint.ContinueStatement
Завершает текущий цикл и переходит к следующей итерации.
Свойства
type: "ContinueStatement" label: Identifier | null интерфейс Deno.lint.DebuggerStatement
Оператор debugger;.
Свойства
type: "DebuggerStatement" интерфейс Deno.lint.Decorator
Экспериментальная возможность: декораторы
Свойства
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
интерфейс Deno.lint.DoWhileStatement
Повторяет цикл, пока проверочное выражение истинно.
Свойства
type: "DoWhileStatement" интерфейс Deno.lint.ExportAllDeclaration
Свойства
интерфейс Deno.lint.ExportDefaultDeclaration
Свойства
интерфейс Deno.lint.ExportNamedDeclaration
Свойства
интерфейс Deno.lint.ExportSpecifier
Свойства
type: "ExportSpecifier" exportKind: "type" | "value" интерфейс Deno.lint.ExpressionStatement
Инструкция, содержащая выражение.
Свойства
type: "ExpressionStatement" интерфейс Deno.lint.Fixer
Методы
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 интерфейс Deno.lint.ForInStatement
Перебирает все перечисляемые строковые свойства объекта.
Свойства
type: "ForInStatement" интерфейс Deno.lint.ForOfStatement
интерфейс Deno.lint.ForStatement
Классический цикл for.
Свойства
интерфейс Deno.lint.FunctionDeclaration
Объявляет функцию в текущей области видимости
Свойства
type: "FunctionDeclaration" declare: boolean async: boolean generator: boolean id: Identifier | null typeParameters: TSTypeParameterDeclaration | undefined returnType: TSTypeAnnotation | undefined body: BlockStatement | null интерфейс Deno.lint.FunctionExpression
Объявляет функцию как выражение. Похоже на FunctionDeclaration, с необязательным именем (=id).
Свойства
type: "FunctionExpression" async: boolean generator: boolean id: Identifier | null typeParameters: TSTypeParameterDeclaration | undefined returnType: TSTypeAnnotation | undefined интерфейс Deno.lint.Identifier
Именованный разработчиком узел. Может быть именем переменной, функции, параметра и т. д.
Свойства
интерфейс Deno.lint.IfStatement
Выполняет оператор, если условие истинно, в противном случае — альтернативный оператор, если он задан.
Свойства
type: "IfStatement" интерфейс Deno.lint.ImportAttribute
Свойства
type: "ImportAttribute" key: Identifier | Literal интерфейс Deno.lint.ImportDeclaration
Объявление импорта, например:
Свойства
type: "ImportDeclaration" importKind: "type" | "value" интерфейс Deno.lint.ImportSpecifier
Свойства
type: "ImportSpecifier" importKind: "type" | "value" интерфейс Deno.lint.JSXClosingElement
Закрывающий тег JSXElement. Используется только в том случае, если элемент не является самозакрывающимся.
Свойства
type: "JSXClosingElement" интерфейс Deno.lint.JSXElement
Элемент JSX.
Свойства
type: "JSXElement" closingElement: JSXClosingElement | null интерфейс Deno.lint.JSXExpressionContainer
Вставляет обычное выражение JS в JSX.
Свойства
type: "JSXExpressionContainer" интерфейс Deno.lint.JSXFragment
Обычно это узел-пропуск, позволяющий передать несколько соседних элементов, поскольку синтаксис JSX требует один корневой элемент.
Свойства
type: "JSXFragment" интерфейс Deno.lint.JSXIdentifier
интерфейс Deno.lint.JSXMemberExpression
Выражение обращения к члену JSX.
Свойства
type: "JSXMemberExpression" интерфейс Deno.lint.JSXNamespacedName
Имя с пространством имён в JSX
Свойства
type: "JSXNamespacedName" интерфейс Deno.lint.JSXOpeningElement
Открывающий тег JSXElement
Свойства
type: "JSXOpeningElement" selfClosing: boolean attributes: Array<JSXAttribute | JSXSpreadAttribute> typeArguments: TSTypeParameterInstantiation | undefined интерфейс Deno.lint.JSXSpreadAttribute
Раскрывает объект в виде атрибутов JSX.
Свойства
интерфейс Deno.lint.LabeledStatement
Пользовательское управление потоком на основе меток.
Свойства
type: "LabeledStatement" интерфейс Deno.lint.LineComment
интерфейс Deno.lint.LogicalExpression
интерфейс Deno.lint.MemberExpression
интерфейс Deno.lint.MethodDefinition
Свойства
type: "MethodDefinition" declare: boolean computed: boolean optional: boolean override: boolean readonly: boolean static: boolean kind:
"constructor"
| "get"
| "method"
| "set"
accessibility: Accessibility | undefined интерфейс Deno.lint.NewExpression
Создаёт новый экземпляр класса.
Свойства
type: "NewExpression" typeArguments: TSTypeParameterInstantiation | undefined arguments: Array<Expression | SpreadElement> интерфейс Deno.lint.ObjectPattern
Деструктурирует объект.
Свойства
type: "ObjectPattern" optional: boolean typeAnnotation: TSTypeAnnotation | undefined properties: Array<Property | RestElement> интерфейс Deno.lint.Plugin
интерфейс Deno.lint.PrivateIdentifier
интерфейс Deno.lint.Program
Свойства
интерфейс Deno.lint.PropertyDefinition
Свойства
type: "PropertyDefinition" declare: boolean computed: boolean optional: boolean override: boolean readonly: boolean static: boolean accessibility: Accessibility | undefined value: Expression | null typeAnnotation: TSTypeAnnotation | undefined интерфейс Deno.lint.RestElement
Остаток параметров функции.
Свойства
интерфейс Deno.lint.ReturnStatement
Возвращает значение из функции.
Свойства
type: "ReturnStatement" argument: Expression | null интерфейс Deno.lint.Rule
Методы
create(ctx: RuleContext): LintVisitor destroy(ctx: RuleContext): void интерфейс Deno.lint.RuleContext
Свойства
Методы
report(data: ReportData): void Сообщить об ошибке линтера.
getFilename(): string getSourceCode(): SourceCode интерфейс Deno.lint.SequenceExpression
Выполняет несколько выражений последовательно.
Свойства
интерфейс Deno.lint.SourceCode
Свойства
Методы
Получить исходный текст узла. Не указывайте node, чтобы получить полный исходный код.
getAncestors(node: Node): Node[] Возвращает массив предков текущего узла, не включая сам текущий узел.
getAllComments(): Array<LineComment | BlockComment> Получить все комментарии в исходном коде.
getCommentsBefore(node: Node): Array<LineComment | BlockComment> Получить предшествующие комментарии перед узлом.
getCommentsAfter(node: Node): Array<LineComment | BlockComment> Получить последующие комментарии после узла.
getCommentsInside(node: Node): Array<LineComment | BlockComment> Получить комментарии внутри узла.
интерфейс Deno.lint.SwitchCase
Один вариант оператора SwitchStatement.
Свойства
type: "SwitchCase" test: Expression | null интерфейс Deno.lint.SwitchStatement
Сопоставляет выражение с последовательностью вариантов.
Свойства
type: "SwitchStatement" cases: SwitchCase[] интерфейс Deno.lint.TaggedTemplateExpression
Помеченное шаблонное выражение.
Свойства
type: "TaggedTemplateExpression" typeArguments: TSTypeParameterInstantiation | undefined интерфейс Deno.lint.TemplateElement
интерфейс Deno.lint.TemplateLiteral
Строка-шаблонный литерал.
Свойства
type: "TemplateLiteral" интерфейс Deno.lint.ThrowStatement
Выбрасывает исключение, определённое пользователем. Останавливает выполнение текущей функции.
Свойства
type: "ThrowStatement" интерфейс Deno.lint.TryStatement
Инструкция try/catch
Свойства
интерфейс Deno.lint.TSAbstractMethodDefinition
Свойства
type: "TSAbstractMethodDefinition" computed: boolean optional: boolean override: boolean static: boolean accessibility: Accessibility | undefined kind: "method" интерфейс Deno.lint.TSAbstractPropertyDefinition
Свойства
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 интерфейс Deno.lint.TSArrayType
интерфейс Deno.lint.TSCallSignatureDeclaration
Свойства
type: "TSCallSignatureDeclaration" typeParameters: TSTypeParameterDeclaration | undefined returnType: TSTypeAnnotation | undefined интерфейс Deno.lint.TSClassImplements
Свойства
type: "TSClassImplements" typeArguments: TSTypeParameterInstantiation | undefined интерфейс Deno.lint.TSConstructSignatureDeclaration
Свойства
type: "TSConstructSignatureDeclaration" typeParameters: TSTypeParameterDeclaration | undefined интерфейс Deno.lint.TSDeclareFunction
Свойства
type: "TSDeclareFunction" async: boolean declare: boolean generator: boolean body: undefined id: Identifier | null returnType: TSTypeAnnotation | undefined typeParameters: TSTypeParameterDeclaration | undefined интерфейс Deno.lint.TSEmptyBodyFunctionExpression
Свойства
type: "TSEmptyBodyFunctionExpression" declare: boolean expression: boolean async: boolean generator: boolean id: null body: null typeParameters: TSTypeParameterDeclaration | undefined returnType: TSTypeAnnotation | undefined интерфейс Deno.lint.TSEnumDeclaration
интерфейс Deno.lint.TSEnumMember
Элемент TSEnumDeclaration
Свойства
type: "TSEnumMember" initializer: Expression | undefined интерфейс Deno.lint.TSFunctionType
Свойства
type: "TSFunctionType" returnType: TSTypeAnnotation | undefined typeParameters: TSTypeParameterDeclaration | undefined интерфейс Deno.lint.TSImportEqualsDeclaration
Свойства
type: "TSImportEqualsDeclaration" importKind: "type" | "value" интерфейс Deno.lint.TSIndexedAccessType
интерфейс Deno.lint.TSIndexSignature
Свойства
type: "TSIndexSignature" readonly: boolean static: boolean typeAnnotation: TSTypeAnnotation | undefined интерфейс Deno.lint.TSInstantiationExpression
Свойства
type: "TSInstantiationExpression" интерфейс Deno.lint.TSInterfaceDeclaration
Свойства
type: "TSInterfaceDeclaration" declare: boolean typeParameters: TSTypeParameterDeclaration | undefined интерфейс Deno.lint.TSInterfaceHeritage
Свойства
type: "TSInterfaceHeritage" typeArguments: TSTypeParameterInstantiation | undefined интерфейс Deno.lint.TSMappedType
Свойства
интерфейс Deno.lint.TSMethodSignature
Свойства
type: "TSMethodSignature" computed: boolean optional: boolean readonly: boolean static: boolean kind:
"get"
| "set"
| "method"
returnType: TSTypeAnnotation | undefined typeParameters: TSTypeParameterDeclaration | undefined интерфейс Deno.lint.TSModuleBlock
Тело TSModuleDeclaration
Свойства
type: "TSModuleBlock" интерфейс Deno.lint.TSModuleDeclaration
Свойства
type: "TSModuleDeclaration" declare: boolean kind:
"global"
| "module"
| "namespace"
body: TSModuleBlock | undefined интерфейс Deno.lint.TSNamedTupleMember
интерфейс Deno.lint.TSNamespaceExportDeclaration
интерфейс Deno.lint.TSOptionalType
интерфейс Deno.lint.TSParameterProperty
Свойства
type: "TSParameterProperty" override: boolean readonly: boolean static: boolean accessibility: Accessibility | undefined интерфейс Deno.lint.TSPropertySignature
Свойства
type: "TSPropertySignature" computed: boolean optional: boolean readonly: boolean static: boolean typeAnnotation: TSTypeAnnotation | undefined интерфейс Deno.lint.TSRestType
интерфейс Deno.lint.TSTemplateLiteralType
интерфейс Deno.lint.TSTupleType
интерфейс Deno.lint.TSTypeAliasDeclaration
Свойства
type: "TSTypeAliasDeclaration" declare: boolean typeParameters: TSTypeParameterDeclaration | undefined интерфейс Deno.lint.TSTypeAnnotation
интерфейс Deno.lint.TSTypeOperator
интерфейс Deno.lint.TSTypeParameter
интерфейс Deno.lint.TSTypeParameterDeclaration
интерфейс Deno.lint.TSTypeParameterInstantiation
Свойства
type: "TSTypeParameterInstantiation" интерфейс Deno.lint.TSTypePredicate
Свойства
интерфейс Deno.lint.TSTypeQuery
Свойства
type: "TSTypeQuery" typeArguments: TSTypeParameterInstantiation | undefined интерфейс Deno.lint.TSTypeReference
Свойства
type: "TSTypeReference" typeArguments: TSTypeParameterInstantiation | undefined интерфейс Deno.lint.UnaryExpression
интерфейс Deno.lint.UpdateExpression
интерфейс Deno.lint.VariableDeclaration
интерфейс Deno.lint.VariableDeclarator
Объявление переменных может объявлять несколько переменных. Этот узел представляет одно отдельное объявление.
Свойства
интерфейс Deno.lint.WhileStatement
Выполняет цикл, пока проверочное выражение истинно.
Свойства
type: "WhileStatement" интерфейс Deno.lint.YieldExpression
интерфейс Deno.lint.WithStatement
Устаревшая возможность JavaScript, использование которой сегодня не рекомендуется.
Свойства
type: "WithStatement" пространство имён Deno.lint
Функции
Этот API полезен для тестирования плагинов линтера.
Интерфейсы
Выражение стрелочной функции
Ожидание результата Promise и получение его выполненного значения.
Прерывает любой цикл или именованную инструкцию, например:
Объявляет класс в текущей области видимости
Похоже на ClassDeclaration, но используется для объявления класса как выражения. Основное отличие состоит в том, что имя класса (=id) можно опустить.
Встроенная инструкция if.
Завершает текущую итерацию цикла и переходит к следующей.
Объявляет функцию в текущей области видимости
Объявляет функцию в виде выражения. Похоже на FunctionDeclaration, но с необязательным именем (=id).
Пользовательский именованный узел, заданный разработчиком. Может быть именем переменной, функции, параметра и т. д.
Выполняет оператор, если условие истинно; в противном случае выполняет альтернативный оператор, если он задан.
Объявление импорта, примеры:
Закрывающий тег JSXElement. Используется только для элементов, у которых нет самозакрывающегося тега.
Обычно это промежуточный узел для нескольких соседних элементов, поскольку синтаксис JSX требует наличия одного корневого элемента.
Открывающий тег JSXElement
Создаёт новый экземпляр класса.
Деструктуризация объекта.
Имена приватных членов классов должны начинаться с #.
Последовательное выполнение нескольких выражений.
Сопоставление выражения с набором вариантов.
Тегированный шаблонный литерал.
Выбрасывает исключение, определяемое пользователем. Прекращает выполнение текущей функции.
Псевдонимы типов
Модификаторы доступа TypeScript, используемые в классах
Объединённый тип всех возможных узлов выражений
Объединённый тип всех возможных дочерних узлов в JSX
Объединённый тип всех литералов
Объединённый тип всех возможных узлов AST
Параметр функции/метода
Объединённый тип всех возможных узлов инструкций
Объединённый тип всех возможных узлов типов в TypeScript
псевдоним типа Deno.lint.Accessibility
Модификаторы доступа TypeScript, используемые в классах
Определение
"private"
| "protected"
| "public"
псевдоним типа Deno.lint.Expression
Объединение всех возможных узлов выражений
Определение
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
псевдоним типа Deno.lint.JSXChild
Объединение всех возможных дочерних узлов JSX
Определение
псевдоним типа Deno.lint.LintVisitor
псевдоним типа Deno.lint.Node
Объединение всех возможных узлов AST
Определение
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
псевдоним типа Deno.lint.Statement
Объединение всех возможных узлов операторов
Определение
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
псевдоним типа Deno.lint.TypeNode
Объединение всех возможных узлов типов в TypeScript
Определение
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