@forge/lint

6.2.3-next.216.3.0-next.22
out/lint/linters/teamwork-graph-linter/detect-teamwork-graph-usage.js
+out/lint/linters/teamwork-graph-linter/detect-teamwork-graph-usage.jsNew file
+27
Index: package/out/lint/linters/teamwork-graph-linter/detect-teamwork-graph-usage.js
===================================================================
--- package/out/lint/linters/teamwork-graph-linter/detect-teamwork-graph-usage.js
+++ package/out/lint/linters/teamwork-graph-linter/detect-teamwork-graph-usage.js
@@ -0,0 +1,27 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.doesAstUseTeamworkGraph = void 0;
+const typescript_estree_1 = require("@typescript-eslint/typescript-estree");
+const doesAstUseTeamworkGraph = (ast) => {
+    let found = false;
+    ast?.traverse({
+        enter: (node) => {
+            if (found || node.type !== typescript_estree_1.AST_NODE_TYPES.CallExpression)
+                return;
+            const callee = node.callee;
+            if (callee.type === typescript_estree_1.AST_NODE_TYPES.Identifier) {
+                found = callee.name === 'requestTeamworkGraph';
+            }
+            else if (callee.type === typescript_estree_1.AST_NODE_TYPES.MemberExpression) {
+                if (callee.computed) {
+                    found = callee.property.type === typescript_estree_1.AST_NODE_TYPES.Literal && callee.property.value === 'requestTeamworkGraph';
+                }
+                else {
+                    found = callee.property.type === typescript_estree_1.AST_NODE_TYPES.Identifier && callee.property.name === 'requestTeamworkGraph';
+                }
+            }
+        }
+    });
+    return found;
+};
+exports.doesAstUseTeamworkGraph = doesAstUseTeamworkGraph;