From 3b99da8474e3cf5838d021c9b89c01bad41878b8 Mon Sep 17 00:00:00 2001 From: Martin Fournier Date: Sun, 19 Dec 2021 13:04:34 -0500 Subject: [PATCH] Lint current problems & fix ignore paths --- .eslintignore | 22 ++++++++++++++++--- electron/main.js | 4 +++- src/Electron.tsx | 1 + src/NetscriptFunctions/toNative.ts | 1 + .../Player/PlayerObjectGeneralMethods.tsx | 2 +- src/ScriptEditor/ui/ScriptEditorRoot.tsx | 4 ++-- src/Server/BaseServer.ts | 1 + src/Terminal/DirectoryHelpers.ts | 4 ++-- src/Terminal/commands/download.ts | 2 +- 9 files changed, 31 insertions(+), 10 deletions(-) diff --git a/.eslintignore b/.eslintignore index 63c1d3054..0ef022e71 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,7 +1,23 @@ node_modules/ -doc/build/ dist/ -tests/*.bundle.* +input/ + +assets/ +css/ +.cypress/ +cypress/ +doc/ +markdown/ +netscript_tests/ +scripts/ + +electron/lib +electron/greenworks.js src/ThirdParty/* src/JSInterpreter.js -main.bundle.js \ No newline at end of file + +test/*.bundle.* +editor.main.js +main.bundle.js +webpack.config.js +webpack.config-test.js diff --git a/electron/main.js b/electron/main.js index 2887fba23..b26321d97 100644 --- a/electron/main.js +++ b/electron/main.js @@ -1,4 +1,5 @@ -const { app, BrowserWindow, Menu, shell } = require("electron"); +/* eslint-disable @typescript-eslint/no-var-requires */ + const { app, BrowserWindow, Menu, shell } = require("electron"); const greenworks = require("./greenworks"); if (greenworks.init()) { @@ -127,6 +128,7 @@ function setStopProcessHandler(app, window, enabled) { const stopProcessHandler = () => { if (process.platform !== "darwin") { app.quit(); + // eslint-disable-next-line no-process-exit process.exit(0); } }; diff --git a/src/Electron.tsx b/src/Electron.tsx index f9714ee54..e08caab07 100644 --- a/src/Electron.tsx +++ b/src/Electron.tsx @@ -32,6 +32,7 @@ function bitNodeFinishedState(): boolean { return Player.bladeburner !== null && Player.bladeburner.blackops.hasOwnProperty("Operation Daedalus"); } +// eslint-disable-next-line @typescript-eslint/no-unused-vars function sfAchievement(): Achievement[] { const achs: Achievement[] = []; for (let i = 0; i <= 11; i++) { diff --git a/src/NetscriptFunctions/toNative.ts b/src/NetscriptFunctions/toNative.ts index 1f43fb03c..da365af67 100644 --- a/src/NetscriptFunctions/toNative.ts +++ b/src/NetscriptFunctions/toNative.ts @@ -4,6 +4,7 @@ const defaultInterpreter = new Interpreter("", () => undefined); // the acorn interpreter has a bug where it doesn't convert arrays correctly. // so we have to more or less copy it here. +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types export function toNative(pseudoObj: any): any { if (pseudoObj == null) return null; if ( diff --git a/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx b/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx index 5d343dfe5..604fe7a16 100644 --- a/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx +++ b/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx @@ -26,7 +26,7 @@ import { Locations } from "../../Locations/Locations"; import { CityName } from "../../Locations/data/CityNames"; import { LocationName } from "../../Locations/data/LocationNames"; import { Sleeve } from "../../PersonObjects/Sleeve/Sleeve"; -import { calculateSkill as calculateSkillF, calculateSkillProgress as calculateSkillProgressF, getEmptySkillProgress, ISkillProgress } from "../formulas/skill"; +import { calculateSkill as calculateSkillF, calculateSkillProgress as calculateSkillProgressF, ISkillProgress } from "../formulas/skill"; import { calculateIntelligenceBonus } from "../formulas/intelligence"; import { getHackingWorkRepGain, diff --git a/src/ScriptEditor/ui/ScriptEditorRoot.tsx b/src/ScriptEditor/ui/ScriptEditorRoot.tsx index 99d7f525a..1fc73aaa1 100644 --- a/src/ScriptEditor/ui/ScriptEditorRoot.tsx +++ b/src/ScriptEditor/ui/ScriptEditorRoot.tsx @@ -104,8 +104,8 @@ let currentScript = {} as openScript; // Script currently being viewed export function Root(props: IProps): React.ReactElement { const editorRef = useRef(null); const monacoRef = useRef(null); - const [filename, setFilename] = useState(props.filename); - const [code, setCode] = useState(props.code); + const [filename] = useState(props.filename); + const [code] = useState(props.code); const [decorations, setDecorations] = useState([]); const [ram, setRAM] = useState("RAM: ???"); const [updatingRam, setUpdatingRam] = useState(false); diff --git a/src/Server/BaseServer.ts b/src/Server/BaseServer.ts index c9e71f719..4c28581f4 100644 --- a/src/Server/BaseServer.ts +++ b/src/Server/BaseServer.ts @@ -246,6 +246,7 @@ export class BaseServer { this.maxRam = ram; } + // eslint-disable-next-line @typescript-eslint/no-unused-vars updateRamUsed(ram: number, player: IPlayer): void { this.ramUsed = ram; } diff --git a/src/Terminal/DirectoryHelpers.ts b/src/Terminal/DirectoryHelpers.ts index c6d020639..be592ae9b 100644 --- a/src/Terminal/DirectoryHelpers.ts +++ b/src/Terminal/DirectoryHelpers.ts @@ -178,14 +178,14 @@ export function getAllParentDirectories(path: string): string { * @param cwd The current working directory * @returns A file path which may be absolute or relative */ -export function getDestinationFilepath(destination: string, source: string, cwd: string) { +export function getDestinationFilepath(destination: string, source: string, cwd: string): string { const dstDir = evaluateDirectoryPath(destination, cwd); // If evaluating the directory for this destination fails, we have a filename or full path. if (dstDir === null) { return destination; } else { // Append the filename to the directory provided. - let t_path = removeTrailingSlash(dstDir); + const t_path = removeTrailingSlash(dstDir); const fileName = getFileName(source); return t_path + "/" + fileName; } diff --git a/src/Terminal/commands/download.ts b/src/Terminal/commands/download.ts index 83729eef8..fa392d444 100644 --- a/src/Terminal/commands/download.ts +++ b/src/Terminal/commands/download.ts @@ -24,7 +24,7 @@ export function download( const matchEnding = fn.length == 1 || fn === "*.*" ? null : fn.slice(1); // Treat *.* the same as * const zip = new JSZip(); // Helper function to zip any file contents whose name matches the pattern - const zipFiles = (fileNames: string[], fileContents: string[]) => { + const zipFiles = (fileNames: string[], fileContents: string[]): void => { for (let i = 0; i < fileContents.length; ++i) { let name = fileNames[i]; if (name.startsWith("/")) name = name.slice(1);