Lint current problems & fix ignore paths

This commit is contained in:
Martin Fournier 2021-12-19 13:04:34 -05:00
parent 92e8b42d18
commit 3b99da8474
9 changed files with 31 additions and 10 deletions

@ -1,7 +1,23 @@
node_modules/ node_modules/
doc/build/
dist/ dist/
tests/*.bundle.* input/
assets/
css/
.cypress/
cypress/
doc/
markdown/
netscript_tests/
scripts/
electron/lib
electron/greenworks.js
src/ThirdParty/* src/ThirdParty/*
src/JSInterpreter.js src/JSInterpreter.js
main.bundle.js
test/*.bundle.*
editor.main.js
main.bundle.js
webpack.config.js
webpack.config-test.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"); const greenworks = require("./greenworks");
if (greenworks.init()) { if (greenworks.init()) {
@ -127,6 +128,7 @@ function setStopProcessHandler(app, window, enabled) {
const stopProcessHandler = () => { const stopProcessHandler = () => {
if (process.platform !== "darwin") { if (process.platform !== "darwin") {
app.quit(); app.quit();
// eslint-disable-next-line no-process-exit
process.exit(0); process.exit(0);
} }
}; };

@ -32,6 +32,7 @@ function bitNodeFinishedState(): boolean {
return Player.bladeburner !== null && Player.bladeburner.blackops.hasOwnProperty("Operation Daedalus"); return Player.bladeburner !== null && Player.bladeburner.blackops.hasOwnProperty("Operation Daedalus");
} }
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function sfAchievement(): Achievement[] { function sfAchievement(): Achievement[] {
const achs: Achievement[] = []; const achs: Achievement[] = [];
for (let i = 0; i <= 11; i++) { for (let i = 0; i <= 11; i++) {

@ -4,6 +4,7 @@ const defaultInterpreter = new Interpreter("", () => undefined);
// the acorn interpreter has a bug where it doesn't convert arrays correctly. // the acorn interpreter has a bug where it doesn't convert arrays correctly.
// so we have to more or less copy it here. // 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 { export function toNative(pseudoObj: any): any {
if (pseudoObj == null) return null; if (pseudoObj == null) return null;
if ( if (

@ -26,7 +26,7 @@ import { Locations } from "../../Locations/Locations";
import { CityName } from "../../Locations/data/CityNames"; import { CityName } from "../../Locations/data/CityNames";
import { LocationName } from "../../Locations/data/LocationNames"; import { LocationName } from "../../Locations/data/LocationNames";
import { Sleeve } from "../../PersonObjects/Sleeve/Sleeve"; 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 { calculateIntelligenceBonus } from "../formulas/intelligence";
import { import {
getHackingWorkRepGain, getHackingWorkRepGain,

@ -104,8 +104,8 @@ let currentScript = {} as openScript; // Script currently being viewed
export function Root(props: IProps): React.ReactElement { export function Root(props: IProps): React.ReactElement {
const editorRef = useRef<IStandaloneCodeEditor | null>(null); const editorRef = useRef<IStandaloneCodeEditor | null>(null);
const monacoRef = useRef<Monaco | null>(null); const monacoRef = useRef<Monaco | null>(null);
const [filename, setFilename] = useState(props.filename); const [filename] = useState(props.filename);
const [code, setCode] = useState<string>(props.code); const [code] = useState<string>(props.code);
const [decorations, setDecorations] = useState<string[]>([]); const [decorations, setDecorations] = useState<string[]>([]);
const [ram, setRAM] = useState("RAM: ???"); const [ram, setRAM] = useState("RAM: ???");
const [updatingRam, setUpdatingRam] = useState(false); const [updatingRam, setUpdatingRam] = useState(false);

@ -246,6 +246,7 @@ export class BaseServer {
this.maxRam = ram; this.maxRam = ram;
} }
// eslint-disable-next-line @typescript-eslint/no-unused-vars
updateRamUsed(ram: number, player: IPlayer): void { updateRamUsed(ram: number, player: IPlayer): void {
this.ramUsed = ram; this.ramUsed = ram;
} }

@ -178,14 +178,14 @@ export function getAllParentDirectories(path: string): string {
* @param cwd The current working directory * @param cwd The current working directory
* @returns A file path which may be absolute or relative * @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); const dstDir = evaluateDirectoryPath(destination, cwd);
// If evaluating the directory for this destination fails, we have a filename or full path. // If evaluating the directory for this destination fails, we have a filename or full path.
if (dstDir === null) { if (dstDir === null) {
return destination; return destination;
} else { } else {
// Append the filename to the directory provided. // Append the filename to the directory provided.
let t_path = removeTrailingSlash(dstDir); const t_path = removeTrailingSlash(dstDir);
const fileName = getFileName(source); const fileName = getFileName(source);
return t_path + "/" + fileName; return t_path + "/" + fileName;
} }

@ -24,7 +24,7 @@ export function download(
const matchEnding = fn.length == 1 || fn === "*.*" ? null : fn.slice(1); // Treat *.* the same as * const matchEnding = fn.length == 1 || fn === "*.*" ? null : fn.slice(1); // Treat *.* the same as *
const zip = new JSZip(); const zip = new JSZip();
// Helper function to zip any file contents whose name matches the pattern // 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) { for (let i = 0; i < fileContents.length; ++i) {
let name = fileNames[i]; let name = fileNames[i];
if (name.startsWith("/")) name = name.slice(1); if (name.startsWith("/")) name = name.slice(1);