From fd4b3014278c8224ac5ee7be7c991ca2d8d09aea Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Sun, 18 Aug 2019 14:14:13 -0700 Subject: [PATCH] Clean up unused variables --- modern/.eslintrc | 1 - modern/src/App.js | 27 +++++++++---------- modern/src/maki-interpreter/interpreter.js | 2 +- modern/src/maki-interpreter/parser.js | 15 ++++------- modern/src/maki-interpreter/virtualMachine.js | 4 +-- modern/src/runtime/.eslintrc | 7 +++++ modern/src/runtime/GuiObject.js | 2 +- modern/src/store.ts | 2 +- 8 files changed, 30 insertions(+), 30 deletions(-) create mode 100644 modern/src/runtime/.eslintrc diff --git a/modern/.eslintrc b/modern/.eslintrc index 6efd7d4c..25e1dfe4 100644 --- a/modern/.eslintrc +++ b/modern/.eslintrc @@ -2,7 +2,6 @@ "rules": { // TODO: Turn these all back on "camelcase": "off", - "@typescript-eslint/no-unused-vars": "off", "prefer-const": "off", "no-shadow": "off", "no-nested-ternary": "off", diff --git a/modern/src/App.js b/modern/src/App.js index 0d90d4dc..6d4f2f94 100644 --- a/modern/src/App.js +++ b/modern/src/App.js @@ -1,4 +1,4 @@ -import React, { useEffect, useReducer, useState } from "react"; +import React, { useEffect, useReducer } from "react"; import "./App.css"; import * as Utils from "./utils"; import * as Actions from "./Actions"; @@ -11,7 +11,7 @@ import Debugger from "./debugger"; import Sidebar from "./Sidebar"; function useJsUpdates(node) { - const [ignored, forceUpdate] = useReducer(x => x + 1, 0); + const [, forceUpdate] = useReducer(x => x + 1, 0); useEffect(() => node.js_listen("js_update", forceUpdate)); } @@ -96,8 +96,8 @@ function GuiObjectEvents({ Component, node, children }) { onMouseMove={e => handleMouseEventDispatch(node, e, "onMouseMove")} onMouseEnter={e => handleMouseEventDispatch(node, e, "onEnterArea")} onMouseLeave={e => handleMouseEventDispatch(node, e, "onLeaveArea")} - onDragEnter={e => node.js_trigger("onDragEnter")} - onDragLeave={e => node.js_trigger("onDragLeave")} + onDragEnter={() => node.js_trigger("onDragEnter")} + onDragLeave={() => node.js_trigger("onDragLeave")} onDragOver={e => handleMouseEventDispatch(node, e, "onDragOver")} onKeyUp={e => node.js_trigger("onKeyUp", e.keyCode)} onKeyDown={e => node.js_trigger("onKeyDown", e.keyCode)} @@ -138,7 +138,7 @@ function Layout({ node, id, background, - desktopalpha, + // desktopalpha, drawBackground, x, y, @@ -148,7 +148,7 @@ function Layout({ maximum_h, minimum_w, maximum_w, - droptarget, + // droptarget, children, }) { if (drawBackground && background == null) { @@ -265,7 +265,7 @@ function Layer({ node, id, image, children, x, y }) { function Button({ id, image, - action, + // action, x, y, downImage, @@ -290,7 +290,7 @@ function Button({
{ + onMouseDown={() => { setDown(true); document.addEventListener("mouseup", () => { // TODO: This could be unmounted @@ -379,17 +379,17 @@ function Group(props) { } function Text({ - node, + // node, id, children, display, - ticker, - antialias, + // ticker, + // antialias, x, y, w, h, - font, + // font, fontsize, color, align, @@ -452,8 +452,7 @@ const NODE_NO_EVENTS = new Set(["popupmenu"]); // Given a skin XML node, pick which component to use, and render it. function XmlNode({ node }) { - const attributes = node.attributes; - const name = node.name; + const { name } = node; if ( name == null || name === "groupdef" || diff --git a/modern/src/maki-interpreter/interpreter.js b/modern/src/maki-interpreter/interpreter.js index f572121a..92c6ce6b 100644 --- a/modern/src/maki-interpreter/interpreter.js +++ b/modern/src/maki-interpreter/interpreter.js @@ -1,7 +1,7 @@ import Variable from "./variable"; import { isPromise, unimplementedWarning } from "../utils"; -function coerceTypes(var1, var2, val1, val2) { +function coerceTypes(var1, var2, val1 /* val2 */) { if (var2.type === "INT") { if (var1.type === "FLOAT" || var1.type === "DOUBLE") { return Math.floor(val1); diff --git a/modern/src/maki-interpreter/parser.js b/modern/src/maki-interpreter/parser.js index 522c3590..183ab4c3 100644 --- a/modern/src/maki-interpreter/parser.js +++ b/modern/src/maki-interpreter/parser.js @@ -150,10 +150,10 @@ function readVariables({ makiFile, classes }) { const subClass = makiFile.readUInt16LE(); const uinit1 = makiFile.readUInt16LE(); const uinit2 = makiFile.readUInt16LE(); - const uinit3 = makiFile.readUInt16LE(); - const uinit4 = makiFile.readUInt16LE(); + makiFile.readUInt16LE(); // uinit3 + makiFile.readUInt16LE(); //uinit4 const global = makiFile.readUInt8(); - const system = makiFile.readUInt8(); + makiFile.readUInt8(); // system if (object) { const klass = classes[typeOffset]; @@ -234,7 +234,7 @@ function readBindings(makiFile) { return bindings; } -function decodeCode({ makiFile, classes, variables, methods }) { +function decodeCode({ makiFile }) { const length = makiFile.readUInt32LE(); const start = makiFile.getPosition(); @@ -310,12 +310,7 @@ function parse(buffer) { const variables = readVariables({ makiFile: makiFile, classes }); readConstants({ makiFile: makiFile, variables }); const bindings = readBindings(makiFile); - const commands = decodeCode({ - makiFile, - classes, - variables, - methods, - }); + const commands = decodeCode({ makiFile }); // Map binary offsets to command indexes. // Some bindings/functions ask us to jump to a place in the binary data and diff --git a/modern/src/maki-interpreter/virtualMachine.js b/modern/src/maki-interpreter/virtualMachine.js index d4bb4a9f..ee4b81e1 100644 --- a/modern/src/maki-interpreter/virtualMachine.js +++ b/modern/src/maki-interpreter/virtualMachine.js @@ -59,8 +59,8 @@ export function run({ }); }); - const { commands, variables } = program; - commands.forEach((command, i) => { + const { commands /* variables */ } = program; + commands.forEach((/* command, i*/) => { // printCommand({ i, command, stack: [], variables }); }); diff --git a/modern/src/runtime/.eslintrc b/modern/src/runtime/.eslintrc new file mode 100644 index 00000000..a7abc157 --- /dev/null +++ b/modern/src/runtime/.eslintrc @@ -0,0 +1,7 @@ +{ + "rules": { + // TODO: Turn these all back on + // For now we want to be able to define maki method arguments even though we don't use them. + "@typescript-eslint/no-unused-vars": "off" + } +} diff --git a/modern/src/runtime/GuiObject.js b/modern/src/runtime/GuiObject.js index 5121e76b..f16d3a6f 100644 --- a/modern/src/runtime/GuiObject.js +++ b/modern/src/runtime/GuiObject.js @@ -1,5 +1,5 @@ import MakiObject from "./MakiObject"; -import { findDescendantByTypeAndId, unimplementedWarning } from "../utils"; +import { findDescendantByTypeAndId } from "../utils"; class GuiObject extends MakiObject { constructor(node, parent) { diff --git a/modern/src/store.ts b/modern/src/store.ts index 0be855db..5fc38fde 100644 --- a/modern/src/store.ts +++ b/modern/src/store.ts @@ -1,5 +1,5 @@ import { ModernAppState, ModernAction } from "./types"; -import { createStore, applyMiddleware, compose } from "redux"; +import { createStore, applyMiddleware } from "redux"; import { composeWithDevTools } from "redux-devtools-extension"; import thunk from "redux-thunk";