MCPcopy Index your code
hub / github.com/scriptscat/scriptcat / CallExpression

Function CallExpression

eslint-rules/require-last-error-check.js:62–96  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

60
61 return {
62 CallExpression(node) {
63 const cb = node.arguments.find(
64 (a) => a && (a.type === "FunctionExpression" || a.type === "ArrowFunctionExpression")
65 );
66 if (!cb) return;
67
68 const callee = context.getSourceCode().getText(node.callee);
69 if (!callee.startsWith("chrome.")) return;
70
71 // Skip Promise-based API usage
72 const isPromise = node.parent?.type === "AwaitExpression";
73 if (isPromise) return;
74
75 // Check callback body for lastError reference
76 const cbBody = context.getSourceCode().getText(cb.body);
77 const checksLastError = cbBody.includes("chrome.runtime.lastError");
78
79 if (mustCheck.has(callee)) {
80 if (!checksLastError) {
81 context.report({
82 node: cb,
83 messageId: "missing",
84 data: { api: callee },
85 });
86 }
87 } else if (isMaybeCheck(callee)) {
88 if (!checksLastError) {
89 context.report({
90 node: cb,
91 messageId: "uncertain",
92 data: { api: callee },
93 });
94 }
95 }
96 },
97 };
98 },
99};

Callers

nothing calls this directly

Calls 2

isMaybeCheckFunction · 0.85
hasMethod · 0.65

Tested by

no test coverage detected