in web/jslint/src/main/resources/data/jslint-2020-03-28.js [3922:3959]
postaction("assignment", function (thing) {
// Assignment using = sets the init property of a variable. No other assignment
// operator can do this. A = token keeps that variable (or array of variables
// in case of destructuring) in its name property.
var lvalue = thing.expression[0];
if (thing.id === "=") {
if (thing.names !== undefined) {
if (Array.isArray(thing.names)) {
thing.names.forEach(init_variable);
} else {
init_variable(thing.names);
}
} else {
if (lvalue.id === "[" || lvalue.id === "{") {
lvalue.expression.forEach(function (thing) {
if (thing.variable) {
thing.variable.init = true;
}
});
} else if (lvalue.id === "." && thing.expression[1].id === "undefined") {
warn("expected_a_b", lvalue.expression, "delete", "undefined");
}
}
} else {
if (lvalue.arity === "variable") {
if (!lvalue.variable || lvalue.variable.writable !== true) {
warn("bad_assignment_a", lvalue);
}
}
var right = syntax[thing.expression[1].id];
if (right !== undefined && (right.id === "function" || right.id === "=>" || right.constant && right.id !== "(number)" && (right.id !== "(string)" || thing.id !== "+="))) {
warn("unexpected_a", thing.expression[1]);
}
}
});