postaction()

in web/jslint/src/main/resources/data/jslint-2020-03-28.js [3975:4015]


postaction("binary", function (thing) {
  var right;

  if (relationop[thing.id]) {
    if (is_weird(thing.expression[0]) || is_weird(thing.expression[1]) || are_similar(thing.expression[0], thing.expression[1]) || thing.expression[0].constant === true && thing.expression[1].constant === true) {
      warn("weird_relation_a", thing);
    }
  }

  if (thing.id === "+") {
    if (!option.convert) {
      if (thing.expression[0].value === "") {
        warn("expected_a_b", thing, "String(...)", "\"\" +");
      } else if (thing.expression[1].value === "") {
        warn("expected_a_b", thing, "String(...)", "+ \"\"");
      }
    }
  } else if (thing.id === "[") {
    if (thing.expression[0].id === "window") {
      warn("weird_expression_a", thing, "window[...]");
    }

    if (thing.expression[0].id === "self") {
      warn("weird_expression_a", thing, "self[...]");
    }
  } else if (thing.id === "." || thing.id === "?.") {
    if (thing.expression.id === "RegExp") {
      warn("weird_expression_a", thing);
    }
  } else if (thing.id !== "=>" && thing.id !== "(") {
    right = thing.expression[1];

    if ((thing.id === "+" || thing.id === "-") && right.id === thing.id && right.arity === "unary" && !right.wrapped) {
      warn("wrap_unary", right);
    }

    if (thing.expression[0].constant === true && right.constant === true) {
      thing.constant = true;
    }
  }
});