aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.eslintignore3
-rw-r--r--eslint.config.js18
-rw-r--r--package.json60
-rw-r--r--tsconfig.json8
-rw-r--r--webAO/__tests__/downloadFile.test.ts6
-rw-r--r--webAO/__tests__/isAudio.test.ts3
-rw-r--r--webAO/dom/window.ts12
-rw-r--r--webpack.config.js5
8 files changed, 65 insertions, 50 deletions
diff --git a/.eslintignore b/.eslintignore
deleted file mode 100644
index 2f1e71b..0000000
--- a/.eslintignore
+++ /dev/null
@@ -1,3 +0,0 @@
-node_modules
-webAO/lib/
-webAO/golden/ \ No newline at end of file
diff --git a/eslint.config.js b/eslint.config.js
new file mode 100644
index 0000000..a8f4d4f
--- /dev/null
+++ b/eslint.config.js
@@ -0,0 +1,18 @@
+import { defineConfig, globalIgnores } from "eslint/config";
+import eslint from '@eslint/js';
+import tseslint from 'typescript-eslint';
+
+export default defineConfig([
+ eslint.configs.recommended,
+ tseslint.configs.recommended,
+ {
+ rules: {
+ "indent": ["warn", 2, {
+ "SwitchCase": 1,
+ }],
+ "no-plusplus": ["error", {
+ "allowForLoopAfterthoughts": true,
+ }],
+ },
+ }, globalIgnores(["**/node_modules", "webAO/lib/", "webAO/golden/", "dist/"])
+]);
diff --git a/package.json b/package.json
index b3da287..f666055 100644
--- a/package.json
+++ b/package.json
@@ -12,7 +12,7 @@
"start": "webpack serve --config webpack.config.js --mode development",
"lint": "eslint webAO --ext .js",
"lint:fix": "npm run lint -- --fix",
- "prepare": "husky install"
+ "prepare": "husky"
},
"repository": {
"type": "git",
@@ -24,42 +24,42 @@
},
"homepage": "https://github.com/AttorneyOnline/webAO#readme",
"devDependencies": {
- "@babel/core": "^7.28.5",
- "@babel/plugin-transform-modules-commonjs": "^7.27.1",
- "@babel/preset-env": "^7.28.5",
+ "@babel/core": "^7.29.0",
+ "@babel/plugin-transform-modules-commonjs": "^7.28.6",
+ "@babel/preset-env": "^7.29.2",
"@babel/preset-typescript": "^7.28.5",
- "@happy-dom/global-registrator": "^20.0.11",
- "@types/jest": "^29.5.14",
- "@types/node": "^18.19.130",
- "@typescript-eslint/eslint-plugin": "^6.21.0",
- "@typescript-eslint/parser": "^6.21.0",
- "babel-jest": "^30.2.0",
- "babel-loader": "^9.2.1",
- "copy-webpack-plugin": "^11.0.0",
- "dotenv": "^16.6.1",
- "eslint": "^8.57.1",
+ "@happy-dom/global-registrator": "^20.8.9",
+ "@types/jest": "^30.0.0",
+ "@types/node": "^25.5.2",
+ "@types/websocket": "^1.0.10",
+ "@typescript-eslint/eslint-plugin": "^8.58.0",
+ "@typescript-eslint/parser": "^8.58.0",
+ "babel-jest": "^30.3.0",
+ "babel-loader": "^10.1.1",
+ "copy-webpack-plugin": "^14.0.0",
+ "dotenv": "^17.4.1",
+ "eslint": "^10.2.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.32.0",
- "glob": "^7.2.3",
- "html-webpack-plugin": "^5.6.5",
- "husky": "^8.0.3",
- "jest": "^29.7.0",
- "typescript": "^5.9.3",
- "webpack": "^5.104.1",
- "webpack-cli": "^5.1.4",
- "webpack-dev-server": "^5.2.2",
+ "glob": "^13.0.6",
+ "html-webpack-plugin": "^5.6.6",
+ "husky": "^9.1.7",
+ "jest": "^30.3.0",
+ "typescript": "^6.0.2",
+ "webpack": "^5.105.4",
+ "webpack-cli": "^7.0.2",
+ "webpack-dev-server": "^5.2.3",
"workbox-webpack-plugin": "^7.4.0"
},
"dependencies": {
- "@fingerprintjs/fingerprintjs": "^3.4.2",
- "@types/websocket": "^1.0.10",
- "core-js": "^3.47.0",
- "esbuild-loader": "^4.4.2",
+ "@fingerprintjs/fingerprintjs": "^5.1.0",
+ "core-js": "^3.49.0",
+ "esbuild-loader": "^4.4.3",
"golden-layout": "^2.6.0",
- "jest-environment-jsdom": "^29.7.0",
- "regenerator-runtime": "^0.13.11",
- "source-map-loader": "^4.0.2",
- "ts-loader": "^9.5.4"
+ "jest-environment-jsdom": "^30.3.0",
+ "regenerator-runtime": "^0.14.1",
+ "source-map-loader": "^5.0.0",
+ "ts-loader": "^9.5.7"
},
"browserslist": [
"defaults",
diff --git a/tsconfig.json b/tsconfig.json
index f33e7c1..91508ff 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -2,13 +2,13 @@
"compilerOptions": {
"outDir": "./dist",
"allowJs": true,
- "target": "es5",
- "lib": ["DOM", "DOM.Iterable", "ES2021.String"],
+ "target": "es2022",
+ "lib": ["DOM", "ES2022"],
"strict": true,
"strictNullChecks": false, //document.getElementBy
- "downlevelIteration": true,
"resolveJsonModule": true,
- "esModuleInterop": true
+ "esModuleInterop": true,
+ "types": [ "node", "jest" ]
},
"include": ["./webAO/**/*"]
}
diff --git a/webAO/__tests__/downloadFile.test.ts b/webAO/__tests__/downloadFile.test.ts
index 738d6f3..67c2c46 100644
--- a/webAO/__tests__/downloadFile.test.ts
+++ b/webAO/__tests__/downloadFile.test.ts
@@ -2,7 +2,7 @@ import downloadFile from "../services/downloadFile";
jest.useFakeTimers().setSystemTime(new Date("2020-01-01").getTime());
global.URL.createObjectURL = jest.fn();
-(window as any).global.Blob = function (content, options) {
+(window as any).global.Blob = function (content: any, options: any) {
return { content, options };
};
@@ -10,7 +10,7 @@ describe("downloadFile", () => {
it("Creates an <a> tag", () => {
const createElementSpy = jest.spyOn(document, "createElement");
downloadFile("hi", "filename");
- expect(createElementSpy).toBeCalled();
+ expect(createElementSpy).toHaveBeenCalled();
});
it("Creates the blob with the correct data", () => {
const data = "writingtestsishard";
@@ -22,6 +22,6 @@ describe("downloadFile", () => {
type: "text",
},
};
- expect(global.URL.createObjectURL).toBeCalledWith(expected);
+ expect(global.URL.createObjectURL).toHaveBeenCalledWith(expected);
});
});
diff --git a/webAO/__tests__/isAudio.test.ts b/webAO/__tests__/isAudio.test.ts
index 327a0de..f5b84ef 100644
--- a/webAO/__tests__/isAudio.test.ts
+++ b/webAO/__tests__/isAudio.test.ts
@@ -19,11 +19,10 @@ describe('isAudio', () => {
expect(isAudio('')).toBe(false); // Empty string
expect(isAudio(undefined)).toBe(false); // Undefined input
expect(isAudio(null)).toBe(false); // Null input
- expect(isAudio({})).toBe(false); // Invalid type (object)
});
test('should return true for files with multiple valid extensions', () => {
expect(isAudio('file.wav.mp3')).toBe(true);
expect(isAudio('track.ogg.opus')).toBe(true);
});
-}); \ No newline at end of file
+});
diff --git a/webAO/dom/window.ts b/webAO/dom/window.ts
index ba19982..ac43a0a 100644
--- a/webAO/dom/window.ts
+++ b/webAO/dom/window.ts
@@ -25,7 +25,7 @@ declare global {
deleteEvidence: () => void;
editEvidence: () => void;
addEvidence: () => void;
- pickEvidence: (evidence: any) => void;
+ pickEvidence: (evidence: number) => void;
pickEmotion: (emo: number) => void;
pickChar: (ccharacter: any) => void;
chartable_filter: (_event: any) => void;
@@ -37,21 +37,21 @@ declare global {
changeCharacter: (_event: any) => void;
switchChatOffset: () => void;
switchAspectRatio: () => void;
- switchPanTilt: (addcheck: number) => void;
+ switchPanTilt: () => Promise<void>;
iniedit: () => void;
modcall_test: () => void;
reloadTheme: () => void;
changeCallwords: () => void;
changeBlipVolume: () => void;
- changeMusicVolume: () => void;
- area_click: (el: any) => void;
- showname_click: (_event: any) => void;
+ changeMusicVolume: (volume?: number) => void;
+ area_click: (el: HTMLElement) => void;
+ showname_click: (_event: Event | null) => void;
mutelist_click: (_event: any) => void;
musiclist_click: (_event: any) => void;
musiclist_filter: (_event: any) => void;
resetOffset: (_event: any) => void;
onEnter: (event: any) => void;
- onReplayGo: (_event: any) => void;
+ onReplayGo: (_event: Event) => void;
onOOCEnter: (_event: any) => void;
kickPlayer: (id: number) => void;
banPlayer: (id: number) => void;
diff --git a/webpack.config.js b/webpack.config.js
index 9a0064d..7194b4f 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -18,9 +18,9 @@ module.exports = {
master: "./webAO/master.ts",
dom: {
dependOn: "client",
- import: glob.sync("./webAO/dom/*.{js,ts}"),
+ import: glob.sync("./webAO/dom/*.{js,ts}", { "dotRelative": true }),
},
- components: glob.sync("./webAO/components/*.js"),
+ components: glob.sync("./webAO/components/*.js", { "dotRelative": true }),
},
node: {
global: true,
@@ -35,6 +35,7 @@ module.exports = {
},
compress: true,
port: 8080,
+ allowedHosts: "all",
},
mode: "production",
module: {