From 5e645fcb9f682d76fa5caf0fe809eaa0c0b1fbde Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Wed, 2 Oct 2024 11:11:16 +0200 Subject: [PATCH] chore: add oxlint plugin (#2532) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### ๐Ÿ”— Linked issue ### ๐Ÿ“š Description Doesn't support super many rules yet, but is amazingly fast (and easier to config). We can investigate to remove eslint once typescript, vue and graphql rules are supported. Refs https://github.com/oxc-project/oxc/issues/481 --- .eslintrc.cjs | 2 + .vscode/settings.json | 1 + middleware/authenticated.global.ts | 2 +- package.json | 5 +- pnpm-lock.yaml | 93 ++++++++++++++++++++++++++++++ 5 files changed, 101 insertions(+), 2 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 72bead132..04a055947 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -9,6 +9,8 @@ module.exports = { 'plugin:nuxt/recommended', // Turns off all rules that are unnecessary or might conflict with Prettier (needs to be last) 'prettier', + // Disable rules covered by oxlint + 'plugin:oxlint/recommended', ], plugins: ['unused-imports'], rules: { diff --git a/.vscode/settings.json b/.vscode/settings.json index 19977e72c..4d40527b6 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -12,6 +12,7 @@ "journaltitle", "Nuxt", "nuxtjs", + "oxlint", "scimago", "transpiled", "tsyringe", diff --git a/middleware/authenticated.global.ts b/middleware/authenticated.global.ts index bce4d5571..f2aa3bf89 100644 --- a/middleware/authenticated.global.ts +++ b/middleware/authenticated.global.ts @@ -26,7 +26,7 @@ export default defineNuxtRouteMiddleware(async (to, _from) => { ) { return redirectToLogin() } - } catch (error) { + } catch { return redirectToLogin() } } diff --git a/package.json b/package.json index bda0c0e65..7c8fddf4d 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,8 @@ "graphql:generate:watch": "graphql-codegen-esm --watch", "graphql:validate": "graphql-inspector validate --apollo '{pages,components}/**/*.vue' 'server/**/*.graphql'", "docker:redis": "docker run -d --rm --name JabRefRedis -p 6380:6379 redis --requirepass jabref", - "lint": "pnpm lint:eslint && pnpm lint:prettier", + "lint": "pnpm lint:oxlint && pnpm lint:eslint && pnpm lint:prettier", + "lint:oxlint": "oxlint", "lint:eslint": "eslint --ext .ts,.js,.vue,.graphql --ignore-path .gitignore --report-unused-disable-directives .", "lint:prettier": "prettier --check .", "postinstall": "nuxi prepare && pnpm generate", @@ -133,6 +134,7 @@ "eslint-config-prettier": "9.1.0", "eslint-import-resolver-typescript": "3.6.1", "eslint-plugin-nuxt": "4.0.0", + "eslint-plugin-oxlint": "^0.9.9", "eslint-plugin-unused-imports": "3.2.0", "eslint-plugin-vitest": "0.5.4", "eslint-plugin-vue": "9.27.0", @@ -143,6 +145,7 @@ "nuxt": "3.12.4", "nuxt-graphql-server": "3.1.4", "nuxt-icon": "0.6.10", + "oxlint": "^0.9.9", "postinstall-postinstall": "2.1.0", "prettier": "3.3.3", "prettier-plugin-organize-imports": "4.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d675c84fd..47e0b44e3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -287,6 +287,9 @@ importers: eslint-plugin-nuxt: specifier: 4.0.0 version: 4.0.0(eslint@8.57.0) + eslint-plugin-oxlint: + specifier: ^0.9.9 + version: 0.9.9 eslint-plugin-unused-imports: specifier: 3.2.0 version: 3.2.0(@typescript-eslint/eslint-plugin@7.18.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0) @@ -317,6 +320,9 @@ importers: nuxt-icon: specifier: 0.6.10 version: 0.6.10(magicast@0.3.4)(rollup@4.20.0)(vite@5.4.0(@types/node@20.16.10)(terser@5.31.6))(vue@3.5.10(typescript@5.5.4)) + oxlint: + specifier: ^0.9.9 + version: 0.9.9 postinstall-postinstall: specifier: 2.1.0 version: 2.1.0 @@ -2688,6 +2694,46 @@ packages: '@one-ini/wasm@0.1.1': resolution: {integrity: sha512-XuySG1E38YScSJoMlqovLru4KTUNSjgVTIjyh7qMX6aNN5HY5Ct5LhRJdxO79JtTzKfzV/bnWpz+zquYrISsvw==} + '@oxlint/darwin-arm64@0.9.9': + resolution: {integrity: sha512-My2KfUByjRl49p0rr/Glx9Y/hjney1uFk0JXNjwHqYToHqO9fY/IZ6XT1fdw9sX+1hdpq9bmj88rnkpvu0/cRw==, tarball: https://registry.npmjs.org/@oxlint/darwin-arm64/-/darwin-arm64-0.9.9.tgz} + cpu: [arm64] + os: [darwin] + + '@oxlint/darwin-x64@0.9.9': + resolution: {integrity: sha512-k0r0t+MAzrk8yWs0nxyD9Skfb+Ozmu6HRMTJIsUTLV4AKMt9CZBlLVS0OXzXHi72AOHz3UUve5rXxevVVY9lHQ==, tarball: https://registry.npmjs.org/@oxlint/darwin-x64/-/darwin-x64-0.9.9.tgz} + cpu: [x64] + os: [darwin] + + '@oxlint/linux-arm64-gnu@0.9.9': + resolution: {integrity: sha512-atiotr1pN3rr0i7Ww3SpOEOvkFex97S8GwYmiTlSng0kp+FSIZD6Kjlr9k3oayf9RZUDRuAE4WptwV1KYLvIDw==, tarball: https://registry.npmjs.org/@oxlint/linux-arm64-gnu/-/linux-arm64-gnu-0.9.9.tgz} + cpu: [arm64] + os: [linux] + + '@oxlint/linux-arm64-musl@0.9.9': + resolution: {integrity: sha512-vmd6Eog6WiudMTT0Fa8u5N+47caaWF2KVUHOSEV/d/WauVx+ZOR9z1LEM+54AZwn3Z2TbtFOJDiz7iDukZPbfw==, tarball: https://registry.npmjs.org/@oxlint/linux-arm64-musl/-/linux-arm64-musl-0.9.9.tgz} + cpu: [arm64] + os: [linux] + + '@oxlint/linux-x64-gnu@0.9.9': + resolution: {integrity: sha512-AUmSRerK4VXIMcTYYk25KGoOU2/z+NGItUhI6nJgMFktrbF8MUD6hlf3vaQZNle454z7FDJNSjARM0bB+xpBiQ==, tarball: https://registry.npmjs.org/@oxlint/linux-x64-gnu/-/linux-x64-gnu-0.9.9.tgz} + cpu: [x64] + os: [linux] + + '@oxlint/linux-x64-musl@0.9.9': + resolution: {integrity: sha512-jQYIx5KUYbpXbXBFPgIwRPLSm3AO5wa+32BQYASIOCPcsPywV+HJKbQpzmWqXDYel6hrifmIxspgxHhGMlHJ1Q==, tarball: https://registry.npmjs.org/@oxlint/linux-x64-musl/-/linux-x64-musl-0.9.9.tgz} + cpu: [x64] + os: [linux] + + '@oxlint/win32-arm64@0.9.9': + resolution: {integrity: sha512-HSOztIKmiivfUAoxGx4qyerYV+aAXGvKbwWf8j4RorAEg2WWBdhVe9XHoSdqgYsOBi1515+YXxXiSRX3F/0xAg==, tarball: https://registry.npmjs.org/@oxlint/win32-arm64/-/win32-arm64-0.9.9.tgz} + cpu: [arm64] + os: [win32] + + '@oxlint/win32-x64@0.9.9': + resolution: {integrity: sha512-T1/tNxqoYd/MMqi1dhSVzAVL0ZINvXDBEQWm6OCSrrjRM6c9UQydTzsgLWfvm9uHWngcMuRGXhN3F+D6KEYs3w==, tarball: https://registry.npmjs.org/@oxlint/win32-x64/-/win32-x64-0.9.9.tgz} + cpu: [x64] + os: [win32] + '@parcel/watcher-android-arm64@2.4.1': resolution: {integrity: sha512-LOi/WTbbh3aTn2RYddrO8pnapixAziFl6SMxHM69r3tvdSm94JtCenaKgk1GRg5FJ5wpMCpHeW+7yqPlvZv7kg==} engines: {node: '>= 10.0.0'} @@ -5481,6 +5527,9 @@ packages: eslint-plugin-nuxt@4.0.0: resolution: {integrity: sha512-v3Vwdk8YKe52bAz8eSIDqQuTtfL/T1r9dSl1uhC5SyR5pgLxgKkQdxXVf/Bf6Ax7uyd9rHqiAuYVdqqDb7ILdA==} + eslint-plugin-oxlint@0.9.9: + resolution: {integrity: sha512-X5LYXFWGFvLlEXuMEggZJdQH6qWGkPRYh09C9Kv3Cq9eKmBjPnKJ8iyzmdiPsQ5N4Jh5q2O+HMf1SrYVp0NtVA==, tarball: https://registry.npmjs.org/eslint-plugin-oxlint/-/eslint-plugin-oxlint-0.9.9.tgz} + eslint-plugin-promise@6.6.0: resolution: {integrity: sha512-57Zzfw8G6+Gq7axm2Pdo3gW/Rx3h9Yywgn61uE/3elTCOePEHVrn2i5CdfBwA1BLK0Q0WqctICIUSqXZW/VprQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -7611,6 +7660,11 @@ packages: resolution: {integrity: sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==} engines: {node: '>=0.10.0'} + oxlint@0.9.9: + resolution: {integrity: sha512-EqUmSKgnU7KNCi29uFe5MQnUZ0GH569Inkry/e84k4lwVRv1QuDr4DHLpu0cXBN2atwhKf1Szk/3uxmB2qgPbw==, tarball: https://registry.npmjs.org/oxlint/-/oxlint-0.9.9.tgz} + engines: {node: '>=14.*'} + hasBin: true + p-event@4.2.0: resolution: {integrity: sha512-KXatOjCRXXkSePPb1Nbi0p0m+gQAwdlbhi4wQKJPI1HsMQS9g+Sqp2o+QHziPr7eYJyOZet836KoHEVM1mwOrQ==} engines: {node: '>=8'} @@ -13424,6 +13478,30 @@ snapshots: '@one-ini/wasm@0.1.1': {} + '@oxlint/darwin-arm64@0.9.9': + optional: true + + '@oxlint/darwin-x64@0.9.9': + optional: true + + '@oxlint/linux-arm64-gnu@0.9.9': + optional: true + + '@oxlint/linux-arm64-musl@0.9.9': + optional: true + + '@oxlint/linux-x64-gnu@0.9.9': + optional: true + + '@oxlint/linux-x64-musl@0.9.9': + optional: true + + '@oxlint/win32-arm64@0.9.9': + optional: true + + '@oxlint/win32-x64@0.9.9': + optional: true + '@parcel/watcher-android-arm64@2.4.1': optional: true @@ -16978,6 +17056,10 @@ snapshots: - eslint - supports-color + eslint-plugin-oxlint@0.9.9: + dependencies: + scule: 1.3.0 + eslint-plugin-promise@6.6.0(eslint@8.57.0): dependencies: eslint: 8.57.0 @@ -19847,6 +19929,17 @@ snapshots: os-tmpdir@1.0.2: {} + oxlint@0.9.9: + optionalDependencies: + '@oxlint/darwin-arm64': 0.9.9 + '@oxlint/darwin-x64': 0.9.9 + '@oxlint/linux-arm64-gnu': 0.9.9 + '@oxlint/linux-arm64-musl': 0.9.9 + '@oxlint/linux-x64-gnu': 0.9.9 + '@oxlint/linux-x64-musl': 0.9.9 + '@oxlint/win32-arm64': 0.9.9 + '@oxlint/win32-x64': 0.9.9 + p-event@4.2.0: dependencies: p-timeout: 3.2.0