mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-26 01:23:49 +01:00
fix nearly all lint errors now
This commit is contained in:
parent
60d6d49c43
commit
674ce17834
@ -27,5 +27,4 @@
|
|||||||
button {
|
button {
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@
|
|||||||
transform: rotate(-45deg);
|
transform: rotate(-45deg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
input[type=checkbox] {
|
input[type="checkbox"] {
|
||||||
margin: 3px;
|
margin: 3px;
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
&:checked + label:after {
|
&:checked + label:after {
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.casino-card .value {
|
.casino-card .value {
|
||||||
font-size:15pt;
|
font-size: 15pt;
|
||||||
font-family: sans-serif;
|
font-family: sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,15 +3,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.remove-exp-button {
|
.remove-exp-button {
|
||||||
margin-left:0;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.exp-input {
|
.exp-input {
|
||||||
margin-right: 0;
|
margin: 5px 0 5px 0;
|
||||||
margin-left:0;
|
|
||||||
|
|
||||||
margin-top: 5px;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
|
|
||||||
padding: 2px 5px;
|
padding: 2px 5px;
|
||||||
}
|
}
|
||||||
|
1
css/grid.min.css
vendored
1
css/grid.min.css
vendored
@ -1,3 +1,4 @@
|
|||||||
|
/* stylelint-disable */
|
||||||
/*!
|
/*!
|
||||||
* Bootstrap Grid v4.1.2 (https://getbootstrap.com/)
|
* Bootstrap Grid v4.1.2 (https://getbootstrap.com/)
|
||||||
* Copyright 2011-2018 The Bootstrap Authors
|
* Copyright 2011-2018 The Bootstrap Authors
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
&.level-2 {
|
&.level-2 {
|
||||||
color: #48d1cc;
|
color: #48d1cc;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.level-3 {
|
&.level-3 {
|
||||||
|
@ -234,9 +234,9 @@ a:visited {
|
|||||||
|
|
||||||
#status-text-container {
|
#status-text-container {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
position:absolute;
|
position: absolute;
|
||||||
top:0;
|
top: 0;
|
||||||
left:50%;
|
left: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#status-text {
|
#status-text {
|
||||||
@ -371,14 +371,15 @@ a:visited {
|
|||||||
|
|
||||||
.noscrollbar {
|
.noscrollbar {
|
||||||
-ms-overflow-style: none; /* IE and Edge */
|
-ms-overflow-style: none; /* IE and Edge */
|
||||||
scrollbar-width: none; /* Firefox */
|
/* stylelint-disable-next-line property-no-unknown */
|
||||||
|
scrollbar-width: none; /* Firefox https://developer.mozilla.org/en-US/docs/Web/CSS/scrollbar-width */
|
||||||
}
|
}
|
||||||
|
|
||||||
.noscrollbar::-webkit-scrollbar {
|
.noscrollbar::-webkit-scrollbar {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=checkbox] {
|
input[type="checkbox"] {
|
||||||
filter: invert(1) sepia(1) hue-rotate(41deg) brightness(100%) saturate(10);
|
filter: invert(1) sepia(1) hue-rotate(41deg) brightness(100%) saturate(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -398,7 +399,6 @@ input[type=checkbox] {
|
|||||||
margin: 3px;
|
margin: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.optionRange::-webkit-slider-thumb {
|
.optionRange::-webkit-slider-thumb {
|
||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
appearance: none;
|
appearance: none;
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
border: 2px solid #e8e8e3;
|
border: 2px solid #e8e8e3;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
box-shadow: 1px 1px 1px rgba(0,0,0,0.5);
|
box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,8 +10,7 @@ import { PurchasedAugmentations } from "./PurchasedAugmentations";
|
|||||||
|
|
||||||
import { Player } from "../../Player";
|
import { Player } from "../../Player";
|
||||||
import { StdButton } from "../../ui/React/StdButton";
|
import { StdButton } from "../../ui/React/StdButton";
|
||||||
import { LastExportBonus, canGetBonus } from "../../ExportBonus";
|
import { canGetBonus } from "../../ExportBonus";
|
||||||
import { convertTimeMsToTimeElapsedString } from "../../../utils/StringHelperFunctions";
|
|
||||||
|
|
||||||
type IProps = {
|
type IProps = {
|
||||||
exportGameFn: () => void;
|
exportGameFn: () => void;
|
||||||
@ -31,7 +30,7 @@ export class AugmentationsRoot extends React.Component<IProps, IState> {
|
|||||||
this.export = this.export.bind(this);
|
this.export = this.export.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
export() {
|
export(): void {
|
||||||
this.props.exportGameFn();
|
this.props.exportGameFn();
|
||||||
this.setState({
|
this.setState({
|
||||||
rerender: !this.state.rerender,
|
rerender: !this.state.rerender,
|
||||||
|
@ -164,10 +164,12 @@ export class Action implements IAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// For actions that have teams. To be implemented by subtypes.
|
// For actions that have teams. To be implemented by subtypes.
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
getTeamSuccessBonus(inst: IBladeburner): number {
|
getTeamSuccessBonus(inst: IBladeburner): number {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
getActionTypeSkillSuccessBonus(inst: IBladeburner): number {
|
getActionTypeSkillSuccessBonus(inst: IBladeburner): number {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -12,10 +12,7 @@ import {
|
|||||||
Generic_toJSON,
|
Generic_toJSON,
|
||||||
Reviver,
|
Reviver,
|
||||||
} from "../utils/JSONReviver";
|
} from "../utils/JSONReviver";
|
||||||
import { KEY } from "../utils/helpers/keyCodes";
|
|
||||||
import { createElement } from "../utils/uiHelpers/createElement";
|
|
||||||
import { createPopup, removePopup } from "./ui/React/createPopup";
|
import { createPopup, removePopup } from "./ui/React/createPopup";
|
||||||
import { removeElementById } from "../utils/uiHelpers/removeElementById";
|
|
||||||
import { CodingContractPopup } from "./ui/React/CodingContractPopup";
|
import { CodingContractPopup } from "./ui/React/CodingContractPopup";
|
||||||
|
|
||||||
|
|
||||||
@ -174,7 +171,7 @@ export class CodingContract {
|
|||||||
*/
|
*/
|
||||||
async prompt(): Promise<CodingContractResult> {
|
async prompt(): Promise<CodingContractResult> {
|
||||||
const popupId = `coding-contract-prompt-popup-${this.fn}`;
|
const popupId = `coding-contract-prompt-popup-${this.fn}`;
|
||||||
return new Promise<CodingContractResult>((resolve, reject) => {
|
return new Promise<CodingContractResult>((resolve) => {
|
||||||
const popup = new CodingContractPopup({
|
const popup = new CodingContractPopup({
|
||||||
c: this,
|
c: this,
|
||||||
popupId: popupId,
|
popupId: popupId,
|
||||||
|
@ -16,4 +16,8 @@ export function onExport(p: IPlayer): void {
|
|||||||
Factions[facName].favor++;
|
Factions[facName].favor++;
|
||||||
}
|
}
|
||||||
LastExportBonus = (new Date()).getTime();
|
LastExportBonus = (new Date()).getTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setLastExportBonus(unixTime: number): void {
|
||||||
|
LastExportBonus = unixTime;
|
||||||
}
|
}
|
@ -1,5 +1,4 @@
|
|||||||
const sprintf = require("sprintf-js").sprintf;
|
import { vsprintf, sprintf } from 'sprintf-js';
|
||||||
const vsprintf = require("sprintf-js").vsprintf;
|
|
||||||
import * as libarg from 'arg';
|
import * as libarg from 'arg';
|
||||||
|
|
||||||
import { getRamCost } from "./Netscript/RamCostGenerator";
|
import { getRamCost } from "./Netscript/RamCostGenerator";
|
||||||
@ -4397,7 +4396,7 @@ function NetscriptFunctions(workerScript) {
|
|||||||
hacknetServers: {
|
hacknetServers: {
|
||||||
hashGainRate: function(level, ramUsed, maxRam, cores, mult=1) {
|
hashGainRate: function(level, ramUsed, maxRam, cores, mult=1) {
|
||||||
checkFormulasAccess("hacknetServers.hashGainRate", 9);
|
checkFormulasAccess("hacknetServers.hashGainRate", 9);
|
||||||
return HScalculateHashGainRate(level, ramUsed, maxRam, cores, mult=1);
|
return HScalculateHashGainRate(level, ramUsed, maxRam, cores, mult);
|
||||||
},
|
},
|
||||||
levelUpgradeCost: function(startingLevel, extraLevels=1, costMult=1) {
|
levelUpgradeCost: function(startingLevel, extraLevels=1, costMult=1) {
|
||||||
checkFormulasAccess("hacknetServers.levelUpgradeCost", 9);
|
checkFormulasAccess("hacknetServers.levelUpgradeCost", 9);
|
||||||
|
@ -34,7 +34,7 @@ import { roundToTwo } from "../utils/helpers/roundToTwo";
|
|||||||
import { isString } from "../utils/StringHelperFunctions";
|
import { isString } from "../utils/StringHelperFunctions";
|
||||||
|
|
||||||
import { parse } from "acorn";
|
import { parse } from "acorn";
|
||||||
const walk = require("acorn-walk");
|
import { simple as walksimple } from "acorn-walk";
|
||||||
|
|
||||||
// Netscript Ports are instantiated here
|
// Netscript Ports are instantiated here
|
||||||
export const NetscriptPorts = [];
|
export const NetscriptPorts = [];
|
||||||
@ -304,7 +304,7 @@ function processNetscript1Imports(code, workerScript) {
|
|||||||
let hasImports = false;
|
let hasImports = false;
|
||||||
|
|
||||||
// Walk over the tree and process ImportDeclaration nodes
|
// Walk over the tree and process ImportDeclaration nodes
|
||||||
walk.simple(ast, {
|
walksimple(ast, {
|
||||||
ImportDeclaration: (node) => {
|
ImportDeclaration: (node) => {
|
||||||
hasImports = true;
|
hasImports = true;
|
||||||
let scriptName = node.source.value;
|
let scriptName = node.source.value;
|
||||||
@ -322,7 +322,7 @@ function processNetscript1Imports(code, workerScript) {
|
|||||||
let namespace = node.specifiers[0].local.name;
|
let namespace = node.specifiers[0].local.name;
|
||||||
let fnNames = []; //Names only
|
let fnNames = []; //Names only
|
||||||
let fnDeclarations = []; //FunctionDeclaration Node objects
|
let fnDeclarations = []; //FunctionDeclaration Node objects
|
||||||
walk.simple(scriptAst, {
|
walksimple(scriptAst, {
|
||||||
FunctionDeclaration: (node) => {
|
FunctionDeclaration: (node) => {
|
||||||
fnNames.push(node.id.name);
|
fnNames.push(node.id.name);
|
||||||
fnDeclarations.push(node);
|
fnDeclarations.push(node);
|
||||||
@ -361,7 +361,7 @@ function processNetscript1Imports(code, workerScript) {
|
|||||||
|
|
||||||
//Walk through script and get FunctionDeclaration code for all specified fns
|
//Walk through script and get FunctionDeclaration code for all specified fns
|
||||||
let fnDeclarations = [];
|
let fnDeclarations = [];
|
||||||
walk.simple(scriptAst, {
|
walksimple(scriptAst, {
|
||||||
FunctionDeclaration: (node) => {
|
FunctionDeclaration: (node) => {
|
||||||
if (fnsToImport.includes(node.id.name)) {
|
if (fnsToImport.includes(node.id.name)) {
|
||||||
fnDeclarations.push(node);
|
fnDeclarations.push(node);
|
||||||
|
@ -529,7 +529,7 @@ export class Sleeve extends Person {
|
|||||||
case SleeveTaskType.Recovery:
|
case SleeveTaskType.Recovery:
|
||||||
this.shock = Math.min(100, this.shock + (0.0002 * cyclesUsed));
|
this.shock = Math.min(100, this.shock + (0.0002 * cyclesUsed));
|
||||||
break;
|
break;
|
||||||
case SleeveTaskType.Sync:
|
case SleeveTaskType.Synchro:
|
||||||
this.sync = Math.min(100, this.sync + (p.getIntelligenceBonus(0.5) * 0.0002 * cyclesUsed));
|
this.sync = Math.min(100, this.sync + (p.getIntelligenceBonus(0.5) * 0.0002 * cyclesUsed));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -586,7 +586,7 @@ export class Sleeve extends Person {
|
|||||||
this.resetTaskStatus();
|
this.resetTaskStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.currentTask = SleeveTaskType.Sync;
|
this.currentTask = SleeveTaskType.Synchro;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,5 +10,5 @@ export enum SleeveTaskType {
|
|||||||
Class,
|
Class,
|
||||||
Gym,
|
Gym,
|
||||||
Recovery,
|
Recovery,
|
||||||
Sync,
|
Synchro,
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,6 @@ import { prestigeSourceFile } from "./Prestige";
|
|||||||
import { PlayerOwnedSourceFile } from "./SourceFile/PlayerOwnedSourceFile";
|
import { PlayerOwnedSourceFile } from "./SourceFile/PlayerOwnedSourceFile";
|
||||||
import { SourceFileFlags } from "./SourceFile/SourceFileFlags";
|
import { SourceFileFlags } from "./SourceFile/SourceFileFlags";
|
||||||
import { SourceFiles } from "./SourceFile/SourceFiles";
|
import { SourceFiles } from "./SourceFile/SourceFiles";
|
||||||
import { Terminal } from "./Terminal";
|
|
||||||
import { setTimeoutRef } from "./utils/SetTimeoutRef";
|
import { setTimeoutRef } from "./utils/SetTimeoutRef";
|
||||||
|
|
||||||
import { dialogBoxCreate } from "../utils/DialogBox";
|
import { dialogBoxCreate } from "../utils/DialogBox";
|
||||||
|
@ -248,9 +248,9 @@ function loadGame(saveString) {
|
|||||||
}
|
}
|
||||||
if (saveObj.hasOwnProperty("LastExportBonus")) {
|
if (saveObj.hasOwnProperty("LastExportBonus")) {
|
||||||
try {
|
try {
|
||||||
ExportBonus.LastExportBonus = JSON.parse(saveObj.LastExportBonus);
|
ExportBonus.setLastExportBonus(JSON.parse(saveObj.LastExportBonus));
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
ExportBonus.LastExportBonus = (new Date()).getTime();
|
ExportBonus.setLastExportBonus((new Date()).getTime());
|
||||||
console.error("ERROR: Failed to parse .fconf Settings "+ err);
|
console.error("ERROR: Failed to parse .fconf Settings "+ err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -334,9 +334,9 @@ function loadImportedGame(saveObj, saveString) {
|
|||||||
}
|
}
|
||||||
if (saveObj.hasOwnProperty("LastExportBonus")) {
|
if (saveObj.hasOwnProperty("LastExportBonus")) {
|
||||||
try {
|
try {
|
||||||
ExportBonus.LastExportBonus = JSON.parse(saveObj.LastExportBonus);
|
ExportBonus.setLastExportBonus(JSON.parse(saveObj.LastExportBonus));
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
ExportBonus.LastExportBonus = (new Date()).getTime();
|
ExportBonus.setLastExportBonus((new Date()).getTime());
|
||||||
console.error("ERROR: Failed to parse .fconf Settings "+ err);
|
console.error("ERROR: Failed to parse .fconf Settings "+ err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,6 +78,7 @@ async function parseOnlyRamCalculate(otherScripts, code, workerScript) {
|
|||||||
let code;
|
let code;
|
||||||
if (nextModule.startsWith("https://") || nextModule.startsWith("http://")) {
|
if (nextModule.startsWith("https://") || nextModule.startsWith("http://")) {
|
||||||
try {
|
try {
|
||||||
|
// eslint-disable-next-line no-await-in-loop
|
||||||
const module = await eval('import(nextModule)');
|
const module = await eval('import(nextModule)');
|
||||||
code = "";
|
code = "";
|
||||||
for (const prop in module) {
|
for (const prop in module) {
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
import { ScriptEditor } from "./ScriptEditor";
|
import { ScriptEditor } from "./ScriptEditor";
|
||||||
|
|
||||||
const ace = require('brace');
|
import ace from 'brace';
|
||||||
|
|
||||||
require('brace/mode/javascript');
|
import 'brace/mode/javascript';
|
||||||
require('./AceNetscriptMode');
|
import './AceNetscriptMode';
|
||||||
require('brace/theme/chaos');
|
import 'brace/theme/chaos';
|
||||||
require('brace/theme/chrome');
|
import 'brace/theme/chrome';
|
||||||
require('brace/theme/monokai');
|
import 'brace/theme/monokai';
|
||||||
require('brace/theme/solarized_dark');
|
import 'brace/theme/solarized_dark';
|
||||||
require('brace/theme/solarized_light');
|
import 'brace/theme/solarized_light';
|
||||||
require('brace/theme/terminal');
|
import 'brace/theme/terminal';
|
||||||
require('brace/theme/twilight');
|
import 'brace/theme/twilight';
|
||||||
require('brace/theme/xcode');
|
import 'brace/theme/xcode';
|
||||||
require("brace/keybinding/vim");
|
import "brace/keybinding/vim";
|
||||||
require("brace/keybinding/emacs");
|
import "brace/keybinding/emacs";
|
||||||
require("brace/ext/language_tools");
|
import "brace/ext/language_tools";
|
||||||
|
|
||||||
import { NetscriptFunctions } from "../NetscriptFunctions";
|
import { NetscriptFunctions } from "../NetscriptFunctions";
|
||||||
import { Settings } from "../Settings/Settings";
|
import { Settings } from "../Settings/Settings";
|
||||||
|
@ -87,7 +87,7 @@ import 'codemirror/addon/lint/lint.css';
|
|||||||
import 'codemirror/addon/search/match-highlighter.js';
|
import 'codemirror/addon/search/match-highlighter.js';
|
||||||
import 'codemirror/addon/selection/active-line.js';
|
import 'codemirror/addon/selection/active-line.js';
|
||||||
|
|
||||||
window.JSHINT = require('jshint').JSHINT;
|
import { JSHINT } from 'jshint';
|
||||||
import './CodeMirrorNetscriptLint.js';
|
import './CodeMirrorNetscriptLint.js';
|
||||||
|
|
||||||
import { NetscriptFunctions } from "../NetscriptFunctions";
|
import { NetscriptFunctions } from "../NetscriptFunctions";
|
||||||
@ -100,6 +100,10 @@ import { createElement } from "../../utils/uiHelpers/createElement";
|
|||||||
import { createOptionElement } from "../../utils/uiHelpers/createOptionElement";
|
import { createOptionElement } from "../../utils/uiHelpers/createOptionElement";
|
||||||
import { removeChildrenFromElement } from "../../utils/uiHelpers/removeChildrenFromElement";
|
import { removeChildrenFromElement } from "../../utils/uiHelpers/removeChildrenFromElement";
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
window.JSHINT = JSHINT;
|
||||||
|
})();
|
||||||
|
|
||||||
// Max number of invisibles to be shown in a group if the "Show Invisibles" option
|
// Max number of invisibles to be shown in a group if the "Show Invisibles" option
|
||||||
// is marked
|
// is marked
|
||||||
const MaxInvisibles = 20;
|
const MaxInvisibles = 20;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { CursorPositions } from './CursorPositions';
|
import { CursorPositions } from './CursorPositions';
|
||||||
|
|
||||||
// Base Script Editor class for the Ace/CodeMirror/etc. wrappers
|
// Base Script Editor class for the Ace/CodeMirror/etc. wrappers
|
||||||
const beautify = require('js-beautify').js_beautify;
|
import { js_beautify as beautify } from 'js-beautify';
|
||||||
|
|
||||||
export class ScriptEditor {
|
export class ScriptEditor {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -588,7 +588,6 @@ let Terminal = {
|
|||||||
post(currServ.hostname + ": ");
|
post(currServ.hostname + ": ");
|
||||||
const org = currServ.organizationName
|
const org = currServ.organizationName
|
||||||
post("Organization name: " + (!isHacknet ? org : "Player"));
|
post("Organization name: " + (!isHacknet ? org : "Player"));
|
||||||
const admin = currServ.hasAdminRights;
|
|
||||||
let hasAdminRights = !isHacknet && currServ.hasAdminRights || isHacknet;
|
let hasAdminRights = !isHacknet && currServ.hasAdminRights || isHacknet;
|
||||||
post("Root Access: " + (hasAdminRights ? "YES" : "NO"));
|
post("Root Access: " + (hasAdminRights ? "YES" : "NO"));
|
||||||
const hackingSkill = currServ.requiredHackingSkill
|
const hackingSkill = currServ.requiredHackingSkill
|
||||||
|
@ -24,16 +24,21 @@ export class CodingContractPopup extends React.Component<IProps, IState>{
|
|||||||
this.onInputKeydown = this.onInputKeydown.bind(this);
|
this.onInputKeydown = this.onInputKeydown.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
setAnswer(event: any) {
|
setAnswer(event: React.ChangeEvent<HTMLInputElement>): void {
|
||||||
this.setState({ answer: event.target.value });
|
this.setState({ answer: event.target.value });
|
||||||
}
|
}
|
||||||
|
|
||||||
onInputKeydown(e:any){
|
onInputKeydown(event: React.KeyboardEvent<HTMLInputElement>): void {
|
||||||
if (e.keyCode === KEY.ENTER && e.target.value !== "") {
|
// React just won't cooperate on this one.
|
||||||
e.preventDefault();
|
// "React.KeyboardEvent<HTMLInputElement>" seems like the right type but
|
||||||
|
// whatever ...
|
||||||
|
const value = (event.target as any).value;
|
||||||
|
|
||||||
|
if (event.keyCode === KEY.ENTER && value !== "") {
|
||||||
|
event.preventDefault();
|
||||||
this.props.onAttempt(this.state.answer);
|
this.props.onAttempt(this.state.answer);
|
||||||
} else if (e.keyCode === KEY.ESC) {
|
} else if (event.keyCode === KEY.ESC) {
|
||||||
e.preventDefault();
|
event.preventDefault();
|
||||||
this.props.onClose();
|
this.props.onClose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ import { removeElement } from "../../../utils/uiHelpers/removeElement";
|
|||||||
export interface IPopupButtonProps {
|
export interface IPopupButtonProps {
|
||||||
class?: string;
|
class?: string;
|
||||||
popup: HTMLElement | string;
|
popup: HTMLElement | string;
|
||||||
style?: object;
|
style?: any;
|
||||||
text: string;
|
text: string;
|
||||||
onClose?: () => void;
|
onClose?: () => void;
|
||||||
}
|
}
|
||||||
@ -26,15 +26,15 @@ export class PopupButton extends React.Component<IPopupButtonProps, any> {
|
|||||||
this.keyListener = this.keyListener.bind(this);
|
this.keyListener = this.keyListener.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount(): void {
|
||||||
document.addEventListener("keydown", this.keyListener);
|
document.addEventListener("keydown", this.keyListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount(): void {
|
||||||
document.removeEventListener("keydown", this.keyListener);
|
document.removeEventListener("keydown", this.keyListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleClick() {
|
handleClick(): void {
|
||||||
if(this.props.onClose)
|
if(this.props.onClose)
|
||||||
this.props.onClose();
|
this.props.onClose();
|
||||||
//We might be able to remove this?
|
//We might be able to remove this?
|
||||||
@ -52,7 +52,7 @@ export class PopupButton extends React.Component<IPopupButtonProps, any> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
keyListener(e: KeyboardEvent) {
|
keyListener(e: KeyboardEvent): void {
|
||||||
//This doesn't really make sense, a button doesnt have to listen to escape IMO
|
//This doesn't really make sense, a button doesnt have to listen to escape IMO
|
||||||
//Too affraid to remove it since im not sure what it will break.. But yuck..
|
//Too affraid to remove it since im not sure what it will break.. But yuck..
|
||||||
if (e.keyCode === KEY.ESC) {
|
if (e.keyCode === KEY.ESC) {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import {Engine} from "../engine";
|
import {Engine} from "../engine";
|
||||||
import {Settings} from "../Settings/Settings";
|
import {Settings} from "../Settings/Settings";
|
||||||
import {Player} from "../Player";
|
|
||||||
import {numeralWrapper} from "./numeralFormat";
|
import {numeralWrapper} from "./numeralFormat";
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ module.exports = {
|
|||||||
// "block-opening-brace-space-before": "always",
|
// "block-opening-brace-space-before": "always",
|
||||||
"color-hex-case": "lower",
|
"color-hex-case": "lower",
|
||||||
"color-hex-length": "short",
|
"color-hex-length": "short",
|
||||||
"color-named": "never",
|
// "color-named": "never",
|
||||||
//"color-no-hex": true,
|
//"color-no-hex": true,
|
||||||
"color-no-invalid-hex": true,
|
"color-no-invalid-hex": true,
|
||||||
// "comment-empty-line-before": "always",
|
// "comment-empty-line-before": "always",
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Webpack configuration for building unit tests
|
* Webpack configuration for building unit tests
|
||||||
*/
|
*/
|
||||||
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var webpack = require('webpack');
|
var webpack = require('webpack');
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var webpack = require('webpack');
|
var webpack = require('webpack');
|
||||||
var MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
var MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||||
|
Loading…
Reference in New Issue
Block a user