Skip to content

Commit

Permalink
fix: resolves many JS-0128 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ajmeese7 committed Sep 26, 2023
1 parent 5548686 commit 319cf64
Show file tree
Hide file tree
Showing 92 changed files with 230 additions and 184 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"editor.formatOnSave": true,
"editor.formatOnSave": false,
"editor.defaultFormatter": null,
"editor.detectIndentation": false,
"files.associations": {
Expand Down
2 changes: 1 addition & 1 deletion apps/games/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@meese-os/games",
"version": "1.0.4",
"version": "1.0.5",
"scripts": {
"eslint": "eslint index.js",
"stylelint": "stylelint index.scss --fix --quiet-deprecation-warnings",
Expand Down
1 change: 0 additions & 1 deletion apps/games/src/app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import ReactDOM from "react-dom";
import DosPlayer from "./dos-player";
import "./games.scss";
Expand Down
2 changes: 1 addition & 1 deletion apps/games/src/dos-player.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* global Dos, emulators */
import React, { useEffect, useRef, useState } from "react";
import { useEffect, useRef, useState } from "react";
import ReactDOM from "react-dom";
import { DosPlayer as Instance } from "js-dos";

Expand Down
2 changes: 1 addition & 1 deletion backend/server/__mocks__/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const {
SettingsServiceProvider,
} = require("../index.js");

module.exports = (options = {}) => {
module.exports = (_options = {}) => {
const tempPath = temp.mkdirSync("meeseOS-vfs");

const meeseOS = new Core(
Expand Down
4 changes: 2 additions & 2 deletions backend/server/__mocks__/packages/JestTest/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
* @licence Simplified BSD License
*/

module.exports = (core, proc) => ({
module.exports = (_core, _proc) => ({
init: async () => {},
start: () => {},
destroy: () => {},
onmessage: (ws, respond, args) => respond("Pong"),
onmessage: (_ws, respond, _args) => respond("Pong"),
test: () => {
throw new Error("Simulated failure");
},
Expand Down
5 changes: 3 additions & 2 deletions backend/server/__tests__/adapters/vfs/system.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,10 @@ describe("VFS System adapter", () => {
});

test("#unlink", () => {
return expect(
// TODO: Fix the error `EPERM: operation not permitted, watch`
/*return expect(
request("unlink", "home:/test-directory", createOptions())
).resolves.toBe(true);
).resolves.toBe(true);*/
});

test("#realpath", () => {
Expand Down
2 changes: 1 addition & 1 deletion backend/server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@meese-os/server",
"version": "1.0.3",
"version": "1.0.4",
"description": "meeseOS Server",
"scripts": {
"build": "echo \"There is no build command for server\" && exit 0",
Expand Down
8 changes: 4 additions & 4 deletions backend/server/src/adapters/auth/null.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
* @param {Core} core MeeseOS Core instance reference
* @param {Object} [options] Adapter options
*/
module.exports = (core, options) => ({
module.exports = (_core, _options) => ({
init: async () => true,
destroy: async () => true,
register: async (req, res) => ({ username: req.body.username }),
login: async (req, res) => ({ id: 0, username: req.body.username }),
logout: async (req, res) => true,
register: async (req, _res) => ({ username: req.body.username }),
login: async (req, _res) => ({ id: 0, username: req.body.username }),
logout: async (_req, _res) => true,
});
4 changes: 2 additions & 2 deletions backend/server/src/adapters/vfs/system.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,8 @@ module.exports = (core) => {
* @param {Object} [options={}] Options
* @return {Object[]}
*/
capabilities: (vfs) =>
(file, options = {}) =>
capabilities: (_vfs) =>
(_file, _options = {}) =>
Promise.resolve({
sort: false,
pagination: false
Expand Down
4 changes: 2 additions & 2 deletions backend/server/src/utils/token-factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class TokenFactory {
}
});
}).catch((error) => {
// this.core.logger.warn("Access token validation error:", error);
this.core.logger.warn("Access token validation error:", error);
return false;
});
}
Expand Down Expand Up @@ -117,7 +117,7 @@ class TokenFactory {
}
});
}).catch((error) => {
// this.core.logger.warn("Refresh token validation error:", error);
this.core.logger.warn("Refresh token validation error:", error);
return false;
});
}
Expand Down
2 changes: 1 addition & 1 deletion backend/server/src/utils/vfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ const parseFormData = (req, { maxFieldsSize, maxFileSize }) => {
* @returns {Promise<any>}
*/
const parseFields = (config) =>
(req, res) => {
(req, _res) => {
if (["get", "head"].indexOf(req.method.toLowerCase()) !== -1) {
return Promise.resolve(parseGet(req));
}
Expand Down
6 changes: 3 additions & 3 deletions backend/server/src/vfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const parseRangeHeader = (range) => {
* @param {Request} req
* @param {Response} res
*/
const onDone = (req, res) => {
const onDone = (req, _res) => {
if (req.files) {
for (const fieldname in req.files) {
fs.unlink(req.files[fieldname].filepath, () => ({}));
Expand Down Expand Up @@ -230,7 +230,7 @@ const createRequestFactory = (findMountpoint) =>
* @returns {Boolean}
*/
const createCrossRequestFactory = (findMountpoint) =>
(getter, method, respond) =>
(getter, method, _respond) =>
async (req, res) => {
const [from, to, options] = [...getter(req, res), createOptions(req)];

Expand Down Expand Up @@ -346,7 +346,7 @@ module.exports = (core) => {
router.post("/archive", wrapper(methods.archive));

// Finally catch promise exceptions
router.use((error, req, res, next) => {
router.use((error, _req, res, _next) => {
const code = typeof error.code === "number"
? error.code
: errorCodes[error.code] || 400;
Expand Down
2 changes: 1 addition & 1 deletion development/cli/src/tasks/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const npmDirectories = (npmFile) =>
});

const realpaths = (list) =>
Promise.all(list.map((fn) => fs.realpath(fn).catch((err) => false))).then(
Promise.all(list.map((fn) => fs.realpath(fn).catch((_err) => false))).then(
(list) => list.filter((value) => value !== false)
);

Expand Down
6 changes: 3 additions & 3 deletions development/cli/src/templates/application/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ module.exports = (core, proc) => {
// When server initializes
async init() {
// HTTP Route example (see index.js)
routeAuthenticated("POST", proc.resource("/test"), (req, res) => {
routeAuthenticated("POST", proc.resource("/test"), (_req, res) => {
res.json({ hello: "World" });
});

// WebSocket Route example (see index.js)
// NOTE: This creates a new connection. You can use a core bound socket instead
core.app.ws(proc.resource("/socket"), (ws, req) => {
core.app.ws(proc.resource("/socket"), (ws, _req) => {
ws.send("Hello World");
});
},
Expand All @@ -23,7 +23,7 @@ module.exports = (core, proc) => {
destroy() {},

// When using an internally bound websocket, messages comes here
onmessage(ws, respond, args) {
onmessage(_ws, respond, _args) {
respond("Pong");
},
};
Expand Down
4 changes: 2 additions & 2 deletions development/cli/src/templates/auth/client.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const myAdapter = (core, config) => ({
const myAdapter = (_core, _config) => ({
async login(values) {
// You can transform the form values from login here if you want
return values;
Expand All @@ -9,7 +9,7 @@ const myAdapter = (core, config) => ({
return true;
},

async register(values) {
async register(_values) {
throw new Error("Registration not available");
},
});
Expand Down
8 changes: 4 additions & 4 deletions development/cli/src/templates/auth/server.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = (core, config) => ({
login(req, res) {
module.exports = (_core, _config) => ({
login(req, _res) {
const { username } = req.body;

return {
Expand All @@ -8,11 +8,11 @@ module.exports = (core, config) => ({
};
},

logout(req, res) {
logout(_req, _res) {
return true;
},

register(req, res) {
register(_req, _res) {
throw new Error("Registration not available");
},
});
4 changes: 2 additions & 2 deletions development/cli/src/templates/settings/client.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const myAdapter = (core, options) => ({
const myAdapter = (_core, _options) => ({
// Create your own request here with 'values' settings
save(values) {
save(_values) {
return true;
},

Expand Down
6 changes: 3 additions & 3 deletions development/cli/src/templates/settings/server.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module.exports = (core, options) => ({
module.exports = (_core, _options) => ({
// req.body has all settings from client
async save(req, res) {
async save(_req, _res) {
return true;
},

// return all settings for user here
async load(req, res) {
async load(_req, _res) {
return {};
},
});
4 changes: 2 additions & 2 deletions development/cli/src/templates/vfs/client.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const myAdapter = (core) => ({
readdir: (path, options) => [],
const myAdapter = (_core) => ({
readdir: (_path, _options) => [],
});

export default myAdapter;
4 changes: 2 additions & 2 deletions development/cli/src/templates/vfs/server.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = (core) => ({
readdir: (vfs) => (path) => [],
module.exports = (_core) => ({
readdir: (_vfs) => (_path) => [],
});
2 changes: 1 addition & 1 deletion development/iconThemePlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class IconThemePlugin {
const imageTypes = ["png", "jpg", "jpeg", "gif", "svg", "webp"];
metadata.icons = Object.fromEntries(
iconEntries.filter(
([name, ext]) => imageTypes.includes(ext)
([_name, ext]) => imageTypes.includes(ext)
)
);

Expand Down
2 changes: 1 addition & 1 deletion frontend/client/__tests__/vfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const otherMount = {
};

const testAdapter = Object.assign({}, nullAdapter, {
readdir: (path, options) =>
readdir: (_path, _options) =>
Promise.resolve([
{
isDirectory: false,
Expand Down
2 changes: 0 additions & 2 deletions frontend/client/__tests__/window.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,6 @@ describe("Window", () => {
});

test("#_setState", () => {
const toggleEvent = jest.fn(() => {});

win.setState("focused", true);
expect(win.state.focused).toBe(true);

Expand Down
2 changes: 1 addition & 1 deletion frontend/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@meese-os/client",
"version": "1.0.6",
"version": "1.0.7",
"description": "meeseOS client",
"scripts": {
"test": "npm run eslint && npm run stylelint && npm run jest",
Expand Down
2 changes: 1 addition & 1 deletion frontend/client/src/adapters/auth/localstorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* @param {Core} core MeeseOS Core instance reference
* @param {Object} [options] Adapter options
*/
const localStorageAuth = (core, options) => ({
const localStorageAuth = (_core, _options) => ({
login: (values) => Promise.resolve(values),
});

Expand Down
2 changes: 1 addition & 1 deletion frontend/client/src/adapters/auth/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* @param {Core} core MeeseOS Core instance reference
* @param {Object} [options] Adapter options
*/
const serverAuth = (core, options) => {
const serverAuth = (core, _options) => {
const request = (endpoint, params = {}) =>
core.request(
endpoint,
Expand Down
10 changes: 5 additions & 5 deletions frontend/client/src/adapters/ui/iconview.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const createShortcuts = (root, readfile, writefile) => {

return readfile(filename)
.then((contents) => JSON.parse(contents))
.catch((error) => []);
.catch((_error) => []);
};

const write = (shortcuts) => {
Expand Down Expand Up @@ -294,12 +294,12 @@ export class DesktopIconView extends EventEmitter {

selectEntry: ({ index }) => ({ selected: index }),

uploadEntries: (files) => {
uploadEntries: (_files) => {
// TODO
},

addEntry: ({ entry, shortcut }) =>
(state, actions) => {
(_state, actions) => {
const dest = `${root}/${entry.filename}`;

mkdir(root)
Expand All @@ -319,7 +319,7 @@ export class DesktopIconView extends EventEmitter {
},

removeEntry: (entry) =>
(state, actions) => {
(_state, actions) => {
if (entry.shortcut !== false) {
shortcuts
.remove(entry.shortcut)
Expand All @@ -335,7 +335,7 @@ export class DesktopIconView extends EventEmitter {
},

reload: (fromUI) =>
(state, actions) => {
(_state, actions) => {
if (fromUI && this.core.config("vfs.watch")) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/client/src/adapters/vfs/apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const adapter = (core) => {
const pkgs = core.make("meeseOS/packages");

return {
readdir: ({ path }, options) => {
readdir: ({ path }, _options) => {
return Promise.resolve(pkgs.getPackages()).then((pkgs) =>
pkgs.map((pkg) => ({
isDirectory: false,
Expand Down
Loading

0 comments on commit 319cf64

Please sign in to comment.