From a85f956a9d7b0a15e7a986c15bb379573f54a370 Mon Sep 17 00:00:00 2001 From: Steven Evans Date: Mon, 10 Sep 2018 10:41:48 -0400 Subject: [PATCH 1/3] [style] Cleaning up Stylelint violations --- css/terminal.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/css/terminal.scss b/css/terminal.scss index 1bd63a829..f8ea2fcfd 100644 --- a/css/terminal.scss +++ b/css/terminal.scss @@ -58,8 +58,8 @@ #terminal-input-td textarea { overflow: hidden; - resize:none; - height:auto; + resize: none; + height: auto; } #terminal-input-header { From a681fc55777edb48cfeeae2b9c9ff79eedce2611 Mon Sep 17 00:00:00 2001 From: Steven Evans Date: Mon, 10 Sep 2018 10:59:07 -0400 Subject: [PATCH 2/3] [chore] Disabling a couple ESLint violations These should really be refactored and fixed, but the end-to-end testing will take a bit more effort. It can be tackled later. --- src/Infiltration.js | 3 +++ src/Terminal.js | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/Infiltration.js b/src/Infiltration.js index 504c3407f..4c41ff3c4 100644 --- a/src/Infiltration.js +++ b/src/Infiltration.js @@ -468,6 +468,8 @@ function updateInfiltrationLevelText(inst) { } var expMultiplier = 2 * inst.clearanceLevel / inst.maxClearanceLevel; + // TODO: fix this to not rely on
 and whitespace for formatting...
+    /* eslint-disable no-irregular-whitespace */
     document.getElementById("infiltration-level-text").innerHTML =
         "Facility name:    " + inst.companyName + "
" + "Clearance Level:  " + inst.clearanceLevel + "
" + @@ -481,6 +483,7 @@ function updateInfiltrationLevelText(inst) { "Dex exp gained:   " + formatNumber(inst.dexExpGained * expMultiplier, 3) + "
" + "Agi exp gained:   " + formatNumber(inst.agiExpGained * expMultiplier, 3) + "
" + "Cha exp gained:   " + formatNumber(inst.chaExpGained * expMultiplier, 3); + /* eslint-enable no-irregular-whitespace */ } function updateInfiltrationButtons(inst, scenario) { diff --git a/src/Terminal.js b/src/Terminal.js index def530d1c..113421760 100644 --- a/src/Terminal.js +++ b/src/Terminal.js @@ -1400,6 +1400,7 @@ let Terminal = { post("Incorrect usage of scan-analyze command. usage: scan-analyze [depth]"); } break; + /* eslint-disable no-case-declarations */ case "scp": if (commandArray.length != 2) { post("Incorrect usage of scp command. Usage: scp [file] [destination hostname/ip]"); @@ -1493,6 +1494,7 @@ let Terminal = { } post(`${scriptname} copied over to ${destServer.hostname}`); break; + /* eslint-enable no-case-declarations */ case "sudov": if (commandArray.length != 1) { post("Incorrect number of arguments. Usage: sudov"); return; @@ -1616,6 +1618,7 @@ let Terminal = { } } break; + /* eslint-disable no-case-declarations */ case "wget": if (commandArray.length !== 2) { return post("Incorrect usage of wget command. Usage: wget [url] [target file]"); @@ -1648,6 +1651,7 @@ let Terminal = { return post("wget failed: " + JSON.stringify(e)); }) break; + /* eslint-enable no-case-declarations */ default: post("Command not found"); } From 9a4867785ed1945b6d651743df8ddc45e7179197 Mon Sep 17 00:00:00 2001 From: Steven Evans Date: Mon, 10 Sep 2018 11:24:23 -0400 Subject: [PATCH 3/3] [style] Fixing TSLint violations --- src/HelpText.ts | 2 +- src/Stock.ts | 81 +++++++++++++++++++++------------------- src/ui/postToTerminal.ts | 2 +- 3 files changed, 44 insertions(+), 41 deletions(-) diff --git a/src/HelpText.ts b/src/HelpText.ts index 0c5bfaf76..bb7f8406f 100644 --- a/src/HelpText.ts +++ b/src/HelpText.ts @@ -33,7 +33,7 @@ export const TerminalHelpText: string = "theme [preset] | bg txt hlgt Change the color scheme of the UI
" + "top Displays all running scripts and their RAM usage
" + 'unalias "[alias name]" Deletes the specified alias
' + - 'wget [url] [target file] Retrieves code/text from a web server
'; + "wget [url] [target file] Retrieves code/text from a web server
"; interface IMap { [key: string]: T; diff --git a/src/Stock.ts b/src/Stock.ts index 6d5928430..2ece32cf3 100644 --- a/src/Stock.ts +++ b/src/Stock.ts @@ -1,5 +1,8 @@ import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver"; +/** + * Represents the valuation of a company in the World Stock Exchange. + */ export class Stock { /** * Initializes a Stock from a JSON save state @@ -9,39 +12,9 @@ export class Stock { } /** - * The stock's ticker symbol + * Bear or bull (more likely to go up or down, based on otlkMag) */ - readonly symbol: string; - - /** - * Name of the company that the stock is for - */ - readonly name: string; - - /** - * Stock's share price - */ - price: number; - - /** - * Number of shares the player owns in the LONG position - */ - playerShares: number; - - /** - * Average price of stocks that the player owns in the LONG position - */ - playerAvgPx: number; - - /** - * Number of shares the player owns in the SHORT position - */ - playerShortShares: number; - - /** - * Average price of stocks that the player owns in the SHORT position - */ - playerAvgShortPx: number; + b: boolean; /** * Maximum volatility @@ -49,9 +22,9 @@ export class Stock { readonly mv: number; /** - * Bear or bull (more likely to go up or down, based on otlkMag) + * Name of the company that the stock is for */ - b: boolean; + readonly name: string; /** * Outlook magnitude. Represents the stock's forecast and likelihood @@ -59,16 +32,46 @@ export class Stock { */ otlkMag: number; + /** + * Average price of stocks that the player owns in the LONG position + */ + playerAvgPx: number; + + /** + * Average price of stocks that the player owns in the SHORT position + */ + playerAvgShortPx: number; + + /** + * Number of shares the player owns in the LONG position + */ + playerShares: number; + + /** + * Number of shares the player owns in the SHORT position + */ + playerShortShares: number; + /** * The HTML element that displays the stock's info in the UI */ posTxtEl: HTMLElement | null; - constructor(name: string="", - symbol: string="", - mv: number=1, - b: boolean=true, - otlkMag: number=0, + /** + * Stock's share price + */ + price: number; + + /** + * The stock's ticker symbol + */ + readonly symbol: string; + + constructor(name: string = "", + symbol: string = "", + mv: number = 1, + b: boolean = true, + otlkMag: number = 0, initPrice: number = 10e3) { this.name = name; this.symbol = symbol; diff --git a/src/ui/postToTerminal.ts b/src/ui/postToTerminal.ts index 519af1001..8fb3383bc 100644 --- a/src/ui/postToTerminal.ts +++ b/src/ui/postToTerminal.ts @@ -1,4 +1,4 @@ -import { getElementById } from "../../utils/uiHelpers/getElementById"; +import { getElementById } from "../../utils/uiHelpers/getElementById"; /** * Adds some output to the terminal.