diff --git a/.gitpod.yml b/.gitpod.yml index d4458996e..9180e8aba 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -43,7 +43,7 @@ vscode: - eamodio.gitlens - graphQL.vscode-graphql - ZixuanChen.vitest-explorer - - esbenp.prettier-vscode + - oxc.oxc-vscode - prisma.prisma - bradlc.vscode-tailwindcss - streetsidesoftware.code-spell-checker diff --git a/.oxfmtrc.json b/.oxfmtrc.json new file mode 100644 index 000000000..4bddb6759 --- /dev/null +++ b/.oxfmtrc.json @@ -0,0 +1,5 @@ +{ + "$schema": "./node_modules/oxfmt/configuration_schema.json", + "semi": false, + "singleQuote": true +} diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index bd5535a60..000000000 --- a/.prettierignore +++ /dev/null @@ -1 +0,0 @@ -pnpm-lock.yaml diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 93e6f2745..000000000 --- a/.prettierrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "semi": false, - "singleQuote": true, - "singleAttributePerLine": true, - "plugins": ["prettier-plugin-organize-imports"] -} diff --git a/.vscode/launch.json b/.vscode/launch.json index 2099f98ab..7ce2db96a 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -44,10 +44,7 @@ "type": "pwa-node", "request": "launch", "name": "Server: nuxt", - "resolveSourceMapLocations": [ - "${workspaceFolder}/**", - "!**/node_modules/**" - ], + "resolveSourceMapLocations": ["${workspaceFolder}/**", "!**/node_modules/**"], "args": ["dev"], "osx": { "program": "${workspaceFolder}/node_modules/.bin/nuxt" diff --git a/config.ts b/config.ts index de73ce950..ec69d6f66 100644 --- a/config.ts +++ b/config.ts @@ -28,10 +28,7 @@ export enum Environment { /** * Taken from https://stackoverflow.com/a/41548441 */ -function enumFromStringValue( - enm: Record, - value: string, -): T | undefined { +function enumFromStringValue(enm: Record, value: string): T | undefined { return (Object.values(enm) as unknown as string[]).includes(value) ? (value as unknown as T) : undefined @@ -49,10 +46,7 @@ function getEnvironment(): Environment { if (process.env.NODE_ENV === undefined) return Environment.LocalDevelopment - return ( - enumFromStringValue(Environment, process.env.NODE_ENV) ?? - Environment.LocalDevelopment - ) + return enumFromStringValue(Environment, process.env.NODE_ENV) ?? Environment.LocalDevelopment } export interface Config { diff --git a/eslint.config.mjs b/eslint.config.mjs index e45e6b375..915b03e73 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,10 +1,7 @@ // @ts-check import graphqlPlugin from '@graphql-eslint/eslint-plugin' import vitest from '@vitest/eslint-plugin' -import { - defineConfigWithVueTs, - vueTsConfigs, -} from '@vue/eslint-config-typescript' +import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript' import oxlint from 'eslint-plugin-oxlint' import withNuxt from './.nuxt/eslint.config.mjs' @@ -27,14 +24,13 @@ export default withNuxt({ // https://github.com/vuejs/eslint-config-typescript // https://typescript-eslint.io/getting-started/typed-linting // @ts-expect-error: @vue/eslint-config-typescript has problems with the type - defineConfigWithVueTs( - vueTsConfigs.stylisticTypeChecked, - vueTsConfigs.strictTypeChecked, - ).map((config) => ({ - ...config, - // Activate ts rules only for ts files, otherwise they also apply to graphql -- which the parser doesn't understand - files: ['**/*.ts'], - })), + defineConfigWithVueTs(vueTsConfigs.stylisticTypeChecked, vueTsConfigs.strictTypeChecked).map( + (config) => ({ + ...config, + // Activate ts rules only for ts files, otherwise they also apply to graphql -- which the parser doesn't understand + files: ['**/*.ts'], + }), + ), ) .append({ // TS-specific rules @@ -55,10 +51,7 @@ export default withNuxt({ // TODO: Remove this once all errors are fixed '@typescript-eslint/no-redundant-type-constituents': 'warn', // Allow numbers in templates without explicit casting - '@typescript-eslint/restrict-template-expressions': [ - 'error', - { allowNumber: true }, - ], + '@typescript-eslint/restrict-template-expressions': ['error', { allowNumber: true }], // Use { type xyz } instead of type { xyz } for imports // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/consistent-type-specifier-style.md // Disabled due to https://github.com/import-js/eslint-plugin-import/issues/2675 diff --git a/package.json b/package.json index c7cf41612..6d0026dc0 100644 --- a/package.json +++ b/package.json @@ -30,10 +30,10 @@ "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:oxlint && pnpm lint:eslint && pnpm lint:prettier", + "lint": "pnpm lint:oxlint && pnpm lint:eslint && pnpm lint:oxfmt", "lint:oxlint": "oxlint", "lint:eslint": "eslint --report-unused-disable-directives .", - "lint:prettier": "prettier --check .", + "lint:oxfmt": "oxfmt --check", "postinstall": "nuxi prepare && pnpm generate", "test": "vitest", "test:integration": "vitest --project integration", @@ -135,10 +135,9 @@ "nuxt": "4.2.0", "nuxt-auth-utils": "0.5.25", "nuxt-graphql-server": "3.1.6", + "oxfmt": "^0.35.0", "oxlint": "1.50.0", "postinstall-postinstall": "2.1.0", - "prettier": "3.8.1", - "prettier-plugin-organize-imports": "4.3.0", "prisma": "7.4.2", "storybook": "10.2.13", "storybook-vue-addon": "0.6.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bdff56f23..43f148344 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -302,18 +302,15 @@ importers: nuxt-graphql-server: specifier: 3.1.6 version: 3.1.6(@babel/core@7.29.0)(graphql-sock@1.0.1(graphql@16.13.0))(graphql@16.13.0)(magicast@0.5.1) + oxfmt: + specifier: ^0.35.0 + version: 0.35.0 oxlint: specifier: 1.50.0 version: 1.50.0 postinstall-postinstall: specifier: 2.1.0 version: 2.1.0 - prettier: - specifier: 3.8.1 - version: 3.8.1 - prettier-plugin-organize-imports: - specifier: 4.3.0 - version: 4.3.0(prettier@3.8.1)(typescript@5.9.3)(vue-tsc@3.1.3(typescript@5.9.3)) prisma: specifier: 7.4.2 version: 7.4.2(patch_hash=22f9ed1367a51da7b629654ef417940954d4b9e53e7a618b5d23540e6392fabb)(@types/react@19.0.8)(better-sqlite3@12.6.2)(magicast@0.5.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(typescript@5.9.3) @@ -2750,6 +2747,128 @@ packages: cpu: [x64] os: [win32] + '@oxfmt/binding-android-arm-eabi@0.35.0': + resolution: {integrity: sha512-BaRKlM3DyG81y/xWTsE6gZiv89F/3pHe2BqX2H4JbiB8HNVlWWtplzgATAE5IDSdwChdeuWLDTQzJ92Lglw3ZA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [android] + + '@oxfmt/binding-android-arm64@0.35.0': + resolution: {integrity: sha512-/O+EbuAJYs6nde/anv+aID6uHsGQApyE9JtYBo/79KyU8e6RBN3DMbT0ix97y1SOnCglurmL2iZ+hlohjP2PnQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [android] + + '@oxfmt/binding-darwin-arm64@0.35.0': + resolution: {integrity: sha512-pGqRtqlNdn9d4VrmGUWVyQjkw79ryhI6je9y2jfqNUIZCfqceob+R97YYAoG7C5TFyt8ILdLVoN+L2vw/hSFyA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [darwin] + + '@oxfmt/binding-darwin-x64@0.35.0': + resolution: {integrity: sha512-8GmsDcSozTPjrCJeGpp+sCmS9+9V5yRrdEZ1p/sTWxPG5nYeAfSLuS0nuEYjXSO+CtdSbStIW6dxa+4NM58yRw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [darwin] + + '@oxfmt/binding-freebsd-x64@0.35.0': + resolution: {integrity: sha512-QyfKfTe0ytHpFKHAcHCGQEzN45QSqq1AHJOYYxQMgLM3KY4xu8OsXHpCnINjDsV4XGnQzczJDU9e04Zmd8XqIQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [freebsd] + + '@oxfmt/binding-linux-arm-gnueabihf@0.35.0': + resolution: {integrity: sha512-u+kv3JD6P3J38oOyUaiCqgY5TNESzBRZJ5lyZQ6c2czUW2v5SIN9E/KWWa9vxoc+P8AFXQFUVrdzGy1tK+nbPQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [linux] + + '@oxfmt/binding-linux-arm-musleabihf@0.35.0': + resolution: {integrity: sha512-1NiZroCiV57I7Pf8kOH4XGR366kW5zir3VfSMBU2D0V14GpYjiYmPYFAoJboZvp8ACnZKUReWyMkNKSa5ad58A==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [linux] + + '@oxfmt/binding-linux-arm64-gnu@0.35.0': + resolution: {integrity: sha512-7Q0Xeg7ZnW2nxnZ4R7aF6DEbCFls4skgHZg+I63XitpNvJCbVIU8MFOTZlvZGRsY9+rPgWPQGeUpLHlyx0wvMA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + libc: [glibc] + + '@oxfmt/binding-linux-arm64-musl@0.35.0': + resolution: {integrity: sha512-5Okqi+uhYFxwKz8hcnUftNNwdm8BCkf6GSCbcz9xJxYMm87k1E4p7PEmAAbhLTk7cjSdDre6TDL0pDzNX+Y22Q==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@oxfmt/binding-linux-ppc64-gnu@0.35.0': + resolution: {integrity: sha512-9k66pbZQXM/lBJWys3Xbc5yhl4JexyfqkEf/tvtq8976VIJnLAAL3M127xHA3ifYSqxdVHfVGTg84eiBHCGcNw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [ppc64] + os: [linux] + libc: [glibc] + + '@oxfmt/binding-linux-riscv64-gnu@0.35.0': + resolution: {integrity: sha512-aUcY9ofKPtjO52idT6t0SAQvEF6ctjzUQa1lLp7GDsRpSBvuTrBQGeq0rYKz3gN8dMIQ7mtMdGD9tT4LhR8jAQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [riscv64] + os: [linux] + libc: [glibc] + + '@oxfmt/binding-linux-riscv64-musl@0.35.0': + resolution: {integrity: sha512-C6yhY5Hvc2sGM+mCPek9ZLe5xRUOC/BvhAt2qIWFAeXMn4il04EYIjl3DsWiJr0xDMTJhvMOmD55xTRPlNp39w==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [riscv64] + os: [linux] + libc: [musl] + + '@oxfmt/binding-linux-s390x-gnu@0.35.0': + resolution: {integrity: sha512-RG2hlvOMK4OMZpO3mt8MpxLQ0AAezlFqhn5mI/g5YrVbPFyoCv9a34AAvbSJS501ocOxlFIRcKEuw5hFvddf9g==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [s390x] + os: [linux] + libc: [glibc] + + '@oxfmt/binding-linux-x64-gnu@0.35.0': + resolution: {integrity: sha512-wzmh90Pwvqj9xOKHJjkQYBpydRkaXG77ZvDz+iFDRRQpnqIEqGm5gmim2s6vnZIkDGsvKCuTdtxm0GFmBjM1+w==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + libc: [glibc] + + '@oxfmt/binding-linux-x64-musl@0.35.0': + resolution: {integrity: sha512-+HCqYCJPCUy5I+b2cf+gUVaApfgtoQT3HdnSg/l7NIcLHOhKstlYaGyrFZLmUpQt4WkFbpGKZZayG6zjRU0KFA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + libc: [musl] + + '@oxfmt/binding-openharmony-arm64@0.35.0': + resolution: {integrity: sha512-kFYmWfR9YL78XyO5ws+1dsxNvZoD973qfVMNFOS4e9bcHXGF7DvGC2tY5UDFwyMCeB33t3sDIuGONKggnVNSJA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [openharmony] + + '@oxfmt/binding-win32-arm64-msvc@0.35.0': + resolution: {integrity: sha512-uD/NGdM65eKNCDGyTGdO8e9n3IHX+wwuorBvEYrPJXhDXL9qz6gzddmXH8EN04ejUXUujlq4FsoSeCfbg0Y+Jg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [win32] + + '@oxfmt/binding-win32-ia32-msvc@0.35.0': + resolution: {integrity: sha512-oSRD2k8J2uxYDEKR2nAE/YTY9PobOEnhZgCmspHu0+yBQ665yH8lFErQVSTE7fcGJmJp/cC6322/gc8VFuQf7g==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [ia32] + os: [win32] + + '@oxfmt/binding-win32-x64-msvc@0.35.0': + resolution: {integrity: sha512-WCDJjlS95NboR0ugI2BEwzt1tYvRDorDRM9Lvctls1SLyKYuNRCyrPwp1urUPFBnwgBNn9p2/gnmo7gFMySRoQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [win32] + '@oxlint/binding-android-arm-eabi@1.50.0': resolution: {integrity: sha512-G7MRGk/6NCe+L8ntonRdZP7IkBfEpiZ/he3buLK6JkLgMHgJShXZ+BeOwADmspXez7U7F7L1Anf4xLSkLHiGTg==} engines: {node: ^20.19.0 || >=22.12.0} @@ -6097,10 +6216,6 @@ packages: debug: optional: true - foreground-child@3.3.0: - resolution: {integrity: sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==} - engines: {node: '>=14'} - foreground-child@3.3.1: resolution: {integrity: sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==} engines: {node: '>=14'} @@ -7914,6 +8029,11 @@ packages: peerDependencies: oxc-parser: '>=0.72.0' + oxfmt@0.35.0: + resolution: {integrity: sha512-QYeXWkP+aLt7utt5SLivNIk09glWx9QE235ODjgcEZ3sd1VMaUBSpLymh6ZRCA76gD2rMP4bXanUz/fx+nLM9Q==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true + oxlint@1.50.0: resolution: {integrity: sha512-iSJ4IZEICBma8cZX7kxIIz9PzsYLF2FaLAYN6RKu7VwRVKdu7RIgpP99bTZaGl//Yao7fsaGZLSEo5xBrI5ReQ==} engines: {node: ^20.19.0 || >=22.12.0} @@ -9363,6 +9483,10 @@ packages: resolution: {integrity: sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==} engines: {node: '>=12.0.0'} + tinypool@2.1.0: + resolution: {integrity: sha512-Pugqs6M0m7Lv1I7FtxN4aoyToKg1C4tu+/381vH35y8oENM/Ai7f7C4StcoK4/+BSw9ebcS8jRiVrORFKCALLw==} + engines: {node: ^20.0.0 || >=22.0.0} + tinyrainbow@2.0.0: resolution: {integrity: sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==} engines: {node: '>=14.0.0'} @@ -13979,6 +14103,63 @@ snapshots: '@oxc-transform/binding-win32-x64-msvc@0.95.0': optional: true + '@oxfmt/binding-android-arm-eabi@0.35.0': + optional: true + + '@oxfmt/binding-android-arm64@0.35.0': + optional: true + + '@oxfmt/binding-darwin-arm64@0.35.0': + optional: true + + '@oxfmt/binding-darwin-x64@0.35.0': + optional: true + + '@oxfmt/binding-freebsd-x64@0.35.0': + optional: true + + '@oxfmt/binding-linux-arm-gnueabihf@0.35.0': + optional: true + + '@oxfmt/binding-linux-arm-musleabihf@0.35.0': + optional: true + + '@oxfmt/binding-linux-arm64-gnu@0.35.0': + optional: true + + '@oxfmt/binding-linux-arm64-musl@0.35.0': + optional: true + + '@oxfmt/binding-linux-ppc64-gnu@0.35.0': + optional: true + + '@oxfmt/binding-linux-riscv64-gnu@0.35.0': + optional: true + + '@oxfmt/binding-linux-riscv64-musl@0.35.0': + optional: true + + '@oxfmt/binding-linux-s390x-gnu@0.35.0': + optional: true + + '@oxfmt/binding-linux-x64-gnu@0.35.0': + optional: true + + '@oxfmt/binding-linux-x64-musl@0.35.0': + optional: true + + '@oxfmt/binding-openharmony-arm64@0.35.0': + optional: true + + '@oxfmt/binding-win32-arm64-msvc@0.35.0': + optional: true + + '@oxfmt/binding-win32-ia32-msvc@0.35.0': + optional: true + + '@oxfmt/binding-win32-x64-msvc@0.35.0': + optional: true + '@oxlint/binding-android-arm-eabi@1.50.0': optional: true @@ -17528,11 +17709,6 @@ snapshots: follow-redirects@1.15.9: {} - foreground-child@3.3.0: - dependencies: - cross-spawn: 7.0.6 - signal-exit: 4.1.0 - foreground-child@3.3.1: dependencies: cross-spawn: 7.0.6 @@ -17646,7 +17822,7 @@ snapshots: glob@10.4.5: dependencies: - foreground-child: 3.3.0 + foreground-child: 3.3.1 jackspeak: 3.4.3 minimatch: 9.0.9 minipass: 7.1.2 @@ -19942,6 +20118,30 @@ snapshots: magic-regexp: 0.10.0 oxc-parser: 0.95.0 + oxfmt@0.35.0: + dependencies: + tinypool: 2.1.0 + optionalDependencies: + '@oxfmt/binding-android-arm-eabi': 0.35.0 + '@oxfmt/binding-android-arm64': 0.35.0 + '@oxfmt/binding-darwin-arm64': 0.35.0 + '@oxfmt/binding-darwin-x64': 0.35.0 + '@oxfmt/binding-freebsd-x64': 0.35.0 + '@oxfmt/binding-linux-arm-gnueabihf': 0.35.0 + '@oxfmt/binding-linux-arm-musleabihf': 0.35.0 + '@oxfmt/binding-linux-arm64-gnu': 0.35.0 + '@oxfmt/binding-linux-arm64-musl': 0.35.0 + '@oxfmt/binding-linux-ppc64-gnu': 0.35.0 + '@oxfmt/binding-linux-riscv64-gnu': 0.35.0 + '@oxfmt/binding-linux-riscv64-musl': 0.35.0 + '@oxfmt/binding-linux-s390x-gnu': 0.35.0 + '@oxfmt/binding-linux-x64-gnu': 0.35.0 + '@oxfmt/binding-linux-x64-musl': 0.35.0 + '@oxfmt/binding-openharmony-arm64': 0.35.0 + '@oxfmt/binding-win32-arm64-msvc': 0.35.0 + '@oxfmt/binding-win32-ia32-msvc': 0.35.0 + '@oxfmt/binding-win32-x64-msvc': 0.35.0 + oxlint@1.50.0: optionalDependencies: '@oxlint/binding-android-arm-eabi': 1.50.0 @@ -21560,6 +21760,8 @@ snapshots: fdir: 6.5.0(picomatch@4.0.3) picomatch: 4.0.3 + tinypool@2.1.0: {} + tinyrainbow@2.0.0: {} tinyrainbow@3.0.3: {} diff --git a/renovate.json5 b/renovate.json5 index 18b5f915a..8425faa52 100644 --- a/renovate.json5 +++ b/renovate.json5 @@ -78,12 +78,7 @@ groupName: 'vitest', }, { - matchPackageNames: [ - 'storybook', - '@storybook{/,}**', - 'storybook-**', - 'chromatic', - ], + matchPackageNames: ['storybook', '@storybook{/,}**', 'storybook-**', 'chromatic'], groupName: 'storybook', }, { diff --git a/vitest.config.ts b/vitest.config.ts index 01ed508fb..618f16818 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -13,8 +13,7 @@ export default defineConfig({ // Workaround for https://github.com/nuxt/test-utils/issues/1408 alias: { '~/': new URL(`./`, import.meta.url).pathname, - '#graphql/schema': new URL(`.nuxt/graphql-schema.mjs`, import.meta.url) - .pathname, + '#graphql/schema': new URL(`.nuxt/graphql-schema.mjs`, import.meta.url).pathname, }, }, test: {