Примеры ошибок, обнаруженных с помощью диагностики V7001
V7001. Operands of a binary operator are equivalent.
jQuery
V7001 The operands of the '||' operator are equivalent. gh-1764-fullscreen.js 13
var fullscreenSupported = document.exitFullscreen || // <=
document.exitFullscreen || // <=
document.msExitFullscreen ||
document.mozCancelFullScreen ||
document.webkitExitFullscreen;
ESLint
V7001 The operands of the '&&' operator are equivalent. space-unary-ops.js 109
/**
* Check if the node is the first "!" in a "!!" convert to Boolean expression
* @param {ASTnode} node AST node
* @returns {boolean} Whether or not the node is first "!" in "!!"
*/
function isFirstBangInBangBangExpression(node) {
return (
node &&
node.type === "UnaryExpression" &&
node.argument.operator === "!" && // <=
node.argument &&
node.argument.type === "UnaryExpression" &&
node.argument.operator === "!" // <=
);
}
Visual Studio Code
V7001 The operands of the '===' operator are equivalent. uriIdentityService.ts 63
const oldIgnorePathCasingValue = schemeIgnoresPathCasingCache.get(e.scheme);
if (oldIgnorePathCasingValue === undefined) {
return;
}
schemeIgnoresPathCasingCache.delete(e.scheme);
const newIgnorePathCasingValue = ignorePathCasing(URI.from(....);
if (newIgnorePathCasingValue === newIgnorePathCasingValue) { // <=
return;
}
....