diff --git a/packages/pl-api/.eslintrc.json b/packages/pl-api/.eslintrc.json index 6bf945a6e..d3d44b71f 100644 --- a/packages/pl-api/.eslintrc.json +++ b/packages/pl-api/.eslintrc.json @@ -50,10 +50,7 @@ "ResizeObserver", "URL", "URLSearchParams" - ], - "tailwindcss": { - "config": "tailwind.config.ts" - } + ] }, "rules": { "brace-style": "error", diff --git a/packages/pl-api/package.json b/packages/pl-api/package.json index 9717800b4..525831e38 100644 --- a/packages/pl-api/package.json +++ b/packages/pl-api/package.json @@ -15,7 +15,8 @@ "build": "vite build", "watch": "vite build --watch", "preview": "vite preview", - "lint": "npx eslint --ext .js,.jsx,.cjs,.mjs,.ts,.tsx . --cache" + "lint": "oxlint", + "precommit": "lint-staged" }, "license": "AGPL-3.0-or-later", "devDependencies": { @@ -32,6 +33,7 @@ "eslint-plugin-compat": "6.0.2", "eslint-plugin-import": "^2.31.0", "eslint-plugin-promise": "^7.2.1", + "oxlint": "^1.47.0", "typedoc": "^0.28.7", "typedoc-material-theme": "^1.4.0", "typedoc-plugin-valibot": "^1.0.0", @@ -55,5 +57,8 @@ "types": "dist/main.d.ts", "files": [ "dist" - ] + ], + "lint-staged": { + "*.{js,cjs,mjs,ts,tsx}": "pnpm run lint" + } } diff --git a/packages/pl-fe/package.json b/packages/pl-fe/package.json index af0e933a0..b85b2ccb3 100644 --- a/packages/pl-fe/package.json +++ b/packages/pl-fe/package.json @@ -98,7 +98,7 @@ "lexical": "^0.39.0", "line-awesome": "^1.3.0", "localforage": "^1.10.0", - "lodash": "^4.17.23", + "lodash-es": "^4.17.23", "mini-css-extract-plugin": "^2.9.4", "mutative": "^1.3.0", "path-browserify": "^1.0.1", diff --git a/packages/pl-fe/src/build-config-compiletime.ts b/packages/pl-fe/src/build-config-compiletime.ts deleted file mode 100644 index 452bc0f63..000000000 --- a/packages/pl-fe/src/build-config-compiletime.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Build config: configuration set at build time. - * @module pl-fe/build-config - */ - -// eslint-disable-next-line import/extensions -import trim from 'lodash/trim.js'; -// eslint-disable-next-line import/extensions -import trimEnd from 'lodash/trimEnd.js'; - -const { - NODE_ENV, - BACKEND_URL, - FE_SUBDIRECTORY, - WITH_LANDING_PAGE, -} = process.env; - -const sanitizeURL = (url: string | undefined = ''): string => { - try { - return trimEnd(new URL(url).toString(), '/'); - } catch { - return ''; - } -}; - -const sanitizeBasename = (path: string | undefined = ''): string => `/${trim(path, '/')}`; - -const env = { - NODE_ENV: NODE_ENV || 'development', - BACKEND_URL: sanitizeURL(BACKEND_URL), - FE_SUBDIRECTORY: sanitizeBasename(FE_SUBDIRECTORY), - WITH_LANDING_PAGE: WITH_LANDING_PAGE === 'true', -}; - -export type PlFeEnv = typeof env; - -export default () => ({ - data: env, -}); diff --git a/packages/pl-fe/src/build-config.ts b/packages/pl-fe/src/build-config.ts index 448b407fc..c9416a059 100644 --- a/packages/pl-fe/src/build-config.ts +++ b/packages/pl-fe/src/build-config.ts @@ -3,11 +3,6 @@ * @module pl-fe/build-config */ -// eslint-disable-next-line import/extensions -import trim from 'lodash/trim.js'; -// eslint-disable-next-line import/extensions -import trimEnd from 'lodash/trimEnd.js'; - const env = compileTime(() => { const { NODE_ENV, @@ -18,13 +13,13 @@ const env = compileTime(() => { const sanitizeURL = (url: string | undefined = ''): string => { try { - return trimEnd(new URL(url).toString(), '/'); + return new URL(url).toString().replace(/\/+$/, ''); } catch { return ''; } }; - const sanitizeBasename = (path: string | undefined = ''): string => `/${trim(path, '/')}`; + const sanitizeBasename = (path: string | undefined = ''): string => `/${path.replace(/^\/+|\/+$/g, '')}`; return { NODE_ENV: NODE_ENV || 'development', diff --git a/packages/pl-fe/vite.config.ts b/packages/pl-fe/vite.config.ts index ec0e97947..7299eb968 100644 --- a/packages/pl-fe/vite.config.ts +++ b/packages/pl-fe/vite.config.ts @@ -12,7 +12,7 @@ import { VitePWA } from 'vite-plugin-pwa'; import vitePluginRequire from 'vite-plugin-require'; import { viteStaticCopy } from 'vite-plugin-static-copy'; -const config = defineConfig(({ command }) => ({ +const config = defineConfig(() => ({ build: { assetsDir: 'packs', assetsInlineLimit: 0, @@ -176,6 +176,10 @@ const config = defineConfig(({ command }) => ({ find: '@/', replacement: fileURLToPath(new URL('./src/', import.meta.url)), }, + { + find: 'lodash', + replacement: 'lodash-es', + }, ], dedupe: ['@floating-ui/react', 'tabbable', 'query-string', 'valibot'], }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c523169c3..cac6d549f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -91,6 +91,9 @@ importers: eslint-plugin-promise: specifier: ^7.2.1 version: 7.2.1(eslint@8.57.1) + oxlint: + specifier: ^1.47.0 + version: 1.47.0 typedoc: specifier: ^0.28.7 version: 0.28.9(typescript@5.9.2) @@ -304,7 +307,7 @@ importers: localforage: specifier: ^1.10.0 version: 1.10.0 - lodash: + lodash-es: specifier: ^4.17.23 version: 4.17.23 mini-css-extract-plugin: @@ -520,7 +523,7 @@ importers: version: 8.0.0-beta.14(@types/node@25.0.3)(esbuild@0.24.2)(jiti@1.21.7)(sass-embedded@1.93.3)(sass@1.93.3)(terser@5.46.0)(yaml@2.8.0) vite-plugin-checker: specifier: ^0.12.0 - version: 0.12.0(eslint@8.57.1)(meow@13.2.0)(optionator@0.9.4)(stylelint@16.23.0(typescript@5.7.3))(typescript@5.7.3)(vite@8.0.0-beta.14(@types/node@25.0.3)(esbuild@0.24.2)(jiti@1.21.7)(sass-embedded@1.93.3)(sass@1.93.3)(terser@5.46.0)(yaml@2.8.0)) + version: 0.12.0(eslint@8.57.1)(meow@13.2.0)(optionator@0.9.4)(oxlint@1.47.0)(stylelint@16.23.0(typescript@5.7.3))(typescript@5.7.3)(vite@8.0.0-beta.14(@types/node@25.0.3)(esbuild@0.24.2)(jiti@1.21.7)(sass-embedded@1.93.3)(sass@1.93.3)(terser@5.46.0)(yaml@2.8.0)) vite-plugin-compile-time: specifier: ^0.4.6 version: 0.4.6(vite@8.0.0-beta.14(@types/node@25.0.3)(esbuild@0.24.2)(jiti@1.21.7)(sass-embedded@1.93.3)(sass@1.93.3)(terser@5.46.0)(yaml@2.8.0)) @@ -1750,6 +1753,120 @@ packages: '@oxc-project/types@0.113.0': resolution: {integrity: sha512-Tp3XmgxwNQ9pEN9vxgJBAqdRamHibi76iowQ38O2I4PMpcvNRQNVsU2n1x1nv9yh0XoTrGFzf7cZSGxmixxrhA==} + '@oxlint/binding-android-arm-eabi@1.47.0': + resolution: {integrity: sha512-UHqo3te9K/fh29brCuQdHjN+kfpIi9cnTPABuD5S9wb9ykXYRGTOOMVuSV/CK43sOhU4wwb2nT1RVjcbrrQjFw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [android] + + '@oxlint/binding-android-arm64@1.47.0': + resolution: {integrity: sha512-xh02lsTF1TAkR+SZrRMYHR/xCx8Wg2MAHxJNdHVpAKELh9/yE9h4LJeqAOBbIb3YYn8o/D97U9VmkvkfJfrHfw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [android] + + '@oxlint/binding-darwin-arm64@1.47.0': + resolution: {integrity: sha512-OSOfNJqabOYbkyQDGT5pdoL+05qgyrmlQrvtCO58M4iKGEQ/xf3XkkKj7ws+hO+k8Y4VF4zGlBsJlwqy7qBcHA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [darwin] + + '@oxlint/binding-darwin-x64@1.47.0': + resolution: {integrity: sha512-hP2bOI4IWNS+F6pVXWtRshSTuJ1qCRZgDgVUg6EBUqsRy+ExkEPJkx+YmIuxgdCduYK1LKptLNFuQLJP8voPbQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [darwin] + + '@oxlint/binding-freebsd-x64@1.47.0': + resolution: {integrity: sha512-F55jIEH5xmGu7S661Uho8vGiLFk0bY3A/g4J8CTKiLJnYu/PSMZ2WxFoy5Hji6qvFuujrrM9Q8XXbMO0fKOYPg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [freebsd] + + '@oxlint/binding-linux-arm-gnueabihf@1.47.0': + resolution: {integrity: sha512-wxmOn/wns/WKPXUC1fo5mu9pMZPVOu8hsynaVDrgmmXMdHKS7on6bA5cPauFFN9tJXNdsjW26AK9lpfu3IfHBQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [linux] + + '@oxlint/binding-linux-arm-musleabihf@1.47.0': + resolution: {integrity: sha512-KJTmVIA/GqRlM2K+ZROH30VMdydEU7bDTY35fNg3tOPzQRIs2deLZlY/9JWwdWo1F/9mIYmpbdCmPqtKhWNOPg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [linux] + + '@oxlint/binding-linux-arm64-gnu@1.47.0': + resolution: {integrity: sha512-PF7ELcFg1GVlS0X0ZB6aWiXobjLrAKer3T8YEkwIoO8RwWiAMkL3n3gbleg895BuZkHVlJ2kPRUwfrhHrVkD1A==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + + '@oxlint/binding-linux-arm64-musl@1.47.0': + resolution: {integrity: sha512-4BezLRO5cu0asf0Jp1gkrnn2OHiXrPPPEfBTxq1k5/yJ2zdGGTmZxHD2KF2voR23wb8Elyu3iQawXo7wvIZq0Q==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + + '@oxlint/binding-linux-ppc64-gnu@1.47.0': + resolution: {integrity: sha512-aI5ds9jq2CPDOvjeapiIj48T/vlWp+f4prkxs+FVzrmVN9BWIj0eqeJ/hV8WgXg79HVMIz9PU6deI2ki09bR1w==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [ppc64] + os: [linux] + + '@oxlint/binding-linux-riscv64-gnu@1.47.0': + resolution: {integrity: sha512-mO7ycp9Elvgt5EdGkQHCwJA6878xvo9tk+vlMfT1qg++UjvOMB8INsOCQIOH2IKErF/8/P21LULkdIrocMw9xA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [riscv64] + os: [linux] + + '@oxlint/binding-linux-riscv64-musl@1.47.0': + resolution: {integrity: sha512-24D0wsYT/7hDFn3Ow32m3/+QT/1ZwrUhShx4/wRDAmz11GQHOZ1k+/HBuK/MflebdnalmXWITcPEy4BWTi7TCA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [riscv64] + os: [linux] + + '@oxlint/binding-linux-s390x-gnu@1.47.0': + resolution: {integrity: sha512-8tPzPne882mtML/uy3mApvdCyuVOpthJ7xUv3b67gVfz63hOOM/bwO0cysSkPyYYFDFRn6/FnUb7Jhmsesntvg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [s390x] + os: [linux] + + '@oxlint/binding-linux-x64-gnu@1.47.0': + resolution: {integrity: sha512-q58pIyGIzeffEBhEgbRxLFHmHfV9m7g1RnkLiahQuEvyjKNiJcvdHOwKH2BdgZxdzc99Cs6hF5xTa86X40WzPw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + + '@oxlint/binding-linux-x64-musl@1.47.0': + resolution: {integrity: sha512-e7DiLZtETZUCwTa4EEHg9G+7g3pY+afCWXvSeMG7m0TQ29UHHxMARPaEQUE4mfKgSqIWnJaUk2iZzRPMRdga5g==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + + '@oxlint/binding-openharmony-arm64@1.47.0': + resolution: {integrity: sha512-3AFPfQ0WKMleT/bKd7zsks3xoawtZA6E/wKf0DjwysH7wUiMMJkNKXOzYq1R/00G98JFgSU1AkrlOQrSdNNhlg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [openharmony] + + '@oxlint/binding-win32-arm64-msvc@1.47.0': + resolution: {integrity: sha512-cLMVVM6TBxp+N7FldQJ2GQnkcLYEPGgiuEaXdvhgvSgODBk9ov3jed+khIXSAWtnFOW0wOnG3RjwqPh0rCuheA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [win32] + + '@oxlint/binding-win32-ia32-msvc@1.47.0': + resolution: {integrity: sha512-VpFOSzvTnld77/Edje3ZdHgZWnlTb5nVWXyTgjD3/DKF/6t5bRRbwn3z77zOdnGy44xAMvbyAwDNOSeOdVUmRA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [ia32] + os: [win32] + + '@oxlint/binding-win32-x64-msvc@1.47.0': + resolution: {integrity: sha512-+q8IWptxXx2HMTM6JluR67284t0h8X/oHJgqpxH1siowxPMqZeIpAcWCUq+tY+Rv2iQK8TUugjZnSBQAVV5CmA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [win32] + '@parcel/watcher-android-arm64@2.5.1': resolution: {integrity: sha512-KF8+j9nNbUN8vzOFDpRMsaKBHZ/mcjEjMToVMJOhTozkDonQFFrRcfdLWn6yWKCmJKmdVxSgHiYvTCef4/qcBA==} engines: {node: '>= 10.0.0'} @@ -4641,8 +4758,8 @@ packages: resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==} engines: {node: '>=10'} - lodash-es@4.17.21: - resolution: {integrity: sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==} + lodash-es@4.17.23: + resolution: {integrity: sha512-kVI48u3PZr38HdYz98UmfPnXl2DXrpdctLrFLCd3kOx1xUkOmpFPx7gCWWM5MPkL/fD8zb+Ph0QzjGFs4+hHWg==} lodash.castarray@4.4.0: resolution: {integrity: sha512-aVx8ztPv7/2ULbArGJ2Y42bG1mEQ5mGjpdvrbJcJFU3TbYybe+QlLS4pst9zV52ymy2in1KpFPiZnAOATxD4+Q==} @@ -4926,6 +5043,16 @@ packages: resolution: {integrity: sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg==} engines: {node: '>= 0.4'} + oxlint@1.47.0: + resolution: {integrity: sha512-v7xkK1iv1qdvTxJGclM97QzN8hHs5816AneFAQ0NGji1BMUquhiDAhXpMwp8+ls16uRVJtzVHxP9pAAXblDeGA==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true + peerDependencies: + oxlint-tsgolint: '>=0.11.2' + peerDependenciesMeta: + oxlint-tsgolint: + optional: true + p-limit@2.3.0: resolution: {integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==} engines: {node: '>=6'} @@ -8151,6 +8278,63 @@ snapshots: '@oxc-project/types@0.113.0': {} + '@oxlint/binding-android-arm-eabi@1.47.0': + optional: true + + '@oxlint/binding-android-arm64@1.47.0': + optional: true + + '@oxlint/binding-darwin-arm64@1.47.0': + optional: true + + '@oxlint/binding-darwin-x64@1.47.0': + optional: true + + '@oxlint/binding-freebsd-x64@1.47.0': + optional: true + + '@oxlint/binding-linux-arm-gnueabihf@1.47.0': + optional: true + + '@oxlint/binding-linux-arm-musleabihf@1.47.0': + optional: true + + '@oxlint/binding-linux-arm64-gnu@1.47.0': + optional: true + + '@oxlint/binding-linux-arm64-musl@1.47.0': + optional: true + + '@oxlint/binding-linux-ppc64-gnu@1.47.0': + optional: true + + '@oxlint/binding-linux-riscv64-gnu@1.47.0': + optional: true + + '@oxlint/binding-linux-riscv64-musl@1.47.0': + optional: true + + '@oxlint/binding-linux-s390x-gnu@1.47.0': + optional: true + + '@oxlint/binding-linux-x64-gnu@1.47.0': + optional: true + + '@oxlint/binding-linux-x64-musl@1.47.0': + optional: true + + '@oxlint/binding-openharmony-arm64@1.47.0': + optional: true + + '@oxlint/binding-win32-arm64-msvc@1.47.0': + optional: true + + '@oxlint/binding-win32-ia32-msvc@1.47.0': + optional: true + + '@oxlint/binding-win32-x64-msvc@1.47.0': + optional: true + '@parcel/watcher-android-arm64@2.5.1': optional: true @@ -11483,7 +11667,7 @@ snapshots: dependencies: p-locate: 5.0.0 - lodash-es@4.17.21: {} + lodash-es@4.17.23: {} lodash.castarray@4.4.0: {} @@ -11753,6 +11937,28 @@ snapshots: object-keys: 1.1.1 safe-push-apply: 1.0.0 + oxlint@1.47.0: + 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 + p-limit@2.3.0: dependencies: p-try: 2.2.0 @@ -12115,7 +12321,7 @@ snapshots: dependencies: '@icons/material': 0.2.4(react@19.2.3) lodash: 4.17.23 - lodash-es: 4.17.21 + lodash-es: 4.17.23 material-colors: 1.2.6 prop-types: 15.8.1 react: 19.2.3 @@ -13290,7 +13496,7 @@ snapshots: varint@6.0.0: {} - vite-plugin-checker@0.12.0(eslint@8.57.1)(meow@13.2.0)(optionator@0.9.4)(stylelint@16.23.0(typescript@5.7.3))(typescript@5.7.3)(vite@8.0.0-beta.14(@types/node@25.0.3)(esbuild@0.24.2)(jiti@1.21.7)(sass-embedded@1.93.3)(sass@1.93.3)(terser@5.46.0)(yaml@2.8.0)): + vite-plugin-checker@0.12.0(eslint@8.57.1)(meow@13.2.0)(optionator@0.9.4)(oxlint@1.47.0)(stylelint@16.23.0(typescript@5.7.3))(typescript@5.7.3)(vite@8.0.0-beta.14(@types/node@25.0.3)(esbuild@0.24.2)(jiti@1.21.7)(sass-embedded@1.93.3)(sass@1.93.3)(terser@5.46.0)(yaml@2.8.0)): dependencies: '@babel/code-frame': 7.29.0 chokidar: 4.0.3 @@ -13305,6 +13511,7 @@ snapshots: eslint: 8.57.1 meow: 13.2.0 optionator: 0.9.4 + oxlint: 1.47.0 stylelint: 16.23.0(typescript@5.7.3) typescript: 5.7.3