mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-10 01:33:54 +01:00
fix lint
This commit is contained in:
parent
22648df857
commit
18f40a8d9f
@ -1,11 +1,9 @@
|
||||
import * as React from "react";
|
||||
import { DarkWebItems } from "./DarkWebItems";
|
||||
|
||||
import { Player } from "../Player";
|
||||
import { Terminal } from "../Terminal";
|
||||
import { SpecialServerIps } from "../Server/SpecialServerIps";
|
||||
import { numeralWrapper } from "../ui/numeralFormat";
|
||||
import { Money } from "../ui/React/Money";
|
||||
|
||||
import { isValidIPAddress } from "../../utils/helpers/isValidIPAddress";
|
||||
|
||||
|
@ -49,7 +49,7 @@ export interface ITerminal {
|
||||
// Excludes the trailing forward slash
|
||||
currDir: string;
|
||||
|
||||
print(s: string, config?: any): void;
|
||||
print(s: string): void;
|
||||
error(s: string): void;
|
||||
|
||||
clear(): void;
|
||||
|
@ -1,4 +1,3 @@
|
||||
import { postContent, hackProgressBarPost, hackProgressPost } from "../ui/postToTerminal";
|
||||
import { ITerminal, Output, Link, TTimer } from "./ITerminal";
|
||||
import { IEngine } from "../IEngine";
|
||||
import { IPlayer } from "../PersonObjects/IPlayer";
|
||||
@ -109,7 +108,7 @@ export class Terminal implements ITerminal {
|
||||
}
|
||||
}
|
||||
|
||||
print(s: string, config?: any): void {
|
||||
print(s: string): void {
|
||||
this.outputHistory.push(new Output(s, "primary"));
|
||||
this.hasChanges = true;
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ export function ls(
|
||||
allMessages.sort();
|
||||
folders.sort();
|
||||
|
||||
function postSegments(segments: string[], config: any): void {
|
||||
function postSegments(segments: string[]): void {
|
||||
const maxLength = Math.max(...segments.map((s) => s.length)) + 1;
|
||||
const filesPerRow = Math.floor(80 / maxLength);
|
||||
for (let i = 0; i < segments.length; i++) {
|
||||
@ -126,13 +126,12 @@ export function ls(
|
||||
i++;
|
||||
}
|
||||
i--;
|
||||
terminal.print(row, config);
|
||||
terminal.print(row);
|
||||
}
|
||||
}
|
||||
|
||||
const config = { color: "#0000FF" };
|
||||
const groups = [
|
||||
{ segments: folders, config: config },
|
||||
{ segments: folders },
|
||||
{ segments: allMessages },
|
||||
{ segments: allTextFiles },
|
||||
{ segments: allPrograms },
|
||||
@ -144,6 +143,6 @@ export function ls(
|
||||
terminal.print("");
|
||||
terminal.print("");
|
||||
}
|
||||
postSegments(groups[i].segments, groups[i].config);
|
||||
postSegments(groups[i].segments);
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* TODO: Separate UI functionality into its own component
|
||||
*/
|
||||
import { convertTimeMsToTimeElapsedString, replaceAt } from "../utils/StringHelperFunctions";
|
||||
import { convertTimeMsToTimeElapsedString } from "../utils/StringHelperFunctions";
|
||||
import { Augmentations } from "./Augmentation/Augmentations";
|
||||
import { initAugmentations, installAugmentations } from "./Augmentation/AugmentationHelpers";
|
||||
import { onExport } from "./ExportBonus";
|
||||
|
@ -1,36 +0,0 @@
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import { getElementById } from "../../utils/uiHelpers/getElementById";
|
||||
|
||||
/**
|
||||
* Adds some output to the terminal with an identifier of "hack-progress-bar"
|
||||
* @param input Text or HTML to output to the terminal
|
||||
*/
|
||||
export function hackProgressBarPost(input: string): void {
|
||||
postContent(input, { id: "hack-progress-bar" });
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds some output to the terminal with an identifier of "hack-progress"
|
||||
* @param input Text or HTML to output to the terminal
|
||||
*/
|
||||
export function hackProgressPost(input: string): void {
|
||||
postContent(input, { id: "hack-progress" });
|
||||
}
|
||||
|
||||
interface IPostContentConfig {
|
||||
id?: string; // Replaces class, if specified
|
||||
color?: string; // Additional class for terminal-line. Does NOT replace
|
||||
}
|
||||
|
||||
export function postContent(input: string, config: IPostContentConfig = {}): void {
|
||||
// tslint:disable-next-line:max-line-length
|
||||
const style = `color: ${
|
||||
config.color != null ? config.color : "var(--my-font-color)"
|
||||
}; background-color:var(--my-background-color);${config.id === undefined ? " white-space:pre-wrap;" : ""}`;
|
||||
// tslint:disable-next-line:max-line-length
|
||||
const content = `<tr class="posted"><td ${
|
||||
config.id === undefined ? `class="terminal-line"` : `id="${config.id}"`
|
||||
} style="${style}">${input}</td></tr>`;
|
||||
const inputElement: HTMLElement = getElementById("terminal-input");
|
||||
inputElement.insertAdjacentHTML("beforebegin", content);
|
||||
}
|
Loading…
Reference in New Issue
Block a user