function checkForLoops(node) {
			const loopNode = getContainingLoopNode(node);

			if (!loopNode) {
				return;
			}

			const references = sourceCode.getScope(node).through;

			// Check if the function is not asynchronous or a generator function
			if (!(node.async || node.generator)) {
				if (isIIFE(node)) {
					const isFunctionExpression =
						node.type === "FunctionExpression";

					// Check if the function is referenced elsewhere in the code
					const isFunctionReferenced =
						isFunctionExpression && node.id
							? references.some(
									r => r.identifier.name === node.id.name,
								)
							: false;

					if (!isFunctionReferenced) {
						SKIPPED_IIFE_NODES.add(node);
						return;
					}
				}
			}

			const unsafeRefs = [
				...new Set(
					references
						.filter(r => r.resolved && !isSafe(loopNode, r))
						.map(r => r.identifier.name),
				),
			];

			if (unsafeRefs.length > 0) {
				context.report({
					node,
					messageId: "unsafeRefs",
					data: { varNames: `'${unsafeRefs.join("', '")}'` },
				});
			}
		}
Reports functions which match the following condition:

- has a loop node in ancestors.
- has any references which refers to an unsafe variable.
@param {ASTNode} node The AST node to check.
@returns {void}