function isInFlaggedContext(node) {
			if (node.parent.type === "ChainExpression") {
				return isInFlaggedContext(node.parent);
			}

			/*
			 * legacy behavior - enforceForLogicalOperands will only recurse on
			 * logical expressions, not on other contexts.
			 * enforceForInnerExpressions will recurse on logical expressions
			 * as well as the other recursive syntaxes.
			 */

			if (enforceForLogicalOperands || enforceForInnerExpressions) {
				if (node.parent.type === "LogicalExpression") {
					if (
						node.parent.operator === "||" ||
						node.parent.operator === "&&"
					) {
						return isInFlaggedContext(node.parent);
					}

					// Check the right hand side of a `??` operator.
					if (
						enforceForInnerExpressions &&
						node.parent.operator === "??" &&
						node.parent.right === node
					) {
						return isInFlaggedContext(node.parent);
					}
				}
			}

			if (enforceForInnerExpressions) {
				if (
					node.parent.type === "ConditionalExpression" &&
					(node.parent.consequent === node ||
						node.parent.alternate === node)
				) {
					return isInFlaggedContext(node.parent);
				}

				/*
				 * Check last expression only in a sequence, i.e. if ((1, 2, Boolean(3))) {}, since
				 * the others don't affect the result of the expression.
				 */
				if (
					node.parent.type === "SequenceExpression" &&
					node.parent.expressions.at(-1) === node
				) {
					return isInFlaggedContext(node.parent);
				}
			}

			return isInBooleanContext(node);
		}
Checks whether the node is a context that should report an error
Acts recursively if it is in a logical context
@param {ASTNode} node the node
@returns {boolean} If the node is in one of the flagged contexts