UNPKG

eslint-plugin-exception-handling

Version:

💣 Lints unhandled functions that might throw errors. For JavaScript/TypeScript eslint.

68 lines (67 loc) • 2.65 kB
import { AST_NODE_TYPES } from "@typescript-eslint/types"; export function isFunctionDeclaration(node) { return node != null && node.type === AST_NODE_TYPES.FunctionDeclaration; } export function isMethodDefinition(node) { return node != null && node.type === AST_NODE_TYPES.MethodDefinition; } export function isMemberExpression(node) { return node != null && node.type === AST_NODE_TYPES.MemberExpression; } export function isTryStatement(node) { return node != null && node.type === AST_NODE_TYPES.TryStatement; } export function isImportDeclaration(node) { return node != null && node.type === AST_NODE_TYPES.ImportDeclaration; } export function isImportSpecifier(node) { return node != null && node.type === AST_NODE_TYPES.ImportSpecifier; } export function isVariableDeclaration(node) { return node != null && node.type === AST_NODE_TYPES.VariableDeclaration; } export function isVariableDeclarator(node) { return node != null && node.type === AST_NODE_TYPES.VariableDeclarator; } export function isBlockStatement(node) { return node != null && node.type === AST_NODE_TYPES.BlockStatement; } export function isProgram(node) { return node != null && node.type === AST_NODE_TYPES.Program; } export function isExportNamedDeclaration(node) { return node != null && node.type === AST_NODE_TYPES.ExportNamedDeclaration; } export function isThrowStatement(node) { return node != null && node.type === AST_NODE_TYPES.ThrowStatement; } export function isCallExpression(node) { return node != null && node.type === AST_NODE_TYPES.CallExpression; } export function isIdentifier(node) { return node != null && node.type === AST_NODE_TYPES.Identifier; } export function isPrivateIdentifier(node) { return node != null && node.type === AST_NODE_TYPES.PrivateIdentifier; } export function isCatchClause(node) { return node != null && node.type === AST_NODE_TYPES.CatchClause; } export function isNewExpression(node) { return node != null && node.type === AST_NODE_TYPES.NewExpression; } export function isObjectExpression(node) { return node != null && node.type === AST_NODE_TYPES.ObjectExpression; } export function isProperty(node) { return node != null && node.type === AST_NODE_TYPES.Property; } export function isClassDeclaration(node) { return node != null && node.type === AST_NODE_TYPES.ClassDeclaration; } export function isArrowFunctionExpression(node) { return node != null && node.type === AST_NODE_TYPES.ArrowFunctionExpression; } export function isExpressionStatement(node) { return node != null && node.type === AST_NODE_TYPES.ExpressionStatement; }