mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2025-03-07 11:04:36 +01:00
more lint
This commit is contained in:
@ -7,7 +7,7 @@ module.exports = {
|
||||
extends: [
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
// "plugin:@typescript-eslint/recommended-requiring-type-checking",
|
||||
"plugin:@typescript-eslint/recommended-requiring-type-checking",
|
||||
],
|
||||
parser: "@typescript-eslint/parser",
|
||||
parserOptions: {
|
||||
|
@ -114,8 +114,8 @@
|
||||
"start:container": "webpack-dev-server --progress --env.devServer --mode development --env.runInContainer",
|
||||
"build": "webpack --mode production",
|
||||
"build:dev": "webpack --mode development",
|
||||
"lint": "eslint --fix --ext js,jsx,ts,tsx --max-warnings 0 src test",
|
||||
"lint:report": "eslint --ext js,jsx,ts,tsx --max-warnings 0 .",
|
||||
"lint": "eslint --fix --ext js,jsx,ts,tsx --max-warnings 0 src",
|
||||
"lint:report": "eslint --ext js,jsx,ts,tsx --max-warnings 0 src",
|
||||
"lint:report-diff": "eslint --max-warnings 0 $(git diff --name-only --diff-filter=ACMRTUXB origin/dev | grep -E \"(.js$|.jsx$|.ts$|.tsx$)\" | xargs)",
|
||||
"preinstall": "node ./tools/engines-check/engines-check.js",
|
||||
"postinstall": "cd electron && npm install",
|
||||
|
@ -34,11 +34,13 @@ export function RecoveryRoot({ router, softReset, errorData, resetError }: IProp
|
||||
Settings.AutosaveInterval = 0;
|
||||
|
||||
useEffect(() => {
|
||||
load().then((content) => {
|
||||
const epochTime = Math.round(Date.now() / 1000);
|
||||
const filename = `RECOVERY_BITBURNER_${epochTime}.json`;
|
||||
download(filename, content);
|
||||
});
|
||||
load()
|
||||
.then((content) => {
|
||||
const epochTime = Math.round(Date.now() / 1000);
|
||||
const filename = `RECOVERY_BITBURNER_${epochTime}.json`;
|
||||
download(filename, content);
|
||||
})
|
||||
.catch((err) => console.error(err));
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
@ -5,6 +5,7 @@ import { Typography, TableCell, TableRow } from "@mui/material";
|
||||
import { numeralWrapper } from "../numeralFormat";
|
||||
import { formatNumber } from "../../utils/StringHelperFunctions";
|
||||
import { characterOverviewStyles as useStyles } from "./CharacterOverview";
|
||||
import { ClassNameMap } from "@material-ui/core/styles/withStyles";
|
||||
|
||||
interface ITableRowData {
|
||||
content?: string;
|
||||
@ -15,7 +16,7 @@ interface ITableRowData {
|
||||
interface IProps {
|
||||
name: string;
|
||||
color: string;
|
||||
classes?: any;
|
||||
classes?: ClassNameMap;
|
||||
data?: ITableRowData;
|
||||
children?: React.ReactElement;
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ export function comprLZEncode(plain: string): string {
|
||||
for (let offset = 1; offset <= Math.min(9, i); ++offset) {
|
||||
if (plain[i - offset] === c) {
|
||||
// start new backreference
|
||||
set(new_state, offset, 1, string + length + plain.substring(i - length, i));
|
||||
set(new_state, offset, 1, string + String(length) + plain.substring(i - length, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -99,17 +99,17 @@ export function comprLZEncode(plain: string): string {
|
||||
set(new_state, offset, length + 1, string);
|
||||
} else {
|
||||
// start new backreference
|
||||
set(new_state, offset, 1, string + "9" + offset + "0");
|
||||
set(new_state, offset, 1, string + "9" + String(offset) + "0");
|
||||
}
|
||||
}
|
||||
|
||||
// start new literal
|
||||
set(new_state, 0, 1, string + length + offset);
|
||||
set(new_state, 0, 1, string + String(length) + String(offset));
|
||||
|
||||
// end current backreference and start new backreference
|
||||
for (let new_offset = 1; new_offset <= Math.min(9, i); ++new_offset) {
|
||||
if (plain[i - new_offset] === c) {
|
||||
set(new_state, new_offset, 1, string + length + offset + "0");
|
||||
set(new_state, new_offset, 1, string + String(length) + String(offset) + "0");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -128,7 +128,7 @@ export function comprLZEncode(plain: string): string {
|
||||
continue;
|
||||
}
|
||||
|
||||
string += len + plain.substring(plain.length - len, plain.length);
|
||||
string += String(len) + plain.substring(plain.length - len, plain.length);
|
||||
if (result == null || string.length < result.length) {
|
||||
result = string;
|
||||
} else if (string.length == result.length && Math.random() < 0.5) {
|
||||
@ -143,7 +143,7 @@ export function comprLZEncode(plain: string): string {
|
||||
continue;
|
||||
}
|
||||
|
||||
string += len + "" + offset;
|
||||
string += String(len) + "" + String(offset);
|
||||
if (result == null || string.length < result.length) {
|
||||
result = string;
|
||||
} else if (string.length == result.length && Math.random() < 0.5) {
|
||||
|
@ -87,7 +87,7 @@ export function getErrorForDisplay(error: Error, errorInfo?: React.ErrorInfo, pa
|
||||
const fileName = (metadata.error as any).fileName;
|
||||
const features =
|
||||
`lang=${metadata.features.language} cookiesEnabled=${metadata.features.cookiesEnabled.toString()}` +
|
||||
` doNotTrack=${metadata.features.doNotTrack} indexedDb=${metadata.features.indexedDb.toString()}`;
|
||||
` doNotTrack=${metadata.features.doNotTrack ?? "null"} indexedDb=${metadata.features.indexedDb.toString()}`;
|
||||
|
||||
const title = `${metadata.error.name}: ${metadata.error.message}${metadata.page && ` (at "${Page[metadata.page]}")`}`;
|
||||
const body = `
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
import { validateObject } from "./Validator";
|
||||
|
||||
interface IReviverValue {
|
||||
export interface IReviverValue {
|
||||
ctor: string;
|
||||
data: any;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
* This is an object that is used to keep track of where all of the player's
|
||||
* money is coming from (or going to)
|
||||
*/
|
||||
import { Generic_fromJSON, Generic_toJSON, Reviver } from "./JSONReviver";
|
||||
import { Generic_fromJSON, Generic_toJSON, Reviver, IReviverValue } from "./JSONReviver";
|
||||
|
||||
export class MoneySourceTracker {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
@ -56,7 +56,7 @@ export class MoneySourceTracker {
|
||||
|
||||
// Initiatizes a MoneySourceTracker object from a JSON save state.
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
static fromJSON(value: any): MoneySourceTracker {
|
||||
static fromJSON(value: IReviverValue): MoneySourceTracker {
|
||||
return Generic_fromJSON(MoneySourceTracker, value.data);
|
||||
}
|
||||
}
|
||||
|
@ -7,10 +7,10 @@
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
export function clearObject(obj: unknown): void {
|
||||
if (typeof obj !== "object" || obj === null || obj === undefined) return;
|
||||
for (const key of Object.getOwnPropertyNames(obj)) {
|
||||
if (obj.hasOwnProperty(key)) {
|
||||
// tslint:disable-next-line:no-dynamic-delete
|
||||
delete (obj as any)[key];
|
||||
const o = obj as Record<string, unknown>;
|
||||
for (const key of Object.getOwnPropertyNames(o)) {
|
||||
if (o.hasOwnProperty(key)) {
|
||||
delete o[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user