fix nearly all lint errors now

This commit is contained in:
Olivier Gagnon 2021-05-29 14:48:56 -04:00
parent 60d6d49c43
commit 674ce17834
29 changed files with 75 additions and 69 deletions

@ -27,5 +27,4 @@
button {
padding: 4px;
}
}

@ -80,7 +80,7 @@
transform: rotate(-45deg);
}
}
input[type=checkbox] {
input[type="checkbox"] {
margin: 3px;
visibility: hidden;
&:checked + label:after {

@ -11,7 +11,7 @@
}
.casino-card .value {
font-size:15pt;
font-size: 15pt;
font-family: sans-serif;
}

@ -3,15 +3,11 @@
}
.remove-exp-button {
margin-left:0;
margin-left: 0;
}
.exp-input {
margin-right: 0;
margin-left:0;
margin-top: 5px;
margin-bottom: 5px;
margin: 5px 0 5px 0;
padding: 2px 5px;
}

1
css/grid.min.css vendored

@ -1,3 +1,4 @@
/* stylelint-disable */
/*!
* Bootstrap Grid v4.1.2 (https://getbootstrap.com/)
* Copyright 2011-2018 The Bootstrap Authors

@ -17,7 +17,7 @@
}
&.level-2 {
color: #48d1cc;
color: #48d1cc;
}
&.level-3 {

@ -234,9 +234,9 @@ a:visited {
#status-text-container {
background-color: transparent;
position:absolute;
top:0;
left:50%;
position: absolute;
top: 0;
left: 50%;
}
#status-text {
@ -371,14 +371,15 @@ a:visited {
.noscrollbar {
-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 {
display: none;
}
input[type=checkbox] {
input[type="checkbox"] {
filter: invert(1) sepia(1) hue-rotate(41deg) brightness(100%) saturate(10);
}
@ -398,7 +399,6 @@ input[type=checkbox] {
margin: 3px;
}
.optionRange::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;

@ -16,7 +16,7 @@
text-align: center;
border: 2px solid #e8e8e3;
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;
}

@ -10,8 +10,7 @@ import { PurchasedAugmentations } from "./PurchasedAugmentations";
import { Player } from "../../Player";
import { StdButton } from "../../ui/React/StdButton";
import { LastExportBonus, canGetBonus } from "../../ExportBonus";
import { convertTimeMsToTimeElapsedString } from "../../../utils/StringHelperFunctions";
import { canGetBonus } from "../../ExportBonus";
type IProps = {
exportGameFn: () => void;
@ -31,7 +30,7 @@ export class AugmentationsRoot extends React.Component<IProps, IState> {
this.export = this.export.bind(this);
}
export() {
export(): void {
this.props.exportGameFn();
this.setState({
rerender: !this.state.rerender,

@ -164,10 +164,12 @@ export class Action implements IAction {
}
// For actions that have teams. To be implemented by subtypes.
// eslint-disable-next-line @typescript-eslint/no-unused-vars
getTeamSuccessBonus(inst: IBladeburner): number {
return 1;
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
getActionTypeSkillSuccessBonus(inst: IBladeburner): number {
return 1;
}

@ -12,10 +12,7 @@ import {
Generic_toJSON,
Reviver,
} from "../utils/JSONReviver";
import { KEY } from "../utils/helpers/keyCodes";
import { createElement } from "../utils/uiHelpers/createElement";
import { createPopup, removePopup } from "./ui/React/createPopup";
import { removeElementById } from "../utils/uiHelpers/removeElementById";
import { CodingContractPopup } from "./ui/React/CodingContractPopup";
@ -174,7 +171,7 @@ export class CodingContract {
*/
async prompt(): Promise<CodingContractResult> {
const popupId = `coding-contract-prompt-popup-${this.fn}`;
return new Promise<CodingContractResult>((resolve, reject) => {
return new Promise<CodingContractResult>((resolve) => {
const popup = new CodingContractPopup({
c: this,
popupId: popupId,

@ -16,4 +16,8 @@ export function onExport(p: IPlayer): void {
Factions[facName].favor++;
}
LastExportBonus = (new Date()).getTime();
}
export function setLastExportBonus(unixTime: number): void {
LastExportBonus = unixTime;
}

@ -1,5 +1,4 @@
const sprintf = require("sprintf-js").sprintf;
const vsprintf = require("sprintf-js").vsprintf;
import { vsprintf, sprintf } from 'sprintf-js';
import * as libarg from 'arg';
import { getRamCost } from "./Netscript/RamCostGenerator";
@ -4397,7 +4396,7 @@ function NetscriptFunctions(workerScript) {
hacknetServers: {
hashGainRate: function(level, ramUsed, maxRam, cores, mult=1) {
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) {
checkFormulasAccess("hacknetServers.levelUpgradeCost", 9);

@ -34,7 +34,7 @@ import { roundToTwo } from "../utils/helpers/roundToTwo";
import { isString } from "../utils/StringHelperFunctions";
import { parse } from "acorn";
const walk = require("acorn-walk");
import { simple as walksimple } from "acorn-walk";
// Netscript Ports are instantiated here
export const NetscriptPorts = [];
@ -304,7 +304,7 @@ function processNetscript1Imports(code, workerScript) {
let hasImports = false;
// Walk over the tree and process ImportDeclaration nodes
walk.simple(ast, {
walksimple(ast, {
ImportDeclaration: (node) => {
hasImports = true;
let scriptName = node.source.value;
@ -322,7 +322,7 @@ function processNetscript1Imports(code, workerScript) {
let namespace = node.specifiers[0].local.name;
let fnNames = []; //Names only
let fnDeclarations = []; //FunctionDeclaration Node objects
walk.simple(scriptAst, {
walksimple(scriptAst, {
FunctionDeclaration: (node) => {
fnNames.push(node.id.name);
fnDeclarations.push(node);
@ -361,7 +361,7 @@ function processNetscript1Imports(code, workerScript) {
//Walk through script and get FunctionDeclaration code for all specified fns
let fnDeclarations = [];
walk.simple(scriptAst, {
walksimple(scriptAst, {
FunctionDeclaration: (node) => {
if (fnsToImport.includes(node.id.name)) {
fnDeclarations.push(node);

@ -529,7 +529,7 @@ export class Sleeve extends Person {
case SleeveTaskType.Recovery:
this.shock = Math.min(100, this.shock + (0.0002 * cyclesUsed));
break;
case SleeveTaskType.Sync:
case SleeveTaskType.Synchro:
this.sync = Math.min(100, this.sync + (p.getIntelligenceBonus(0.5) * 0.0002 * cyclesUsed));
break;
default:
@ -586,7 +586,7 @@ export class Sleeve extends Person {
this.resetTaskStatus();
}
this.currentTask = SleeveTaskType.Sync;
this.currentTask = SleeveTaskType.Synchro;
return true;
}

@ -10,5 +10,5 @@ export enum SleeveTaskType {
Class,
Gym,
Recovery,
Sync,
Synchro,
}

@ -8,7 +8,6 @@ import { prestigeSourceFile } from "./Prestige";
import { PlayerOwnedSourceFile } from "./SourceFile/PlayerOwnedSourceFile";
import { SourceFileFlags } from "./SourceFile/SourceFileFlags";
import { SourceFiles } from "./SourceFile/SourceFiles";
import { Terminal } from "./Terminal";
import { setTimeoutRef } from "./utils/SetTimeoutRef";
import { dialogBoxCreate } from "../utils/DialogBox";

@ -248,9 +248,9 @@ function loadGame(saveString) {
}
if (saveObj.hasOwnProperty("LastExportBonus")) {
try {
ExportBonus.LastExportBonus = JSON.parse(saveObj.LastExportBonus);
ExportBonus.setLastExportBonus(JSON.parse(saveObj.LastExportBonus));
} catch(err) {
ExportBonus.LastExportBonus = (new Date()).getTime();
ExportBonus.setLastExportBonus((new Date()).getTime());
console.error("ERROR: Failed to parse .fconf Settings "+ err);
}
}
@ -334,9 +334,9 @@ function loadImportedGame(saveObj, saveString) {
}
if (saveObj.hasOwnProperty("LastExportBonus")) {
try {
ExportBonus.LastExportBonus = JSON.parse(saveObj.LastExportBonus);
ExportBonus.setLastExportBonus(JSON.parse(saveObj.LastExportBonus));
} catch(err) {
ExportBonus.LastExportBonus = (new Date()).getTime();
ExportBonus.setLastExportBonus((new Date()).getTime());
console.error("ERROR: Failed to parse .fconf Settings "+ err);
}
}

@ -78,6 +78,7 @@ async function parseOnlyRamCalculate(otherScripts, code, workerScript) {
let code;
if (nextModule.startsWith("https://") || nextModule.startsWith("http://")) {
try {
// eslint-disable-next-line no-await-in-loop
const module = await eval('import(nextModule)');
code = "";
for (const prop in module) {

@ -1,20 +1,20 @@
import { ScriptEditor } from "./ScriptEditor";
const ace = require('brace');
import ace from 'brace';
require('brace/mode/javascript');
require('./AceNetscriptMode');
require('brace/theme/chaos');
require('brace/theme/chrome');
require('brace/theme/monokai');
require('brace/theme/solarized_dark');
require('brace/theme/solarized_light');
require('brace/theme/terminal');
require('brace/theme/twilight');
require('brace/theme/xcode');
require("brace/keybinding/vim");
require("brace/keybinding/emacs");
require("brace/ext/language_tools");
import 'brace/mode/javascript';
import './AceNetscriptMode';
import 'brace/theme/chaos';
import 'brace/theme/chrome';
import 'brace/theme/monokai';
import 'brace/theme/solarized_dark';
import 'brace/theme/solarized_light';
import 'brace/theme/terminal';
import 'brace/theme/twilight';
import 'brace/theme/xcode';
import "brace/keybinding/vim";
import "brace/keybinding/emacs";
import "brace/ext/language_tools";
import { NetscriptFunctions } from "../NetscriptFunctions";
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/selection/active-line.js';
window.JSHINT = require('jshint').JSHINT;
import { JSHINT } from 'jshint';
import './CodeMirrorNetscriptLint.js';
import { NetscriptFunctions } from "../NetscriptFunctions";
@ -100,6 +100,10 @@ import { createElement } from "../../utils/uiHelpers/createElement";
import { createOptionElement } from "../../utils/uiHelpers/createOptionElement";
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
// is marked
const MaxInvisibles = 20;

@ -1,7 +1,7 @@
import { CursorPositions } from './CursorPositions';
// 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 {
constructor() {

@ -588,7 +588,6 @@ let Terminal = {
post(currServ.hostname + ": ");
const org = currServ.organizationName
post("Organization name: " + (!isHacknet ? org : "Player"));
const admin = currServ.hasAdminRights;
let hasAdminRights = !isHacknet && currServ.hasAdminRights || isHacknet;
post("Root Access: " + (hasAdminRights ? "YES" : "NO"));
const hackingSkill = currServ.requiredHackingSkill

@ -24,16 +24,21 @@ export class CodingContractPopup extends React.Component<IProps, IState>{
this.onInputKeydown = this.onInputKeydown.bind(this);
}
setAnswer(event: any) {
setAnswer(event: React.ChangeEvent<HTMLInputElement>): void {
this.setState({ answer: event.target.value });
}
onInputKeydown(e:any){
if (e.keyCode === KEY.ENTER && e.target.value !== "") {
e.preventDefault();
onInputKeydown(event: React.KeyboardEvent<HTMLInputElement>): void {
// React just won't cooperate on this one.
// "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);
} else if (e.keyCode === KEY.ESC) {
e.preventDefault();
} else if (event.keyCode === KEY.ESC) {
event.preventDefault();
this.props.onClose();
}
}

@ -14,7 +14,7 @@ import { removeElement } from "../../../utils/uiHelpers/removeElement";
export interface IPopupButtonProps {
class?: string;
popup: HTMLElement | string;
style?: object;
style?: any;
text: string;
onClose?: () => void;
}
@ -26,15 +26,15 @@ export class PopupButton extends React.Component<IPopupButtonProps, any> {
this.keyListener = this.keyListener.bind(this);
}
componentDidMount() {
componentDidMount(): void {
document.addEventListener("keydown", this.keyListener);
}
componentWillUnmount() {
componentWillUnmount(): void {
document.removeEventListener("keydown", this.keyListener);
}
handleClick() {
handleClick(): void {
if(this.props.onClose)
this.props.onClose();
//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
//Too affraid to remove it since im not sure what it will break.. But yuck..
if (e.keyCode === KEY.ESC) {

@ -1,6 +1,5 @@
import {Engine} from "../engine";
import {Settings} from "../Settings/Settings";
import {Player} from "../Player";
import {numeralWrapper} from "./numeralFormat";

@ -44,7 +44,7 @@ module.exports = {
// "block-opening-brace-space-before": "always",
"color-hex-case": "lower",
"color-hex-length": "short",
"color-named": "never",
// "color-named": "never",
//"color-no-hex": true,
"color-no-invalid-hex": true,
// "comment-empty-line-before": "always",

@ -1,6 +1,7 @@
/**
* Webpack configuration for building unit tests
*/
/* eslint-disable @typescript-eslint/no-var-requires */
var path = require('path');
var webpack = require('webpack');

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
var path = require('path');
var webpack = require('webpack');
var MiniCssExtractPlugin = require('mini-css-extract-plugin');