bitburner-official / bitburner-src

Bitburner source code.
Other
838 stars 273 forks source link

BUGFIX: Wrong usage of delete operator in Settings.load #1791

Closed catloversg closed 4 days ago

catloversg commented 6 days ago

I found this bug while implementing #1789.

Test code:

/** @param {NS} ns */
export async function main(ns) {
  ns.tail();
  const object = {
    prop1: 1,
    prop2: 2,
  };
  delete object.prop1, object.prop2; // Wrong
  // delete object.prop1; delete object.prop2; // Correct
  ns.print(object);
}
d0sboots commented 6 days ago

Slightly surprised lint doesn't complain about this, but I guess it's considered covered by "don't use delete."