| Server IP : 217.160.0.135 / Your IP : 216.73.217.85 Web Server : Apache System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64 User : sws1074145052 ( 1074145052) PHP Version : 8.3.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /usr/share/node_modules/@babel/eslint-plugin/lib/rules/ |
Upload File : |
const ruleComposer = require("eslint-rule-composer");
const eslint = require("eslint");
const rule = new eslint.Linter().getRules().get("no-unused-expressions");
function isFinalStatementInBlockStatement(node) {
const parent = node.parent;
return /^(?:If|Expression)Statement$/.test(node.type) && parent.type === "BlockStatement" && parent.body[parent.body.length - 1] === node;
}
function isInDoStatement(node) {
if (!node) return false;
if (node.type === "DoExpression") return true;
if (node.type === "IfStatement" && node.parent && node.parent.type === "IfStatement") {
return isInDoStatement(node.parent);
}
if (isFinalStatementInBlockStatement(node)) {
return isInDoStatement(node.parent.parent);
}
return false;
}
function isOptionalCallExpression(node) {
return !!node && node.type === "ExpressionStatement" && node.expression.type === "ChainExpression" && node.expression.expression.type === "CallExpression";
}
module.exports = ruleComposer.filterReports(rule, problem => !isInDoStatement(problem.node) && !isOptionalCallExpression(problem.node));
//# sourceMappingURL=no-unused-expressions.cjs.map