diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ecf2f78..b70e2e6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,6 +14,7 @@ jobs: - run: npm ci - run: npm run build - run: npm run test + - run: npm run lint - uses: actions/upload-artifact@v4 with: name: dist diff --git a/.oxlintrc.json b/.oxlintrc.json new file mode 100644 index 0000000..7d0389b --- /dev/null +++ b/.oxlintrc.json @@ -0,0 +1,9 @@ +{ + "$schema": "./node_modules/oxlint/configuration_schema.json", + "plugins": [ + "react" + ], + "rules": { + "eslint/no-unused-vars": "allow", + } +} \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 897af65..9f1e4b8 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,5 +1,6 @@ { "recommendations": [ - "dbaeumer.vscode-eslint" + "dbaeumer.vscode-eslint", + "oxc.oxc-vscode" ] } \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index f559eba..749f2f4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,5 +7,6 @@ "editor.formatOnSave": true, "editor.defaultFormatter": "vscode.typescript-language-features" }, - "typescript.format.semicolons": "insert" + "typescript.format.semicolons": "insert", + "oxc.typeAware": true } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 558bfd6..b09bc95 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,6 +29,8 @@ "@types/react-dom": "^19.2.3", "@vitejs/plugin-react": "^5.1.4", "globals": "^17.3.0", + "oxlint": "^1.47.0", + "oxlint-tsgolint": "^0.13.0", "typescript": "~5.9.3", "vite": "^7.3.1", "vite-plugin-comlink": "^5.3.0", @@ -1591,6 +1593,413 @@ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, + "node_modules/@oxlint-tsgolint/darwin-arm64": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/darwin-arm64/-/darwin-arm64-0.13.0.tgz", + "integrity": "sha512-OWQ3U+oDjjupmX0WU9oYyKF2iUOKDMLW/+zan0cd0vYIGId80xTRHHA8oXnREmK8dsMMP3nV3VXME3NH/hS0lw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@oxlint-tsgolint/darwin-x64": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/darwin-x64/-/darwin-x64-0.13.0.tgz", + "integrity": "sha512-wZvgj+eVqNkCUjSq2ExlMdbGDpZfaw6J+YctQV1pkGFdn7Y9cySWdfwu5v/AW2JPsJbFMXJ8GAr+WoZbRapz2A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@oxlint-tsgolint/linux-arm64": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/linux-arm64/-/linux-arm64-0.13.0.tgz", + "integrity": "sha512-nwtf5BgHbAWSVwyIF00l6QpfyFcpDMp6D+3cpe6NTgBYMSSSC0Ip1gswUwzVccOPoQK48t+J6vHyURQ96M1KDg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxlint-tsgolint/linux-x64": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/linux-x64/-/linux-x64-0.13.0.tgz", + "integrity": "sha512-Rkzgj38eVoGSBuGDaCrALS4FM19+m1Qlv0hjB4MWvXUej014XkB5ze+svYE3HX+AAm1ey9QYj/CQzfz203FPIg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxlint-tsgolint/win32-arm64": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/win32-arm64/-/win32-arm64-0.13.0.tgz", + "integrity": "sha512-Y+0hFqLT5M7UIvGvTR3QFK27l17FqXk6UwwpBFOcyBGJ5bLd1RaAPWjqTmcgPvdolA6FCMeW1pxZuNtKDlYd7A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@oxlint-tsgolint/win32-x64": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/win32-x64/-/win32-x64-0.13.0.tgz", + "integrity": "sha512-mXjTttzyyfl8d/XvxggmZFBq0pbQmRvHbjQEv70YECNaLEHG8j8WYUwLa641uudAnV1VoBI34pc7bmgJM7qhOA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@oxlint/binding-android-arm-eabi": { + "version": "1.47.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-android-arm-eabi/-/binding-android-arm-eabi-1.47.0.tgz", + "integrity": "sha512-UHqo3te9K/fh29brCuQdHjN+kfpIi9cnTPABuD5S9wb9ykXYRGTOOMVuSV/CK43sOhU4wwb2nT1RVjcbrrQjFw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-android-arm64": { + "version": "1.47.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-android-arm64/-/binding-android-arm64-1.47.0.tgz", + "integrity": "sha512-xh02lsTF1TAkR+SZrRMYHR/xCx8Wg2MAHxJNdHVpAKELh9/yE9h4LJeqAOBbIb3YYn8o/D97U9VmkvkfJfrHfw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-darwin-arm64": { + "version": "1.47.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-darwin-arm64/-/binding-darwin-arm64-1.47.0.tgz", + "integrity": "sha512-OSOfNJqabOYbkyQDGT5pdoL+05qgyrmlQrvtCO58M4iKGEQ/xf3XkkKj7ws+hO+k8Y4VF4zGlBsJlwqy7qBcHA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-darwin-x64": { + "version": "1.47.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-darwin-x64/-/binding-darwin-x64-1.47.0.tgz", + "integrity": "sha512-hP2bOI4IWNS+F6pVXWtRshSTuJ1qCRZgDgVUg6EBUqsRy+ExkEPJkx+YmIuxgdCduYK1LKptLNFuQLJP8voPbQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-freebsd-x64": { + "version": "1.47.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-freebsd-x64/-/binding-freebsd-x64-1.47.0.tgz", + "integrity": "sha512-F55jIEH5xmGu7S661Uho8vGiLFk0bY3A/g4J8CTKiLJnYu/PSMZ2WxFoy5Hji6qvFuujrrM9Q8XXbMO0fKOYPg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-arm-gnueabihf": { + "version": "1.47.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.47.0.tgz", + "integrity": "sha512-wxmOn/wns/WKPXUC1fo5mu9pMZPVOu8hsynaVDrgmmXMdHKS7on6bA5cPauFFN9tJXNdsjW26AK9lpfu3IfHBQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-arm-musleabihf": { + "version": "1.47.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-1.47.0.tgz", + "integrity": "sha512-KJTmVIA/GqRlM2K+ZROH30VMdydEU7bDTY35fNg3tOPzQRIs2deLZlY/9JWwdWo1F/9mIYmpbdCmPqtKhWNOPg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-arm64-gnu": { + "version": "1.47.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.47.0.tgz", + "integrity": "sha512-PF7ELcFg1GVlS0X0ZB6aWiXobjLrAKer3T8YEkwIoO8RwWiAMkL3n3gbleg895BuZkHVlJ2kPRUwfrhHrVkD1A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-arm64-musl": { + "version": "1.47.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.47.0.tgz", + "integrity": "sha512-4BezLRO5cu0asf0Jp1gkrnn2OHiXrPPPEfBTxq1k5/yJ2zdGGTmZxHD2KF2voR23wb8Elyu3iQawXo7wvIZq0Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-ppc64-gnu": { + "version": "1.47.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.47.0.tgz", + "integrity": "sha512-aI5ds9jq2CPDOvjeapiIj48T/vlWp+f4prkxs+FVzrmVN9BWIj0eqeJ/hV8WgXg79HVMIz9PU6deI2ki09bR1w==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-riscv64-gnu": { + "version": "1.47.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-1.47.0.tgz", + "integrity": "sha512-mO7ycp9Elvgt5EdGkQHCwJA6878xvo9tk+vlMfT1qg++UjvOMB8INsOCQIOH2IKErF/8/P21LULkdIrocMw9xA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-riscv64-musl": { + "version": "1.47.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-1.47.0.tgz", + "integrity": "sha512-24D0wsYT/7hDFn3Ow32m3/+QT/1ZwrUhShx4/wRDAmz11GQHOZ1k+/HBuK/MflebdnalmXWITcPEy4BWTi7TCA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-s390x-gnu": { + "version": "1.47.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.47.0.tgz", + "integrity": "sha512-8tPzPne882mtML/uy3mApvdCyuVOpthJ7xUv3b67gVfz63hOOM/bwO0cysSkPyYYFDFRn6/FnUb7Jhmsesntvg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-x64-gnu": { + "version": "1.47.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.47.0.tgz", + "integrity": "sha512-q58pIyGIzeffEBhEgbRxLFHmHfV9m7g1RnkLiahQuEvyjKNiJcvdHOwKH2BdgZxdzc99Cs6hF5xTa86X40WzPw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-x64-musl": { + "version": "1.47.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-x64-musl/-/binding-linux-x64-musl-1.47.0.tgz", + "integrity": "sha512-e7DiLZtETZUCwTa4EEHg9G+7g3pY+afCWXvSeMG7m0TQ29UHHxMARPaEQUE4mfKgSqIWnJaUk2iZzRPMRdga5g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-openharmony-arm64": { + "version": "1.47.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-openharmony-arm64/-/binding-openharmony-arm64-1.47.0.tgz", + "integrity": "sha512-3AFPfQ0WKMleT/bKd7zsks3xoawtZA6E/wKf0DjwysH7wUiMMJkNKXOzYq1R/00G98JFgSU1AkrlOQrSdNNhlg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-win32-arm64-msvc": { + "version": "1.47.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.47.0.tgz", + "integrity": "sha512-cLMVVM6TBxp+N7FldQJ2GQnkcLYEPGgiuEaXdvhgvSgODBk9ov3jed+khIXSAWtnFOW0wOnG3RjwqPh0rCuheA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-win32-ia32-msvc": { + "version": "1.47.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-1.47.0.tgz", + "integrity": "sha512-VpFOSzvTnld77/Edje3ZdHgZWnlTb5nVWXyTgjD3/DKF/6t5bRRbwn3z77zOdnGy44xAMvbyAwDNOSeOdVUmRA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-win32-x64-msvc": { + "version": "1.47.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.47.0.tgz", + "integrity": "sha512-+q8IWptxXx2HMTM6JluR67284t0h8X/oHJgqpxH1siowxPMqZeIpAcWCUq+tY+Rv2iQK8TUugjZnSBQAVV5CmA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, "node_modules/@playwright/test": { "version": "1.58.2", "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.58.2.tgz", @@ -4474,6 +4883,70 @@ ], "license": "MIT" }, + "node_modules/oxlint": { + "version": "1.47.0", + "resolved": "https://registry.npmjs.org/oxlint/-/oxlint-1.47.0.tgz", + "integrity": "sha512-v7xkK1iv1qdvTxJGclM97QzN8hHs5816AneFAQ0NGji1BMUquhiDAhXpMwp8+ls16uRVJtzVHxP9pAAXblDeGA==", + "dev": true, + "license": "MIT", + "bin": { + "oxlint": "bin/oxlint" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/sponsors/Boshen" + }, + "optionalDependencies": { + "@oxlint/binding-android-arm-eabi": "1.47.0", + "@oxlint/binding-android-arm64": "1.47.0", + "@oxlint/binding-darwin-arm64": "1.47.0", + "@oxlint/binding-darwin-x64": "1.47.0", + "@oxlint/binding-freebsd-x64": "1.47.0", + "@oxlint/binding-linux-arm-gnueabihf": "1.47.0", + "@oxlint/binding-linux-arm-musleabihf": "1.47.0", + "@oxlint/binding-linux-arm64-gnu": "1.47.0", + "@oxlint/binding-linux-arm64-musl": "1.47.0", + "@oxlint/binding-linux-ppc64-gnu": "1.47.0", + "@oxlint/binding-linux-riscv64-gnu": "1.47.0", + "@oxlint/binding-linux-riscv64-musl": "1.47.0", + "@oxlint/binding-linux-s390x-gnu": "1.47.0", + "@oxlint/binding-linux-x64-gnu": "1.47.0", + "@oxlint/binding-linux-x64-musl": "1.47.0", + "@oxlint/binding-openharmony-arm64": "1.47.0", + "@oxlint/binding-win32-arm64-msvc": "1.47.0", + "@oxlint/binding-win32-ia32-msvc": "1.47.0", + "@oxlint/binding-win32-x64-msvc": "1.47.0" + }, + "peerDependencies": { + "oxlint-tsgolint": ">=0.11.2" + }, + "peerDependenciesMeta": { + "oxlint-tsgolint": { + "optional": true + } + } + }, + "node_modules/oxlint-tsgolint": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/oxlint-tsgolint/-/oxlint-tsgolint-0.13.0.tgz", + "integrity": "sha512-VUOWP5T9R9RwuPLKvNgvhsjdPFVhr2k8no8ea84+KhDtYPmk9L/3StNP3WClyPOKJOT8bFlO3eyhTKxXK9+Oog==", + "dev": true, + "license": "MIT", + "peer": true, + "bin": { + "tsgolint": "bin/tsgolint.js" + }, + "optionalDependencies": { + "@oxlint-tsgolint/darwin-arm64": "0.13.0", + "@oxlint-tsgolint/darwin-x64": "0.13.0", + "@oxlint-tsgolint/linux-arm64": "0.13.0", + "@oxlint-tsgolint/linux-x64": "0.13.0", + "@oxlint-tsgolint/win32-arm64": "0.13.0", + "@oxlint-tsgolint/win32-x64": "0.13.0" + } + }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", diff --git a/package.json b/package.json index 38a0045..865c23d 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,9 @@ "test": "vitest run", "test:e2e": "playwright test", "test:e2e:ui": "playwright test --ui", - "test:e2e:debug": "playwright test --debug" + "test:e2e:debug": "playwright test --debug", + "lint": "oxlint --type-aware --deny-warnings", + "lint:fix": "oxlint --fix --type-aware --deny-warnings" }, "dependencies": { "@katana-project/zip": "^0.7.1", @@ -36,6 +38,8 @@ "@types/react-dom": "^19.2.3", "@vitejs/plugin-react": "^5.1.4", "globals": "^17.3.0", + "oxlint": "^1.47.0", + "oxlint-tsgolint": "^0.13.0", "typescript": "~5.9.3", "vite": "^7.3.1", "vite-plugin-comlink": "^5.3.0", diff --git a/src/javadoc/api/JavadocApi.ts b/src/javadoc/api/JavadocApi.ts index 63bed53..c10894e 100644 --- a/src/javadoc/api/JavadocApi.ts +++ b/src/javadoc/api/JavadocApi.ts @@ -70,7 +70,7 @@ class JavadocApi { } options.headers = { - ...options.headers, + ...(options.headers as Record), 'Authorization': `Bearer ${this.accessToken.value}`, 'Content-Type': 'application/json' }; @@ -83,7 +83,7 @@ class JavadocApi { // Retry the request with the new token options.headers = { - ...options.headers, + ...(options.headers as Record), 'Authorization': `Bearer ${this.accessToken.value}`, 'Content-Type': 'application/json' }; diff --git a/src/logic/Inheritance.ts b/src/logic/Inheritance.ts index 7d958d0..0e09bf3 100644 --- a/src/logic/Inheritance.ts +++ b/src/logic/Inheritance.ts @@ -13,6 +13,7 @@ export class ClassNode { } getRoot(): ClassNode { + // oxlint-disable-next-line typescript/no-this-alias let n: ClassNode = this; while (n.parents.length > 0) { @@ -65,7 +66,7 @@ export const inheritanceIndex = combineLatest([jarIndex, minecraftJar]).pipe( const index = new InheritanceIndex(); const classDataArray = await jarIndexInstance.getClassData(); - + const classNames = new Set( Object.keys(jarInstance.jar.entries) .filter(name => name.endsWith(".class")) diff --git a/src/logic/MinecraftApi.ts b/src/logic/MinecraftApi.ts index c1a9fa3..16273c2 100644 --- a/src/logic/MinecraftApi.ts +++ b/src/logic/MinecraftApi.ts @@ -118,7 +118,7 @@ async function cachedFetch(url: string): Promise { const response = await fetch(url); if (response.ok) { - cache.put(url, response.clone()); + await cache.put(url, response.clone()); } return response; } diff --git a/src/logic/Settings.ts b/src/logic/Settings.ts index 00c66f7..8561eb5 100644 --- a/src/logic/Settings.ts +++ b/src/logic/Settings.ts @@ -1,3 +1,4 @@ +// oxlint-disable typescript/no-redundant-type-constituents import { BehaviorSubject, combineLatest, distinctUntilChanged, map, Observable, switchMap } from "rxjs"; import * as decompiler from "../workers/decompile/client"; diff --git a/src/ui/Code.tsx b/src/ui/Code.tsx index 3bfebdb..328b035 100644 --- a/src/ui/Code.tsx +++ b/src/ui/Code.tsx @@ -142,7 +142,7 @@ const Code = () => { hoverProvider.dispose(); definitionProvider.dispose(); }; - }, [monaco, decompileResult, classList, resetViewTrigger]); + }, [monaco, decompileResult, classList, resetViewTrigger, messageApi]); if (IS_JAVADOC_EDITOR) { useEffect(() => { @@ -153,6 +153,7 @@ const Code = () => { return () => { extensions.dispose(); }; + // oxlint-disable-next-line eslint-plugin-react-hooks/exhaustive-deps }, [monaco, editorRef.current, decompileResult]); } @@ -264,6 +265,7 @@ const Code = () => { sub.unsubscribe(); sub2.unsubscribe(); }; + // oxlint-disable-next-line eslint-plugin-react-hooks/exhaustive-deps }, []); // Handles setting the model and viewstate of the editor @@ -303,7 +305,8 @@ const Code = () => { } } applyTokenDecorations(tab.model!); - }, [decompileResult, resetViewTrigger, selectedLine]); + // oxlint-disable-next-line eslint-plugin-react-hooks/exhaustive-deps + }, [decompileResult, resetViewTrigger, selectedLine, monaco]); // Process pending token jumps after model is loaded useEffect(() => { @@ -344,6 +347,7 @@ const Code = () => { return () => { onMouseDown.dispose(); }; + // oxlint-disable-next-line eslint-plugin-react-hooks/exhaustive-deps }, [editorRef.current, selectedLine]); return ( diff --git a/src/ui/FileList.tsx b/src/ui/FileList.tsx index d493b15..a2063a5 100644 --- a/src/ui/FileList.tsx +++ b/src/ui/FileList.tsx @@ -1,7 +1,8 @@ +// oxlint-disable typescript/no-base-to-string import { Tree, Dropdown, message } from 'antd'; import type { TreeDataNode, TreeProps, MenuProps } from 'antd'; import { CaretDownFilled } from '@ant-design/icons'; -import { BehaviorSubject, combineLatest, map, Observable, shareReplay } from 'rxjs'; +import { combineLatest, from, map, Observable, shareReplay, switchMap, startWith } from 'rxjs'; import { classesList } from '../logic/JarFile'; import { useObservable } from '../utils/UseObservable'; import { useCallback, useEffect, useMemo, useState } from 'react'; @@ -14,17 +15,18 @@ import { compactPackages } from '../logic/Settings'; import { jarIndex, type ClassData } from '../workers/JarIndex'; import { ClassDataIcon, JavaIcon, PackageIcon } from './intellij-icons'; -const classData = new BehaviorSubject | null>(null); -jarIndex.subscribe(jarIndex => { - classData.next(null); - jarIndex.getClassData().then(classes => { +const classData: Observable | null> = jarIndex.pipe( + switchMap(jarIndex => from(jarIndex.getClassData())), + map(classes => { const map = new Map(); for (const data of classes) { map.set(data.className, data); } - classData.next(map); - }); -}); + return map; + }), + startWith(null), + shareReplay(1) +); const fileTree: Observable = combineLatest([ classesList, @@ -72,19 +74,19 @@ const fileTree: Observable = combineLatest([ }); } - function traverse(dir: string, prefix: string, parent: TreeDataNode) { + function traverse(dir: string, parent: TreeDataNode) { const nodes = dirs.get(dir)!; if (compact && nodes.length === 1 && !nodes[0].isLeaf) { const node = nodes[0]; - parent.title = `${parent.title}/${node.title}`; - traverse(node.key as string, prefix, parent); + parent.title = `${parent.title?.toString()}/${node.title?.toString()}`; + traverse(node.key as string, parent); } else { for (const node of nodes) { parent.children!.push(node); if (!node.isLeaf) { - traverse(node.key as string, prefix, node); + traverse(node.key as string, node); }; } } @@ -97,7 +99,7 @@ const fileTree: Observable = combineLatest([ } const root: TreeDataNode[] = []; - traverse('', '', { title: '', key: '', children: root }); + traverse('', { title: '', key: '', children: root }); return root; }), @@ -173,7 +175,7 @@ const getMenuItems = ( key: 'copy-package-path', label: renderLabel('Copy Package Path', packagePath), onClick: () => { - navigator.clipboard.writeText(packagePath); + void navigator.clipboard.writeText(packagePath); message.success('Package Path copied'); } }, @@ -181,7 +183,7 @@ const getMenuItems = ( key: 'copy-path', label: renderLabel('Copy Path', path), onClick: () => { - navigator.clipboard.writeText(path); + void navigator.clipboard.writeText(path); message.success('Path copied'); } }, @@ -189,7 +191,7 @@ const getMenuItems = ( key: 'copy-filename', label: renderLabel('Copy Filename', filename), onClick: () => { - navigator.clipboard.writeText(filename); + void navigator.clipboard.writeText(filename); message.success('Filename copied'); } }, @@ -198,7 +200,7 @@ const getMenuItems = ( label: renderLabel('Copy Link', link), onClick: () => { if (link) { - navigator.clipboard.writeText(link); + void navigator.clipboard.writeText(link); message.success('Link copied'); } }, @@ -260,7 +262,7 @@ const FileList = () => { const menuItems = useMemo(() => getMenuItems(contextMenu, (path) => { if (jar) { - handleCopyContent(path, jar); + void handleCopyContent(path, jar); } }, jar), [contextMenu, jar]); diff --git a/src/ui/IndexProgressNotification.tsx b/src/ui/IndexProgressNotification.tsx index 2e17506..5e0f871 100644 --- a/src/ui/IndexProgressNotification.tsx +++ b/src/ui/IndexProgressNotification.tsx @@ -37,7 +37,7 @@ const IndexProgressNotification = () => { return () => { sub.unsubscribe(); }; - }, []); + }, [notificationApi]); return contextHolder; }; diff --git a/src/ui/JarDecompilerModal.tsx b/src/ui/JarDecompilerModal.tsx index 4a881e3..d99e2ae 100644 --- a/src/ui/JarDecompilerModal.tsx +++ b/src/ui/JarDecompilerModal.tsx @@ -36,7 +36,7 @@ export const JarDecompilerModal = () => { const start = performance.now(); taskSubject.next(task); - task.start().then((total) => { + void task.start().then((total) => { const elapsed = (performance.now() - start) / 1000; modalApi.info({ bodyProps: { "data-testid": "jar-decompiler-result" }, @@ -53,7 +53,7 @@ export const JarDecompilerModal = () => { const clearCache = () => { if (!jar) return; - deleteCache().then(c => messageApi.open({ type: "success", content: `Deleted ${c} clasess from cache.` })); + void deleteCache().then(c => messageApi.open({ type: "success", content: `Deleted ${c} clasess from cache.` })); }; return ( diff --git a/src/ui/inheritance/InheritanceGraph.tsx b/src/ui/inheritance/InheritanceGraph.tsx index 208ca11..e4d7193 100644 --- a/src/ui/inheritance/InheritanceGraph.tsx +++ b/src/ui/inheritance/InheritanceGraph.tsx @@ -181,7 +181,7 @@ const InheritanceGraphInner = ({ data }: { data: ClassNode; }) => { const timer = setTimeout(() => { const selectedNode = getNode(data.name); if (selectedNode) { - setCenter( + void setCenter( selectedNode.position.x + 100, selectedNode.position.y + 25, { zoom: 1, duration: 300 } diff --git a/src/ui/intellij-icons/index.tsx b/src/ui/intellij-icons/index.tsx index 22d64c5..67b0150 100644 --- a/src/ui/intellij-icons/index.tsx +++ b/src/ui/intellij-icons/index.tsx @@ -62,6 +62,7 @@ export type ClassDataIconProps = IconProps & { data: ClassData; }; export const ClassDataIcon: React.FC = (p) => { const { className, accessFlags, superName } = p.data; + // oxlint-disable-next-line no-constant-binary-expression if (false || /^(.*\/)?package-info$/.test(className) || /^(.*\/)?module-info$/.test(className)) return ; @@ -70,6 +71,7 @@ export const ClassDataIcon: React.FC = (p) => { if ((accessFlags & ACC_INTERFACE) !== 0) return ; if ((accessFlags & ACC_ENUM) !== 0) return ; + // oxlint-disable-next-line no-constant-binary-expression if (false || superName === 'java/lang/Exception' || superName === 'java/lang/RuntimeException' diff --git a/src/utils/JavaBytecode.ts b/src/utils/JavaBytecode.ts index 38074bb..7c73300 100644 --- a/src/utils/JavaBytecode.ts +++ b/src/utils/JavaBytecode.ts @@ -52,7 +52,7 @@ export function setupJavaBytecodeLanguage(monaco: monaco): monaco_editor.IDispos [/[a-zA-Z_$][\w$/]*/, 'identifier'], // Operators and punctuation - [/[{}()\[\]]/, 'delimiter.bracket'], + [/[{}()[\]]/, 'delimiter.bracket'], [/[<>]/, 'delimiter.angle'], [/[:,.]/, 'delimiter'], ], diff --git a/src/workers/JarIndex.ts b/src/workers/JarIndex.ts index 8fdd14e..60c87f7 100644 --- a/src/workers/JarIndex.ts +++ b/src/workers/JarIndex.ts @@ -7,7 +7,8 @@ import Dexie, { type EntityTable } from "dexie"; export type Class = string; export type Method = `${string}:${string}:${string}`; export type Field = `${string}:${string}:${string}`; -export type ReferenceKey = Class | Method | Field; +// oxlint-disable-next-line typescript/no-redundant-type-constituents +export type ReferenceKey = Class | Method; export type ReferenceString = | `c:${Class}` @@ -127,14 +128,13 @@ export class JarIndex { for (let i = 0; i < this.workers.length; i++) { const worker = this.workers[i]; - promises.push(new Promise(async (resolve) => { + promises.push((async () => { while (true) { const batch = taskQueue.splice(0, batchSize); if (batch.length === 0) { const indexed = await worker.getReferenceSize(); - resolve(indexed); - return; + return indexed; } await worker.indexBatch(batch); @@ -142,7 +142,7 @@ export class JarIndex { indexProgress.next(Math.round((completed / classNames.length) * 100)); } - })); + })()); } const indexedCounts = await Promise.all(promises); diff --git a/src/workers/decompile/client.ts b/src/workers/decompile/client.ts index 5284963..6796a0e 100644 --- a/src/workers/decompile/client.ts +++ b/src/workers/decompile/client.ts @@ -84,7 +84,7 @@ export function decompileEntireJar(jar: Jar, options?: DecompileEntireJarOptions async start() { try { const classNames = dJar.classes.filter(n => !n.includes("$")); - options?.logger?.("Decompiling...", 0, classNames.length) + options?.logger?.("Decompiling...", 0, classNames.length); const optThreads = Math.min(options?.threads ?? MAX_THREADS, MAX_THREADS); const optSplits = options?.splits ?? 100; @@ -102,7 +102,7 @@ export function decompileEntireJar(jar: Jar, options?: DecompileEntireJarOptions return total; } finally { // kill all workers - setRuntime(preferWasmRuntime); + await setRuntime(preferWasmRuntime); } }, stop() { diff --git a/vite.config.ts b/vite.config.ts index f4db200..f343fa7 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -12,6 +12,7 @@ export default defineConfig({ { name: 'suppress-wasm-warnings', configResolved(config) { + // oxlint-disable-next-line typescript/unbound-method const originalWarn = config.logger.warn; config.logger.warn = (msg, options) => { // Suppress WASM runtime externalization warnings