Skip to content

⬅️ Back to Table of Contents

📄 getRuleTesterCallObject

📊 Analysis Summary

Metric Count
🔧 Functions 1
📦 Imports 2

📚 Table of Contents

🛠️ File Location:

📂 packages/eslint-plugin-internal/src/util/getRuleTesterCallObject.ts

📦 Imports

Name Source
TSESTree @typescript-eslint/utils
AST_NODE_TYPES @typescript-eslint/utils

Functions

getRuleTesterCallObject(node: TSESTree.Node): TSESTree.ObjectExpression | undefined

Parameters:

  • node TSESTree.Node

Returns: TSESTree.ObjectExpression | undefined

Code
export function getRuleTesterCallObject(
  node: TSESTree.Node,
): TSESTree.ObjectExpression | undefined {
  return node.type === AST_NODE_TYPES.CallExpression &&
    node.arguments.length >= 3 &&
    node.arguments[2].type === AST_NODE_TYPES.ObjectExpression &&
    node.callee.type === AST_NODE_TYPES.MemberExpression &&
    node.callee.object.type === AST_NODE_TYPES.Identifier &&
    node.callee.object.name === 'ruleTester' &&
    node.callee.property.type === AST_NODE_TYPES.Identifier &&
    node.callee.property.name === 'run'
    ? node.arguments[2]
    : undefined;
}

Generated by Syntax Scribe