format and lint

This commit is contained in:
Snarling 2022-10-01 15:15:36 -04:00
parent 9774235404
commit 3addda7173
6 changed files with 15 additions and 15 deletions

@ -75,7 +75,7 @@ interface Player {
/**
* @public
*/
export interface Multipliers {
export interface Multipliers {
/** Multiplier to hacking skill */
hacking?: number;
/** Multiplier to strength skill */

@ -803,7 +803,9 @@ export function Root(props: IProps): React.ReactElement {
...colorProps,
};
const scriptTabText = `${hostname}:~${fileName.startsWith("/") ? "" : "/"}${fileName} ${dirty(index)}`;
const scriptTabText = `${hostname}:~${fileName.startsWith("/") ? "" : "/"}${fileName} ${dirty(
index,
)}`;
return (
<Draggable
key={fileName + hostname}

@ -62,7 +62,7 @@ class NumeralFormatter {
if (n === Infinity) return "∞";
for (let i = 0; i < extraFormats.length; i++) {
if (extraFormats[i] < nAbs && nAbs <= extraFormats[i] * 1000) {
return this.format(n as number / extraFormats[i], "0." + "0".repeat(decimalPlaces)) + extraNotations[i];
return this.format((n as number) / extraFormats[i], "0." + "0".repeat(decimalPlaces)) + extraNotations[i];
}
}
if (nAbs < 1000) {

@ -5,8 +5,6 @@ import { RunningScript } from "../../../src/Script/RunningScript";
import { Script } from "../../../src/Script/Script";
import { WorkerScript } from "../../../src/Netscript/WorkerScript";
describe("Netscript Dynamic RAM Calculation/Generation Tests", function () {
const ScriptBaseCost = RamCostConstants.ScriptBaseRamCost;
// Creates a mock RunningScript object
@ -85,10 +83,9 @@ describe("Netscript Dynamic RAM Calculation/Generation Tests", function () {
// Run the function through the workerscript's args
const scope = workerScript.env.vars;
let curr = fnDesc.reduce((prev, curr) => {
try{
try {
return prev[curr];
}
catch{
} catch {
throw new Error(`Invalid function: [${fnDesc}]`);
}
}, scope as any);
@ -147,10 +144,9 @@ describe("Netscript Dynamic RAM Calculation/Generation Tests", function () {
// Run the function through the workerscript's args
const scope = workerScript.env.vars;
let curr = fnDesc.reduce((prev, curr) => {
try{
try {
return prev[curr];
}
catch{
} catch {
throw new Error(`Invalid function: [${fnDesc}]`);
}
}, scope as any);

@ -283,8 +283,8 @@ describe("Terminal Directory Tests", function () {
});
it("should return false for invalid inputs (inputs that aren't filepaths)", function () {
expect(isInRootDirectory(null as unknown as string)).toEqual(false);
expect(isInRootDirectory(undefined as unknown as string)).toEqual(false);
expect(isInRootDirectory(null as unknown as string)).toEqual(false);
expect(isInRootDirectory(undefined as unknown as string)).toEqual(false);
expect(isInRootDirectory("")).toEqual(false);
expect(isInRootDirectory(" ")).toEqual(false);
expect(isInRootDirectory("a")).toEqual(false);

@ -241,6 +241,8 @@ describe("Finding the number furthest away from 0", () => {
expect(numeralWrapper.largestAbsoluteNumber(789123, -123456, -456789)).toEqual(789123);
});
test("Should return 0 for invalid input", () => {
expect(numeralWrapper.largestAbsoluteNumber("abc" as unknown as number, undefined, null as unknown as number)).toEqual(0);
expect(
numeralWrapper.largestAbsoluteNumber("abc" as unknown as number, undefined, null as unknown as number),
).toEqual(0);
});
});