From b770042a8ad8a0359d3e66c2cf393ef1c640c8b6 Mon Sep 17 00:00:00 2001 From: Johnny Date: Tue, 1 Apr 2025 00:04:43 +0800 Subject: [PATCH] refactor: migrate eslint --- web/.eslintrc.json | 50 -- web/eslint.config.mjs | 34 + web/package.json | 10 +- web/pnpm-lock.yaml | 582 ++++++++---------- .../components/CreateAccessTokenDialog.tsx | 294 ++++----- web/src/components/CreateWebhookDialog.tsx | 320 +++++----- web/src/components/LocaleSelect.tsx | 2 +- web/src/components/MemoActionMenu.tsx | 4 +- web/src/components/MemoContent/CodeBlock.tsx | 2 +- web/src/components/MemoContent/LineBreak.tsx | 6 +- web/src/components/MemoContent/Link.tsx | 2 +- .../ActionButton/AddMemoRelationPopover.tsx | 374 +++++------ .../MemoEditor/Editor/TagSuggestions.tsx | 6 +- .../MemoRelationForceGraph/types.ts | 1 + web/src/components/ReactionSelector.tsx | 2 +- web/src/components/ReactionView.tsx | 2 +- web/src/components/ui/Popover.tsx | 1 - web/src/helpers/utils.ts | 2 +- 18 files changed, 809 insertions(+), 885 deletions(-) delete mode 100644 web/.eslintrc.json create mode 100644 web/eslint.config.mjs diff --git a/web/.eslintrc.json b/web/.eslintrc.json deleted file mode 100644 index 1e30948d..00000000 --- a/web/.eslintrc.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "env": { - "browser": true, - "es2021": true - }, - "extends": ["eslint:recommended", "plugin:react/recommended", "plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaFeatures": { - "jsx": true - }, - "ecmaVersion": "latest", - "sourceType": "module" - }, - "plugins": ["react", "@typescript-eslint", "prettier"], - "ignorePatterns": ["node_modules", "dist", "public", "src/assets"], - "rules": { - "prettier/prettier": [ - "error", - { - "endOfLine": "auto" - } - ], - "no-unused-vars": "off", - "@typescript-eslint/no-unused-vars": "error", - "@typescript-eslint/no-explicit-any": ["off"], - "react/react-in-jsx-scope": "off", - "react/jsx-no-target-blank": "off", - "no-restricted-syntax": [ - "error", - { - "selector": "VariableDeclarator[init.callee.name='useTranslation'] > ObjectPattern > Property[key.name='t']:not([parent.declarations.0.init.callee.object.name='i18n'])", - "message": "Destructuring 't' from useTranslation is not allowed. Please use the 'useTranslate' hook from '@/utils/i18n'." - } - ] - }, - "settings": { - "react": { - "version": "detect" - } - }, - "overrides": [ - { - "files": ["src/utils/i18n.ts"], - "rules": { - "no-restricted-syntax": "off" - } - } - ] -} diff --git a/web/eslint.config.mjs b/web/eslint.config.mjs new file mode 100644 index 00000000..d6af9548 --- /dev/null +++ b/web/eslint.config.mjs @@ -0,0 +1,34 @@ +import eslint from "@eslint/js"; +import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended"; +import tseslint from "typescript-eslint"; + +export default [ + ...tseslint.config(eslint.configs.recommended, tseslint.configs.recommended), + eslintPluginPrettierRecommended, + { + ignores: ["**/dist/**", "**/node_modules/**", "**/proto/**"], + }, + { + rules: { + "no-unused-vars": "off", + "@typescript-eslint/no-unused-vars": "error", + "@typescript-eslint/no-explicit-any": ["off"], + "react/react-in-jsx-scope": "off", + "react/jsx-no-target-blank": "off", + "no-restricted-syntax": [ + "error", + { + selector: + "VariableDeclarator[init.callee.name='useTranslation'] > ObjectPattern > Property[key.name='t']:not([parent.declarations.0.init.callee.object.name='i18n'])", + message: "Destructuring 't' from useTranslation is not allowed. Please use the 'useTranslate' hook from '@/utils/i18n'.", + }, + ], + }, + }, + { + files: ["src/utils/i18n.ts"], + rules: { + "no-restricted-syntax": "off", + }, + }, +]; diff --git a/web/package.json b/web/package.json index 40d01f06..a32c718d 100644 --- a/web/package.json +++ b/web/package.json @@ -52,6 +52,7 @@ "devDependencies": { "@bufbuild/buf": "^1.50.1", "@bufbuild/protobuf": "^2.2.3", + "@eslint/js": "^9.23.0", "@trivago/prettier-plugin-sort-imports": "^4.3.0", "@types/d3": "^7.4.3", "@types/katex": "^0.16.7", @@ -63,15 +64,13 @@ "@types/react-dom": "^18.3.5", "@types/textarea-caret": "^3.0.3", "@types/uuid": "^10.0.0", - "@typescript-eslint/eslint-plugin": "^7.18.0", - "@typescript-eslint/parser": "^7.18.0", "@vitejs/plugin-legacy": "^6.0.2", "@vitejs/plugin-react": "^4.3.4", "autoprefixer": "^10.4.21", "code-inspector-plugin": "^0.18.3", - "eslint": "^8.57.1", - "eslint-config-prettier": "^9.1.0", - "eslint-plugin-prettier": "^5.2.3", + "eslint": "^9.23.0", + "eslint-config-prettier": "^10.1.1", + "eslint-plugin-prettier": "^5.2.5", "eslint-plugin-react": "^7.37.4", "long": "^5.3.1", "nice-grpc-web": "^3.3.6", @@ -80,6 +79,7 @@ "protobufjs": "^7.4.0", "terser": "^5.39.0", "typescript": "^5.8.2", + "typescript-eslint": "^8.28.0", "vite": "^6.2.1" }, "pnpm": { diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yaml index a44e6116..f3883fd7 100644 --- a/web/pnpm-lock.yaml +++ b/web/pnpm-lock.yaml @@ -132,6 +132,9 @@ importers: '@bufbuild/protobuf': specifier: ^2.2.3 version: 2.2.3 + '@eslint/js': + specifier: ^9.23.0 + version: 9.23.0 '@trivago/prettier-plugin-sort-imports': specifier: ^4.3.0 version: 4.3.0(prettier@3.5.3) @@ -165,12 +168,6 @@ importers: '@types/uuid': specifier: ^10.0.0 version: 10.0.0 - '@typescript-eslint/eslint-plugin': - specifier: ^7.18.0 - version: 7.18.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.8.2))(eslint@8.57.1)(typescript@5.8.2) - '@typescript-eslint/parser': - specifier: ^7.18.0 - version: 7.18.0(eslint@8.57.1)(typescript@5.8.2) '@vitejs/plugin-legacy': specifier: ^6.0.2 version: 6.0.2(terser@5.39.0)(vite@6.2.1(@types/node@22.13.10)(jiti@1.21.7)(less@4.2.2)(terser@5.39.0)(yaml@2.7.0)) @@ -184,17 +181,17 @@ importers: specifier: ^0.18.3 version: 0.18.3 eslint: - specifier: ^8.57.1 - version: 8.57.1 + specifier: ^9.23.0 + version: 9.23.0(jiti@1.21.7) eslint-config-prettier: - specifier: ^9.1.0 - version: 9.1.0(eslint@8.57.1) + specifier: ^10.1.1 + version: 10.1.1(eslint@9.23.0(jiti@1.21.7)) eslint-plugin-prettier: - specifier: ^5.2.3 - version: 5.2.3(eslint-config-prettier@9.1.0(eslint@8.57.1))(eslint@8.57.1)(prettier@3.5.3) + specifier: ^5.2.5 + version: 5.2.5(eslint-config-prettier@10.1.1(eslint@9.23.0(jiti@1.21.7)))(eslint@9.23.0(jiti@1.21.7))(prettier@3.5.3) eslint-plugin-react: specifier: ^7.37.4 - version: 7.37.4(eslint@8.57.1) + version: 7.37.4(eslint@9.23.0(jiti@1.21.7)) long: specifier: ^5.3.1 version: 5.3.1 @@ -216,6 +213,9 @@ importers: typescript: specifier: ^5.8.2 version: 5.8.2 + typescript-eslint: + specifier: ^8.28.0 + version: 8.28.0(eslint@9.23.0(jiti@1.21.7))(typescript@5.8.2) vite: specifier: ^6.2.1 version: 6.2.1(@types/node@22.13.10)(jiti@1.21.7)(less@4.2.2)(terser@5.39.0)(yaml@2.7.0) @@ -1065,13 +1065,33 @@ packages: resolution: {integrity: sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==} engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} - '@eslint/eslintrc@2.1.4': - resolution: {integrity: sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + '@eslint/config-array@0.19.2': + resolution: {integrity: sha512-GNKqxfHG2ySmJOBSHg7LxeUx4xpuCoFjacmlCoYWEbaPXLwvfIjixRI12xCQZeULksQb23uiA8F40w5TojpV7w==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@eslint/js@8.57.1': - resolution: {integrity: sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + '@eslint/config-helpers@0.2.0': + resolution: {integrity: sha512-yJLLmLexii32mGrhW29qvU3QBVTu0GUmEf/J4XsBtVhp4JkIUFN/BjWqTF63yRvGApIDpZm5fa97LtYtINmfeQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + '@eslint/core@0.12.0': + resolution: {integrity: sha512-cmrR6pytBuSMTaBweKoGMwu3EiHiEC+DoyupPmlZ0HxBJBtIxwe+j/E4XPIKNx+Q74c8lXKPwYawBf5glsTkHg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + '@eslint/eslintrc@3.3.1': + resolution: {integrity: sha512-gtF186CXhIl1p4pJNGZw8Yc6RlshoePRvE0X91oPGb3vZ8pM3qOS9W9NGPat9LziaBV7XrJWGylNQXkGcnM3IQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + '@eslint/js@9.23.0': + resolution: {integrity: sha512-35MJ8vCPU0ZMxo7zfev2pypqTwWTofFZO6m4KAtdoFhRpLJUpHTZZ+KB3C7Hb1d7bULYwO4lJXGCi5Se+8OMbw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + '@eslint/object-schema@2.1.6': + resolution: {integrity: sha512-RBMg5FRL0I0gs51M/guSAj5/e14VQ4tpZnQNWwuDT66P14I43ItmPfIZRhO9fUVIPOAQXU47atlywZ/czoqFPA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + '@eslint/plugin-kit@0.2.7': + resolution: {integrity: sha512-JubJ5B2pJ4k4yGxaNLdbjrnk9d/iDz6/q8wOilpIowd6PJPgaxCuHBnBszq7Ce2TyMrywm5r4PnKm6V3iiZF+g==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} '@floating-ui/core@1.6.9': resolution: {integrity: sha512-uMXCuQ3BItDUbAMhIXw7UPXRfAlOAvZzdK9BWpE60MCn+Svt3aLn9jsPTi/WNGlRUu2uI0v5S7JiIUsbsvh3fw==} @@ -1097,18 +1117,25 @@ packages: '@github/relative-time-element@4.4.5': resolution: {integrity: sha512-9ejPtayBDIJfEU8x1fg/w2o5mahHkkp1SC6uObDtoKs4Gn+2a1vNK8XIiNDD8rMeEfpvDjydgSZZ+uk+7N0VsQ==} - '@humanwhocodes/config-array@0.13.0': - resolution: {integrity: sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==} - engines: {node: '>=10.10.0'} - deprecated: Use @eslint/config-array instead + '@humanfs/core@0.19.1': + resolution: {integrity: sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==} + engines: {node: '>=18.18.0'} + + '@humanfs/node@0.16.6': + resolution: {integrity: sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==} + engines: {node: '>=18.18.0'} '@humanwhocodes/module-importer@1.0.1': resolution: {integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==} engines: {node: '>=12.22'} - '@humanwhocodes/object-schema@2.0.3': - resolution: {integrity: sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==} - deprecated: Use @eslint/object-schema instead + '@humanwhocodes/retry@0.3.1': + resolution: {integrity: sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==} + engines: {node: '>=18.18'} + + '@humanwhocodes/retry@0.4.2': + resolution: {integrity: sha512-xeO57FpIu4p1Ri3Jq/EXq4ClRm86dVF2z/+kvFnyqVYRavTZmaFaUBbWCOuuTh0o/g7DSsk6kc2vrS4Vl5oPOQ==} + engines: {node: '>=18.18'} '@iconify/types@2.0.0': resolution: {integrity: sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg==} @@ -1256,8 +1283,8 @@ packages: resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} engines: {node: '>=14'} - '@pkgr/core@0.1.1': - resolution: {integrity: sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==} + '@pkgr/core@0.2.0': + resolution: {integrity: sha512-vsJDAkYR6qCPu+ioGScGiMYR7LvZYIXh/dlQeviqoTWNCVfKTLYD/LkNWH4Mxsv2a5vpIRc77FN5DnmK1eBggQ==} engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} '@popperjs/core@2.11.8': @@ -1733,6 +1760,9 @@ packages: '@types/js-cookie@2.2.7': resolution: {integrity: sha512-aLkWa0C0vO5b4Sr798E26QgOkss68Un0bLjs7u9qxzPT5CG+8DuNTffWES58YzJs3hrVAOs1wonycqEBqNJubA==} + '@types/json-schema@7.0.15': + resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} + '@types/katex@0.16.7': resolution: {integrity: sha512-HMwFiRujE5PjrgwHQ25+bsLJgowjGjm5Z8FVSf0N6PwgJrwxH0QxzHYDcKsTfV3wva0vzrpqMTJS2jXPr5BMEQ==} @@ -1774,66 +1804,52 @@ packages: '@types/uuid@10.0.0': resolution: {integrity: sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ==} - '@typescript-eslint/eslint-plugin@7.18.0': - resolution: {integrity: sha512-94EQTWZ40mzBc42ATNIBimBEDltSJ9RQHCC8vc/PDbxi4k8dVwUAv4o98dk50M1zB+JGFxp43FP7f8+FP8R6Sw==} - engines: {node: ^18.18.0 || >=20.0.0} + '@typescript-eslint/eslint-plugin@8.28.0': + resolution: {integrity: sha512-lvFK3TCGAHsItNdWZ/1FkvpzCxTHUVuFrdnOGLMa0GGCFIbCgQWVk3CzCGdA7kM3qGVc+dfW9tr0Z/sHnGDFyg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: - '@typescript-eslint/parser': ^7.0.0 - eslint: ^8.56.0 - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true + '@typescript-eslint/parser': ^8.0.0 || ^8.0.0-alpha.0 + eslint: ^8.57.0 || ^9.0.0 + typescript: '>=4.8.4 <5.9.0' - '@typescript-eslint/parser@7.18.0': - resolution: {integrity: sha512-4Z+L8I2OqhZV8qA132M4wNL30ypZGYOQVBfMgxDH/K5UX0PNqTu1c6za9ST5r9+tavvHiTWmBnKzpCJ/GlVFtg==} - engines: {node: ^18.18.0 || >=20.0.0} + '@typescript-eslint/parser@8.28.0': + resolution: {integrity: sha512-LPcw1yHD3ToaDEoljFEfQ9j2xShY367h7FZ1sq5NJT9I3yj4LHer1Xd1yRSOdYy9BpsrxU7R+eoDokChYM53lQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: - eslint: ^8.56.0 - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true + eslint: ^8.57.0 || ^9.0.0 + typescript: '>=4.8.4 <5.9.0' - '@typescript-eslint/scope-manager@7.18.0': - resolution: {integrity: sha512-jjhdIE/FPF2B7Z1uzc6i3oWKbGcHb87Qw7AWj6jmEqNOfDFbJWtjt/XfwCpvNkpGWlcJaog5vTR+VV8+w9JflA==} - engines: {node: ^18.18.0 || >=20.0.0} + '@typescript-eslint/scope-manager@8.28.0': + resolution: {integrity: sha512-u2oITX3BJwzWCapoZ/pXw6BCOl8rJP4Ij/3wPoGvY8XwvXflOzd1kLrDUUUAIEdJSFh+ASwdTHqtan9xSg8buw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/type-utils@7.18.0': - resolution: {integrity: sha512-XL0FJXuCLaDuX2sYqZUUSOJ2sG5/i1AAze+axqmLnSkNEVMVYLF+cbwlB2w8D1tinFuSikHmFta+P+HOofrLeA==} - engines: {node: ^18.18.0 || >=20.0.0} + '@typescript-eslint/type-utils@8.28.0': + resolution: {integrity: sha512-oRoXu2v0Rsy/VoOGhtWrOKDiIehvI+YNrDk5Oqj40Mwm0Yt01FC/Q7nFqg088d3yAsR1ZcZFVfPCTTFCe/KPwg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: - eslint: ^8.56.0 - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true + eslint: ^8.57.0 || ^9.0.0 + typescript: '>=4.8.4 <5.9.0' - '@typescript-eslint/types@7.18.0': - resolution: {integrity: sha512-iZqi+Ds1y4EDYUtlOOC+aUmxnE9xS/yCigkjA7XpTKV6nCBd3Hp/PRGGmdwnfkV2ThMyYldP1wRpm/id99spTQ==} - engines: {node: ^18.18.0 || >=20.0.0} + '@typescript-eslint/types@8.28.0': + resolution: {integrity: sha512-bn4WS1bkKEjx7HqiwG2JNB3YJdC1q6Ue7GyGlwPHyt0TnVq6TtD/hiOdTZt71sq0s7UzqBFXD8t8o2e63tXgwA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/typescript-estree@7.18.0': - resolution: {integrity: sha512-aP1v/BSPnnyhMHts8cf1qQ6Q1IFwwRvAQGRvBFkWlo3/lH29OXA3Pts+c10nxRxIBrDnoMqzhgdwVe5f2D6OzA==} - engines: {node: ^18.18.0 || >=20.0.0} + '@typescript-eslint/typescript-estree@8.28.0': + resolution: {integrity: sha512-H74nHEeBGeklctAVUvmDkxB1mk+PAZ9FiOMPFncdqeRBXxk1lWSYraHw8V12b7aa6Sg9HOBNbGdSHobBPuQSuA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true + typescript: '>=4.8.4 <5.9.0' - '@typescript-eslint/utils@7.18.0': - resolution: {integrity: sha512-kK0/rNa2j74XuHVcoCZxdFBMF+aq/vH83CXAOHieC+2Gis4mF8jJXT5eAfyD3K0sAxtPuwxaIOIOvhwzVDt/kw==} - engines: {node: ^18.18.0 || >=20.0.0} + '@typescript-eslint/utils@8.28.0': + resolution: {integrity: sha512-OELa9hbTYciYITqgurT1u/SzpQVtDLmQMFzy/N8pQE+tefOyCWT79jHsav294aTqV1q1u+VzqDGbuujvRYaeSQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: - eslint: ^8.56.0 - - '@typescript-eslint/visitor-keys@7.18.0': - resolution: {integrity: sha512-cDF0/Gf81QpY3xYyJKDV14Zwdmid5+uuENhjH2EqFaF0ni+yAyq/LzMaIJdhNJXZI7uLzwIlA+V7oWoyn6Curg==} - engines: {node: ^18.18.0 || >=20.0.0} + eslint: ^8.57.0 || ^9.0.0 + typescript: '>=4.8.4 <5.9.0' - '@ungap/structured-clone@1.3.0': - resolution: {integrity: sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==} + '@typescript-eslint/visitor-keys@8.28.0': + resolution: {integrity: sha512-hbn8SZ8w4u2pRwgQ1GlUrPKE+t2XvcCW5tTRF7j6SMYIuYG37XuzIW44JCZPa36evi0Oy2SnM664BlIaAuQcvg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} '@usememos/mui@0.1.0-20250312125611': resolution: {integrity: sha512-DyXvdXOnem5XJJsUQOTjRKhy7Cc/82PDatvz8sLclQegMx2dBwwSxJxELlK8eMskJgQjbDTLwRLvA/AcTt4ztQ==} @@ -1927,10 +1943,6 @@ packages: resolution: {integrity: sha512-itaWrbYbqpGXkGhZPGUulwnhVf5Hpy1xiCFsGqyIGglbBxmG5vSjxQen3/WGOjPpNEv1RtBLKxbmVXm8HpJStQ==} engines: {node: '>= 0.4'} - array-union@2.1.0: - resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} - engines: {node: '>=8'} - array.prototype.findlast@1.2.5: resolution: {integrity: sha512-CVvd6FHg1Z3POpBLxO6E6zr+rSKEQ9L6rZHAaY7lLfhKsWYUBBOuMs0e9o24oopj6H+geRCX0YJ+TJLBK2eHyQ==} engines: {node: '>= 0.4'} @@ -2375,10 +2387,6 @@ packages: didyoumean@1.2.2: resolution: {integrity: sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==} - dir-glob@3.0.1: - resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} - engines: {node: '>=8'} - dlv@1.1.3: resolution: {integrity: sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==} @@ -2386,10 +2394,6 @@ packages: resolution: {integrity: sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==} engines: {node: '>=0.10.0'} - doctrine@3.0.0: - resolution: {integrity: sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==} - engines: {node: '>=6.0.0'} - dompurify@3.2.4: resolution: {integrity: sha512-ysFSFEDVduQpyhzAob/kkuJjf5zWkZD8/A9ywSp1byueyuCfHamrCBa14/Oc2iiB0e51B+NpxSl5gmzn+Ms/mg==} @@ -2475,19 +2479,19 @@ packages: resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} engines: {node: '>=10'} - eslint-config-prettier@9.1.0: - resolution: {integrity: sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==} + eslint-config-prettier@10.1.1: + resolution: {integrity: sha512-4EQQr6wXwS+ZJSzaR5ZCrYgLxqvUjdXctaEtBqHcbkW944B1NQyO4qpdHQbXBONfwxXdkAY81HH4+LUfrg+zPw==} hasBin: true peerDependencies: eslint: '>=7.0.0' - eslint-plugin-prettier@5.2.3: - resolution: {integrity: sha512-qJ+y0FfCp/mQYQ/vWQ3s7eUlFEL4PyKfAJxsnYTJ4YT73nsJBWqmEpFryxV9OeUiqmsTsYJ5Y+KDNaeP31wrRw==} + eslint-plugin-prettier@5.2.5: + resolution: {integrity: sha512-IKKP8R87pJyMl7WWamLgPkloB16dagPIdd2FjBDbyRYPKo93wS/NbCOPh6gH+ieNLC+XZrhJt/kWj0PS/DFdmg==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: '@types/eslint': '>=8.0.0' eslint: '>=8.0.0' - eslint-config-prettier: '*' + eslint-config-prettier: '>= 7.0.0 <10.0.0 || >=10.1.0' prettier: '>=3.0.0' peerDependenciesMeta: '@types/eslint': @@ -2501,23 +2505,31 @@ packages: peerDependencies: eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9.7 - eslint-scope@7.2.2: - resolution: {integrity: sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + eslint-scope@8.3.0: + resolution: {integrity: sha512-pUNxi75F8MJ/GdeKtVLSbYg4ZI34J6C0C7sbL4YOp2exGwen7ZsuBqKzUhXd0qMQ362yET3z+uPwKeg/0C2XCQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} eslint-visitor-keys@3.4.3: resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - eslint@8.57.1: - resolution: {integrity: sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - deprecated: This version is no longer supported. Please see https://eslint.org/version-support for other options. + eslint-visitor-keys@4.2.0: + resolution: {integrity: sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + eslint@9.23.0: + resolution: {integrity: sha512-jV7AbNoFPAY1EkFYpLq5bslU9NLNO8xnEeQXwErNibVryjk67wHVmddTBilc5srIttJDBrB0eMHKZBFbSIABCw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} hasBin: true + peerDependencies: + jiti: '*' + peerDependenciesMeta: + jiti: + optional: true - espree@9.6.1: - resolution: {integrity: sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + espree@10.3.0: + resolution: {integrity: sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} esquery@1.6.0: resolution: {integrity: sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==} @@ -2566,9 +2578,9 @@ packages: fastq@1.19.1: resolution: {integrity: sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==} - file-entry-cache@6.0.1: - resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==} - engines: {node: ^10.12.0 || >=12.0.0} + file-entry-cache@8.0.0: + resolution: {integrity: sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==} + engines: {node: '>=16.0.0'} fill-range@7.1.1: resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} @@ -2581,9 +2593,9 @@ packages: resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==} engines: {node: '>=10'} - flat-cache@3.2.0: - resolution: {integrity: sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==} - engines: {node: ^10.12.0 || >=12.0.0} + flat-cache@4.0.1: + resolution: {integrity: sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==} + engines: {node: '>=16'} flatted@3.3.3: resolution: {integrity: sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==} @@ -2607,9 +2619,6 @@ packages: fraction.js@4.3.7: resolution: {integrity: sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==} - fs.realpath@1.0.0: - resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} - fsevents@2.3.3: resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} @@ -2661,17 +2670,13 @@ packages: resolution: {integrity: sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==} hasBin: true - glob@7.2.3: - resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} - deprecated: Glob versions prior to v9 are no longer supported - globals@11.12.0: resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==} engines: {node: '>=4'} - globals@13.24.0: - resolution: {integrity: sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==} - engines: {node: '>=8'} + globals@14.0.0: + resolution: {integrity: sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==} + engines: {node: '>=18'} globals@15.15.0: resolution: {integrity: sha512-7ACyT3wmyp3I61S4fG682L0VA2RGD9otkqGJIwNUMF1SWUombIIk+af1unuDYgMm082aHYwD+mzJvv9Iu8dsgg==} @@ -2681,10 +2686,6 @@ packages: resolution: {integrity: sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==} engines: {node: '>= 0.4'} - globby@11.1.0: - resolution: {integrity: sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==} - engines: {node: '>=10'} - goober@2.1.16: resolution: {integrity: sha512-erjk19y1U33+XAMe1VTvIONHYoSqE4iS7BYUZfHaqeohLmnC0FdxEh7rQU+6MZ4OajItzjZFSRtVANrQwNq6/g==} peerDependencies: @@ -2779,13 +2780,6 @@ packages: resolution: {integrity: sha512-SP23P27OUKzXWEC/TOyWlwLviofQkCSCKONnc62eItjp69yCZZPqDQtr3Pw5gJDnPeUMqExmKydNZaJO0FU9pw==} engines: {node: '>=12'} - inflight@1.0.6: - resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} - deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. - - inherits@2.0.4: - resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} - inline-style-prefixer@7.0.1: resolution: {integrity: sha512-lhYo5qNTQp3EvSSp3sRvXMbVQTLrvGV6DycRMJ5dm2BLMiJ30wpXKdDdgX+GmJZ5uQMucwRKHamXSst3Sj/Giw==} @@ -2871,10 +2865,6 @@ packages: resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} engines: {node: '>=0.12.0'} - is-path-inside@3.0.3: - resolution: {integrity: sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==} - engines: {node: '>=8'} - is-regex@1.2.1: resolution: {integrity: sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==} engines: {node: '>= 0.4'} @@ -3229,9 +3219,6 @@ packages: resolution: {integrity: sha512-gXah6aZrcUxjWg2zR2MwouP2eHlCBzdV4pygudehaKXSGW4v2AsRQUK+lwwXhii6KFZcunEnmSUoYp5CXibxtA==} engines: {node: '>= 0.4'} - once@1.4.0: - resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} - optionator@0.9.4: resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==} engines: {node: '>= 0.8.0'} @@ -3273,10 +3260,6 @@ packages: resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} engines: {node: '>=8'} - path-is-absolute@1.0.1: - resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} - engines: {node: '>=0.10.0'} - path-key@3.1.1: resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} engines: {node: '>=8'} @@ -3599,11 +3582,6 @@ packages: resolution: {integrity: sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==} engines: {iojs: '>=1.0.0', node: '>=0.10.0'} - rimraf@3.0.2: - resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==} - deprecated: Rimraf versions prior to v4 are no longer supported - hasBin: true - robust-predicates@3.0.2: resolution: {integrity: sha512-IXgzBWvWQwE6PrDI05OvmXUIruQTcoMDzRsOd5CDvHCVLcLHMTSYvOK5Cm46kWqlV3yAbuSpBZdJ5oP5OUoStg==} @@ -3709,10 +3687,6 @@ packages: resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} engines: {node: '>=14'} - slash@3.0.0: - resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} - engines: {node: '>=8'} - source-map-js@1.2.1: resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} engines: {node: '>=0.10.0'} @@ -3802,8 +3776,8 @@ packages: resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} engines: {node: '>= 0.4'} - synckit@0.9.2: - resolution: {integrity: sha512-vrozgXDQwYO72vHjUb/HnFbQx1exDjoKzqx23aXEg2a9VIg2TSFZ8FmeZpTjUCFMYw7mpX4BE2SFu8wI7asYsw==} + synckit@0.10.3: + resolution: {integrity: sha512-R1urvuyiTaWfeCggqEvpDJwAlDVdsT9NM+IP//Tk2x7qHCkSvBk/fwFgw/TLAHzZlrAnnazMcRw0ZD8HlYFTEQ==} engines: {node: ^14.18.0 || >=16.0.0} systemjs@6.15.1: @@ -3830,9 +3804,6 @@ packages: engines: {node: '>=10'} hasBin: true - text-table@0.2.0: - resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} - textarea-caret@3.1.0: resolution: {integrity: sha512-cXAvzO9pP5CGa6NKx0WYHl+8CHKZs8byMkt3PCJBCmq2a34YA9pO1NrQET5pzeqnBjBdToF5No4rrmkDUgQC2Q==} @@ -3864,11 +3835,11 @@ packages: toggle-selection@1.0.6: resolution: {integrity: sha512-BiZS+C1OS8g/q2RRbJmy59xpyghNBqrr6k5L/uKBGRsTfxmu3ffiRnd8mlGPUVayg8pvfi5urfnu8TU7DVOkLQ==} - ts-api-utils@1.4.3: - resolution: {integrity: sha512-i3eMG77UTMD0hZhgRS562pv83RC6ukSAC2GMNWc+9dieh/+jDM5u5YG+NHX6VNDRHQcHwmsTHctP9LhbC3WxVw==} - engines: {node: '>=16'} + ts-api-utils@2.1.0: + resolution: {integrity: sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==} + engines: {node: '>=18.12'} peerDependencies: - typescript: '>=4.2.0' + typescript: '>=4.8.4' ts-dedent@2.2.0: resolution: {integrity: sha512-q5W7tVM71e2xjHZTlgfTDoPF/SmqKG5hddq9SzR49CH2hayqRKJtQ4mtRlSxKaJlR/+9rEM+mnBHf7I2/BQcpQ==} @@ -3893,10 +3864,6 @@ packages: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} engines: {node: '>= 0.8.0'} - type-fest@0.20.2: - resolution: {integrity: sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==} - engines: {node: '>=10'} - typed-array-buffer@1.0.3: resolution: {integrity: sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==} engines: {node: '>= 0.4'} @@ -3913,6 +3880,13 @@ packages: resolution: {integrity: sha512-3KS2b+kL7fsuk/eJZ7EQdnEmQoaho/r6KUef7hxvltNA5DR8NAUM+8wJMbJyZ4G9/7i3v5zPBIMN5aybAh2/Jg==} engines: {node: '>= 0.4'} + typescript-eslint@8.28.0: + resolution: {integrity: sha512-jfZtxJoHm59bvoCMYCe2BM0/baMswRhMmYhy+w6VfcyHrjxZ0OJe0tGasydCpIpA+A/WIJhTyZfb3EtwNC/kHQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 + typescript: '>=4.8.4 <5.9.0' + typescript@5.8.2: resolution: {integrity: sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ==} engines: {node: '>=14.17'} @@ -4092,9 +4066,6 @@ packages: resolution: {integrity: sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==} engines: {node: '>=12'} - wrappy@1.0.2: - resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} - ws@8.17.0: resolution: {integrity: sha512-uJq6108EgZMAl20KagGkzCKfMEjxmKvZHG7Tlq0Z6nOky7YF7aq4mOx6xK8TJ/i1LeK4Qus7INktacctDgY8Ow==} engines: {node: '>=10.0.0'} @@ -5084,19 +5055,33 @@ snapshots: '@esbuild/win32-x64@0.25.1': optional: true - '@eslint-community/eslint-utils@4.5.0(eslint@8.57.1)': + '@eslint-community/eslint-utils@4.5.0(eslint@9.23.0(jiti@1.21.7))': dependencies: - eslint: 8.57.1 + eslint: 9.23.0(jiti@1.21.7) eslint-visitor-keys: 3.4.3 '@eslint-community/regexpp@4.12.1': {} - '@eslint/eslintrc@2.1.4': + '@eslint/config-array@0.19.2': + dependencies: + '@eslint/object-schema': 2.1.6 + debug: 4.4.0 + minimatch: 3.1.2 + transitivePeerDependencies: + - supports-color + + '@eslint/config-helpers@0.2.0': {} + + '@eslint/core@0.12.0': + dependencies: + '@types/json-schema': 7.0.15 + + '@eslint/eslintrc@3.3.1': dependencies: ajv: 6.12.6 debug: 4.4.0 - espree: 9.6.1 - globals: 13.24.0 + espree: 10.3.0 + globals: 14.0.0 ignore: 5.3.2 import-fresh: 3.3.1 js-yaml: 4.1.0 @@ -5105,7 +5090,14 @@ snapshots: transitivePeerDependencies: - supports-color - '@eslint/js@8.57.1': {} + '@eslint/js@9.23.0': {} + + '@eslint/object-schema@2.1.6': {} + + '@eslint/plugin-kit@0.2.7': + dependencies: + '@eslint/core': 0.12.0 + levn: 0.4.1 '@floating-ui/core@1.6.9': dependencies: @@ -5134,17 +5126,18 @@ snapshots: '@github/relative-time-element@4.4.5': {} - '@humanwhocodes/config-array@0.13.0': + '@humanfs/core@0.19.1': {} + + '@humanfs/node@0.16.6': dependencies: - '@humanwhocodes/object-schema': 2.0.3 - debug: 4.4.0 - minimatch: 3.1.2 - transitivePeerDependencies: - - supports-color + '@humanfs/core': 0.19.1 + '@humanwhocodes/retry': 0.3.1 '@humanwhocodes/module-importer@1.0.1': {} - '@humanwhocodes/object-schema@2.0.3': {} + '@humanwhocodes/retry@0.3.1': {} + + '@humanwhocodes/retry@0.4.2': {} '@iconify/types@2.0.0': {} @@ -5301,7 +5294,7 @@ snapshots: '@pkgjs/parseargs@0.11.0': optional: true - '@pkgr/core@0.1.1': {} + '@pkgr/core@0.2.0': {} '@popperjs/core@2.11.8': {} @@ -5730,6 +5723,8 @@ snapshots: '@types/js-cookie@2.2.7': {} + '@types/json-schema@7.0.15': {} + '@types/katex@0.16.7': {} '@types/leaflet@1.9.16': @@ -5768,88 +5763,82 @@ snapshots: '@types/uuid@10.0.0': {} - '@typescript-eslint/eslint-plugin@7.18.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.8.2))(eslint@8.57.1)(typescript@5.8.2)': + '@typescript-eslint/eslint-plugin@8.28.0(@typescript-eslint/parser@8.28.0(eslint@9.23.0(jiti@1.21.7))(typescript@5.8.2))(eslint@9.23.0(jiti@1.21.7))(typescript@5.8.2)': dependencies: '@eslint-community/regexpp': 4.12.1 - '@typescript-eslint/parser': 7.18.0(eslint@8.57.1)(typescript@5.8.2) - '@typescript-eslint/scope-manager': 7.18.0 - '@typescript-eslint/type-utils': 7.18.0(eslint@8.57.1)(typescript@5.8.2) - '@typescript-eslint/utils': 7.18.0(eslint@8.57.1)(typescript@5.8.2) - '@typescript-eslint/visitor-keys': 7.18.0 - eslint: 8.57.1 + '@typescript-eslint/parser': 8.28.0(eslint@9.23.0(jiti@1.21.7))(typescript@5.8.2) + '@typescript-eslint/scope-manager': 8.28.0 + '@typescript-eslint/type-utils': 8.28.0(eslint@9.23.0(jiti@1.21.7))(typescript@5.8.2) + '@typescript-eslint/utils': 8.28.0(eslint@9.23.0(jiti@1.21.7))(typescript@5.8.2) + '@typescript-eslint/visitor-keys': 8.28.0 + eslint: 9.23.0(jiti@1.21.7) graphemer: 1.4.0 ignore: 5.3.2 natural-compare: 1.4.0 - ts-api-utils: 1.4.3(typescript@5.8.2) - optionalDependencies: + ts-api-utils: 2.1.0(typescript@5.8.2) typescript: 5.8.2 transitivePeerDependencies: - supports-color - '@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.8.2)': + '@typescript-eslint/parser@8.28.0(eslint@9.23.0(jiti@1.21.7))(typescript@5.8.2)': dependencies: - '@typescript-eslint/scope-manager': 7.18.0 - '@typescript-eslint/types': 7.18.0 - '@typescript-eslint/typescript-estree': 7.18.0(typescript@5.8.2) - '@typescript-eslint/visitor-keys': 7.18.0 + '@typescript-eslint/scope-manager': 8.28.0 + '@typescript-eslint/types': 8.28.0 + '@typescript-eslint/typescript-estree': 8.28.0(typescript@5.8.2) + '@typescript-eslint/visitor-keys': 8.28.0 debug: 4.4.0 - eslint: 8.57.1 - optionalDependencies: + eslint: 9.23.0(jiti@1.21.7) typescript: 5.8.2 transitivePeerDependencies: - supports-color - '@typescript-eslint/scope-manager@7.18.0': + '@typescript-eslint/scope-manager@8.28.0': dependencies: - '@typescript-eslint/types': 7.18.0 - '@typescript-eslint/visitor-keys': 7.18.0 + '@typescript-eslint/types': 8.28.0 + '@typescript-eslint/visitor-keys': 8.28.0 - '@typescript-eslint/type-utils@7.18.0(eslint@8.57.1)(typescript@5.8.2)': + '@typescript-eslint/type-utils@8.28.0(eslint@9.23.0(jiti@1.21.7))(typescript@5.8.2)': dependencies: - '@typescript-eslint/typescript-estree': 7.18.0(typescript@5.8.2) - '@typescript-eslint/utils': 7.18.0(eslint@8.57.1)(typescript@5.8.2) + '@typescript-eslint/typescript-estree': 8.28.0(typescript@5.8.2) + '@typescript-eslint/utils': 8.28.0(eslint@9.23.0(jiti@1.21.7))(typescript@5.8.2) debug: 4.4.0 - eslint: 8.57.1 - ts-api-utils: 1.4.3(typescript@5.8.2) - optionalDependencies: + eslint: 9.23.0(jiti@1.21.7) + ts-api-utils: 2.1.0(typescript@5.8.2) typescript: 5.8.2 transitivePeerDependencies: - supports-color - '@typescript-eslint/types@7.18.0': {} + '@typescript-eslint/types@8.28.0': {} - '@typescript-eslint/typescript-estree@7.18.0(typescript@5.8.2)': + '@typescript-eslint/typescript-estree@8.28.0(typescript@5.8.2)': dependencies: - '@typescript-eslint/types': 7.18.0 - '@typescript-eslint/visitor-keys': 7.18.0 + '@typescript-eslint/types': 8.28.0 + '@typescript-eslint/visitor-keys': 8.28.0 debug: 4.4.0 - globby: 11.1.0 + fast-glob: 3.3.3 is-glob: 4.0.3 minimatch: 9.0.5 semver: 7.7.1 - ts-api-utils: 1.4.3(typescript@5.8.2) - optionalDependencies: + ts-api-utils: 2.1.0(typescript@5.8.2) typescript: 5.8.2 transitivePeerDependencies: - supports-color - '@typescript-eslint/utils@7.18.0(eslint@8.57.1)(typescript@5.8.2)': + '@typescript-eslint/utils@8.28.0(eslint@9.23.0(jiti@1.21.7))(typescript@5.8.2)': dependencies: - '@eslint-community/eslint-utils': 4.5.0(eslint@8.57.1) - '@typescript-eslint/scope-manager': 7.18.0 - '@typescript-eslint/types': 7.18.0 - '@typescript-eslint/typescript-estree': 7.18.0(typescript@5.8.2) - eslint: 8.57.1 + '@eslint-community/eslint-utils': 4.5.0(eslint@9.23.0(jiti@1.21.7)) + '@typescript-eslint/scope-manager': 8.28.0 + '@typescript-eslint/types': 8.28.0 + '@typescript-eslint/typescript-estree': 8.28.0(typescript@5.8.2) + eslint: 9.23.0(jiti@1.21.7) + typescript: 5.8.2 transitivePeerDependencies: - supports-color - - typescript - '@typescript-eslint/visitor-keys@7.18.0': + '@typescript-eslint/visitor-keys@8.28.0': dependencies: - '@typescript-eslint/types': 7.18.0 - eslint-visitor-keys: 3.4.3 - - '@ungap/structured-clone@1.3.0': {} + '@typescript-eslint/types': 8.28.0 + eslint-visitor-keys: 4.2.0 '@usememos/mui@0.1.0-20250312125611(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: @@ -5955,8 +5944,6 @@ snapshots: get-intrinsic: 1.3.0 is-string: 1.1.1 - array-union@2.1.0: {} - array.prototype.findlast@1.2.5: dependencies: call-bind: 1.0.8 @@ -6485,20 +6472,12 @@ snapshots: didyoumean@1.2.2: {} - dir-glob@3.0.1: - dependencies: - path-type: 4.0.0 - dlv@1.1.3: {} doctrine@2.1.0: dependencies: esutils: 2.0.3 - doctrine@3.0.0: - dependencies: - esutils: 2.0.3 - dompurify@3.2.4: optionalDependencies: '@types/trusted-types': 2.0.7 @@ -6670,20 +6649,20 @@ snapshots: escape-string-regexp@4.0.0: {} - eslint-config-prettier@9.1.0(eslint@8.57.1): + eslint-config-prettier@10.1.1(eslint@9.23.0(jiti@1.21.7)): dependencies: - eslint: 8.57.1 + eslint: 9.23.0(jiti@1.21.7) - eslint-plugin-prettier@5.2.3(eslint-config-prettier@9.1.0(eslint@8.57.1))(eslint@8.57.1)(prettier@3.5.3): + eslint-plugin-prettier@5.2.5(eslint-config-prettier@10.1.1(eslint@9.23.0(jiti@1.21.7)))(eslint@9.23.0(jiti@1.21.7))(prettier@3.5.3): dependencies: - eslint: 8.57.1 + eslint: 9.23.0(jiti@1.21.7) prettier: 3.5.3 prettier-linter-helpers: 1.0.0 - synckit: 0.9.2 + synckit: 0.10.3 optionalDependencies: - eslint-config-prettier: 9.1.0(eslint@8.57.1) + eslint-config-prettier: 10.1.1(eslint@9.23.0(jiti@1.21.7)) - eslint-plugin-react@7.37.4(eslint@8.57.1): + eslint-plugin-react@7.37.4(eslint@9.23.0(jiti@1.21.7)): dependencies: array-includes: 3.1.8 array.prototype.findlast: 1.2.5 @@ -6691,7 +6670,7 @@ snapshots: array.prototype.tosorted: 1.1.4 doctrine: 2.1.0 es-iterator-helpers: 1.2.1 - eslint: 8.57.1 + eslint: 9.23.0(jiti@1.21.7) estraverse: 5.3.0 hasown: 2.0.2 jsx-ast-utils: 3.3.5 @@ -6705,61 +6684,62 @@ snapshots: string.prototype.matchall: 4.0.12 string.prototype.repeat: 1.0.0 - eslint-scope@7.2.2: + eslint-scope@8.3.0: dependencies: esrecurse: 4.3.0 estraverse: 5.3.0 eslint-visitor-keys@3.4.3: {} - eslint@8.57.1: + eslint-visitor-keys@4.2.0: {} + + eslint@9.23.0(jiti@1.21.7): dependencies: - '@eslint-community/eslint-utils': 4.5.0(eslint@8.57.1) + '@eslint-community/eslint-utils': 4.5.0(eslint@9.23.0(jiti@1.21.7)) '@eslint-community/regexpp': 4.12.1 - '@eslint/eslintrc': 2.1.4 - '@eslint/js': 8.57.1 - '@humanwhocodes/config-array': 0.13.0 + '@eslint/config-array': 0.19.2 + '@eslint/config-helpers': 0.2.0 + '@eslint/core': 0.12.0 + '@eslint/eslintrc': 3.3.1 + '@eslint/js': 9.23.0 + '@eslint/plugin-kit': 0.2.7 + '@humanfs/node': 0.16.6 '@humanwhocodes/module-importer': 1.0.1 - '@nodelib/fs.walk': 1.2.8 - '@ungap/structured-clone': 1.3.0 + '@humanwhocodes/retry': 0.4.2 + '@types/estree': 1.0.6 + '@types/json-schema': 7.0.15 ajv: 6.12.6 chalk: 4.1.2 cross-spawn: 7.0.6 debug: 4.4.0 - doctrine: 3.0.0 escape-string-regexp: 4.0.0 - eslint-scope: 7.2.2 - eslint-visitor-keys: 3.4.3 - espree: 9.6.1 + eslint-scope: 8.3.0 + eslint-visitor-keys: 4.2.0 + espree: 10.3.0 esquery: 1.6.0 esutils: 2.0.3 fast-deep-equal: 3.1.3 - file-entry-cache: 6.0.1 + file-entry-cache: 8.0.0 find-up: 5.0.0 glob-parent: 6.0.2 - globals: 13.24.0 - graphemer: 1.4.0 ignore: 5.3.2 imurmurhash: 0.1.4 is-glob: 4.0.3 - is-path-inside: 3.0.3 - js-yaml: 4.1.0 json-stable-stringify-without-jsonify: 1.0.1 - levn: 0.4.1 lodash.merge: 4.6.2 minimatch: 3.1.2 natural-compare: 1.4.0 optionator: 0.9.4 - strip-ansi: 6.0.1 - text-table: 0.2.0 + optionalDependencies: + jiti: 1.21.7 transitivePeerDependencies: - supports-color - espree@9.6.1: + espree@10.3.0: dependencies: acorn: 8.14.1 acorn-jsx: 5.3.2(acorn@8.14.1) - eslint-visitor-keys: 3.4.3 + eslint-visitor-keys: 4.2.0 esquery@1.6.0: dependencies: @@ -6801,9 +6781,9 @@ snapshots: dependencies: reusify: 1.1.0 - file-entry-cache@6.0.1: + file-entry-cache@8.0.0: dependencies: - flat-cache: 3.2.0 + flat-cache: 4.0.1 fill-range@7.1.1: dependencies: @@ -6816,11 +6796,10 @@ snapshots: locate-path: 6.0.0 path-exists: 4.0.0 - flat-cache@3.2.0: + flat-cache@4.0.1: dependencies: flatted: 3.3.3 keyv: 4.5.4 - rimraf: 3.0.2 flatted@3.3.3: {} @@ -6859,8 +6838,6 @@ snapshots: fraction.js@4.3.7: {} - fs.realpath@1.0.0: {} - fsevents@2.3.3: optional: true @@ -6924,20 +6901,9 @@ snapshots: package-json-from-dist: 1.0.1 path-scurry: 1.11.1 - glob@7.2.3: - dependencies: - fs.realpath: 1.0.0 - inflight: 1.0.6 - inherits: 2.0.4 - minimatch: 3.1.2 - once: 1.4.0 - path-is-absolute: 1.0.1 - globals@11.12.0: {} - globals@13.24.0: - dependencies: - type-fest: 0.20.2 + globals@14.0.0: {} globals@15.15.0: {} @@ -6946,15 +6912,6 @@ snapshots: define-properties: 1.2.1 gopd: 1.2.0 - globby@11.1.0: - dependencies: - array-union: 2.1.0 - dir-glob: 3.0.1 - fast-glob: 3.3.3 - ignore: 5.3.2 - merge2: 1.4.1 - slash: 3.0.0 - goober@2.1.16(csstype@3.1.3): dependencies: csstype: 3.1.3 @@ -7029,13 +6986,6 @@ snapshots: index-array-by@1.4.2: {} - inflight@1.0.6: - dependencies: - once: 1.4.0 - wrappy: 1.0.2 - - inherits@2.0.4: {} - inline-style-prefixer@7.0.1: dependencies: css-in-js-utils: 3.1.0 @@ -7124,8 +7074,6 @@ snapshots: is-number@7.0.0: {} - is-path-inside@3.0.3: {} - is-regex@1.2.1: dependencies: call-bound: 1.0.4 @@ -7496,10 +7444,6 @@ snapshots: define-properties: 1.2.1 es-object-atoms: 1.1.1 - once@1.4.0: - dependencies: - wrappy: 1.0.2 - optionator@0.9.4: dependencies: deep-is: 0.1.4 @@ -7547,8 +7491,6 @@ snapshots: path-exists@4.0.0: {} - path-is-absolute@1.0.1: {} - path-key@3.1.1: {} path-parse@1.0.7: {} @@ -7883,10 +7825,6 @@ snapshots: reusify@1.1.0: {} - rimraf@3.0.2: - dependencies: - glob: 7.2.3 - robust-predicates@3.0.2: {} rollup@4.35.0: @@ -8030,8 +7968,6 @@ snapshots: signal-exit@4.1.0: {} - slash@3.0.0: {} - source-map-js@1.2.1: {} source-map-support@0.5.21: @@ -8148,9 +8084,9 @@ snapshots: supports-preserve-symlinks-flag@1.0.0: {} - synckit@0.9.2: + synckit@0.10.3: dependencies: - '@pkgr/core': 0.1.1 + '@pkgr/core': 0.2.0 tslib: 2.8.1 systemjs@6.15.1: {} @@ -8197,8 +8133,6 @@ snapshots: commander: 2.20.3 source-map-support: 0.5.21 - text-table@0.2.0: {} - textarea-caret@3.1.0: {} thenify-all@1.6.0: @@ -8223,7 +8157,7 @@ snapshots: toggle-selection@1.0.6: {} - ts-api-utils@1.4.3(typescript@5.8.2): + ts-api-utils@2.1.0(typescript@5.8.2): dependencies: typescript: 5.8.2 @@ -8243,8 +8177,6 @@ snapshots: dependencies: prelude-ls: 1.2.1 - type-fest@0.20.2: {} - typed-array-buffer@1.0.3: dependencies: call-bound: 1.0.4 @@ -8278,6 +8210,16 @@ snapshots: possible-typed-array-names: 1.1.0 reflect.getprototypeof: 1.0.10 + typescript-eslint@8.28.0(eslint@9.23.0(jiti@1.21.7))(typescript@5.8.2): + dependencies: + '@typescript-eslint/eslint-plugin': 8.28.0(@typescript-eslint/parser@8.28.0(eslint@9.23.0(jiti@1.21.7))(typescript@5.8.2))(eslint@9.23.0(jiti@1.21.7))(typescript@5.8.2) + '@typescript-eslint/parser': 8.28.0(eslint@9.23.0(jiti@1.21.7))(typescript@5.8.2) + '@typescript-eslint/utils': 8.28.0(eslint@9.23.0(jiti@1.21.7))(typescript@5.8.2) + eslint: 9.23.0(jiti@1.21.7) + typescript: 5.8.2 + transitivePeerDependencies: + - supports-color + typescript@5.8.2: {} ufo@1.5.4: {} @@ -8440,8 +8382,6 @@ snapshots: string-width: 5.1.2 strip-ansi: 7.1.0 - wrappy@1.0.2: {} - ws@8.17.0: {} yallist@3.1.1: {} diff --git a/web/src/components/CreateAccessTokenDialog.tsx b/web/src/components/CreateAccessTokenDialog.tsx index cb3505f4..4c74578c 100644 --- a/web/src/components/CreateAccessTokenDialog.tsx +++ b/web/src/components/CreateAccessTokenDialog.tsx @@ -1,147 +1,147 @@ -import { Radio, RadioGroup } from "@mui/joy"; -import { Button, Input } from "@usememos/mui"; -import { XIcon } from "lucide-react"; -import React, { useState } from "react"; -import { toast } from "react-hot-toast"; -import { userServiceClient } from "@/grpcweb"; -import useCurrentUser from "@/hooks/useCurrentUser"; -import useLoading from "@/hooks/useLoading"; -import { useTranslate } from "@/utils/i18n"; -import { generateDialog } from "./Dialog"; - -interface Props extends DialogProps { - onConfirm: () => void; -} - -interface State { - description: string; - expiration: number; -} - -const CreateAccessTokenDialog: React.FC = (props: Props) => { - const { destroy, onConfirm } = props; - const t = useTranslate(); - const currentUser = useCurrentUser(); - const [state, setState] = useState({ - description: "", - expiration: 3600 * 8, - }); - const requestState = useLoading(false); - - const expirationOptions = [ - { - label: t("setting.access-token-section.create-dialog.duration-8h"), - value: 3600 * 8, - }, - { - label: t("setting.access-token-section.create-dialog.duration-1m"), - value: 3600 * 24 * 30, - }, - { - label: t("setting.access-token-section.create-dialog.duration-never"), - value: 0, - }, - ]; - - const setPartialState = (partialState: Partial) => { - setState({ - ...state, - ...partialState, - }); - }; - - const handleDescriptionInputChange = (e: React.ChangeEvent) => { - setPartialState({ - description: e.target.value, - }); - }; - - const handleRoleInputChange = (e: React.ChangeEvent) => { - setPartialState({ - expiration: Number(e.target.value), - }); - }; - - const handleSaveBtnClick = async () => { - if (!state.description) { - toast.error(t("message.description-is-required")); - return; - } - - try { - await userServiceClient.createUserAccessToken({ - name: currentUser.name, - description: state.description, - expiresAt: state.expiration ? new Date(Date.now() + state.expiration * 1000) : undefined, - }); - - onConfirm(); - destroy(); - } catch (error: any) { - toast.error(error.details); - console.error(error); - } - }; - - return ( -
-
-

{t("setting.access-token-section.create-dialog.create-access-token")}

- -
-
-
- - {t("setting.access-token-section.create-dialog.description")} * - -
- -
-
-
- - {t("setting.access-token-section.create-dialog.expiration")} * - -
- - {expirationOptions.map((option) => ( - - ))} - -
-
-
- - -
-
-
- ); -}; - -function showCreateAccessTokenDialog(onConfirm: () => void) { - generateDialog( - { - className: "create-access-token-dialog", - dialogName: "create-access-token-dialog", - }, - CreateAccessTokenDialog, - { - onConfirm, - }, - ); -} - -export default showCreateAccessTokenDialog; +import { Radio, RadioGroup } from "@mui/joy"; +import { Button, Input } from "@usememos/mui"; +import { XIcon } from "lucide-react"; +import React, { useState } from "react"; +import { toast } from "react-hot-toast"; +import { userServiceClient } from "@/grpcweb"; +import useCurrentUser from "@/hooks/useCurrentUser"; +import useLoading from "@/hooks/useLoading"; +import { useTranslate } from "@/utils/i18n"; +import { generateDialog } from "./Dialog"; + +interface Props extends DialogProps { + onConfirm: () => void; +} + +interface State { + description: string; + expiration: number; +} + +const CreateAccessTokenDialog: React.FC = (props: Props) => { + const { destroy, onConfirm } = props; + const t = useTranslate(); + const currentUser = useCurrentUser(); + const [state, setState] = useState({ + description: "", + expiration: 3600 * 8, + }); + const requestState = useLoading(false); + + const expirationOptions = [ + { + label: t("setting.access-token-section.create-dialog.duration-8h"), + value: 3600 * 8, + }, + { + label: t("setting.access-token-section.create-dialog.duration-1m"), + value: 3600 * 24 * 30, + }, + { + label: t("setting.access-token-section.create-dialog.duration-never"), + value: 0, + }, + ]; + + const setPartialState = (partialState: Partial) => { + setState({ + ...state, + ...partialState, + }); + }; + + const handleDescriptionInputChange = (e: React.ChangeEvent) => { + setPartialState({ + description: e.target.value, + }); + }; + + const handleRoleInputChange = (e: React.ChangeEvent) => { + setPartialState({ + expiration: Number(e.target.value), + }); + }; + + const handleSaveBtnClick = async () => { + if (!state.description) { + toast.error(t("message.description-is-required")); + return; + } + + try { + await userServiceClient.createUserAccessToken({ + name: currentUser.name, + description: state.description, + expiresAt: state.expiration ? new Date(Date.now() + state.expiration * 1000) : undefined, + }); + + onConfirm(); + destroy(); + } catch (error: any) { + toast.error(error.details); + console.error(error); + } + }; + + return ( +
+
+

{t("setting.access-token-section.create-dialog.create-access-token")}

+ +
+
+
+ + {t("setting.access-token-section.create-dialog.description")} * + +
+ +
+
+
+ + {t("setting.access-token-section.create-dialog.expiration")} * + +
+ + {expirationOptions.map((option) => ( + + ))} + +
+
+
+ + +
+
+
+ ); +}; + +function showCreateAccessTokenDialog(onConfirm: () => void) { + generateDialog( + { + className: "create-access-token-dialog", + dialogName: "create-access-token-dialog", + }, + CreateAccessTokenDialog, + { + onConfirm, + }, + ); +} + +export default showCreateAccessTokenDialog; diff --git a/web/src/components/CreateWebhookDialog.tsx b/web/src/components/CreateWebhookDialog.tsx index a70d6328..b07369ce 100644 --- a/web/src/components/CreateWebhookDialog.tsx +++ b/web/src/components/CreateWebhookDialog.tsx @@ -1,160 +1,160 @@ -import { Button, Input } from "@usememos/mui"; -import { XIcon } from "lucide-react"; -import React, { useEffect, useState } from "react"; -import { toast } from "react-hot-toast"; -import { webhookServiceClient } from "@/grpcweb"; -import useLoading from "@/hooks/useLoading"; -import { useTranslate } from "@/utils/i18n"; -import { generateDialog } from "./Dialog"; - -interface Props extends DialogProps { - webhookId?: number; - onConfirm: () => void; -} - -interface State { - name: string; - url: string; -} - -const CreateWebhookDialog: React.FC = (props: Props) => { - const { webhookId, destroy, onConfirm } = props; - const t = useTranslate(); - const [state, setState] = useState({ - name: "", - url: "", - }); - const requestState = useLoading(false); - const isCreating = webhookId === undefined; - - useEffect(() => { - if (webhookId) { - webhookServiceClient - .getWebhook({ - id: webhookId, - }) - .then((webhook) => { - setState({ - name: webhook.name, - url: webhook.url, - }); - }); - } - }, []); - - const setPartialState = (partialState: Partial) => { - setState({ - ...state, - ...partialState, - }); - }; - - const handleTitleInputChange = (e: React.ChangeEvent) => { - setPartialState({ - name: e.target.value, - }); - }; - - const handleUrlInputChange = (e: React.ChangeEvent) => { - setPartialState({ - url: e.target.value, - }); - }; - - const handleSaveBtnClick = async () => { - if (!state.name || !state.url) { - toast.error(t("message.fill-all-required-fields")); - return; - } - - try { - if (isCreating) { - await webhookServiceClient.createWebhook({ - name: state.name, - url: state.url, - }); - } else { - await webhookServiceClient.updateWebhook({ - webhook: { - id: webhookId, - name: state.name, - url: state.url, - }, - updateMask: ["name", "url"], - }); - } - - onConfirm(); - destroy(); - } catch (error: any) { - console.error(error); - toast.error(error.details); - } - }; - - return ( -
-
-

- {isCreating ? t("setting.webhook-section.create-dialog.create-webhook") : t("setting.webhook-section.create-dialog.edit-webhook")} -

- -
-
-
- - {t("setting.webhook-section.create-dialog.title")} * - -
- -
-
-
- - {t("setting.webhook-section.create-dialog.payload-url")} * - -
- -
-
-
- - -
-
-
- ); -}; - -function showCreateWebhookDialog(onConfirm: () => void) { - generateDialog( - { - className: "create-webhook-dialog", - dialogName: "create-webhook-dialog", - }, - CreateWebhookDialog, - { - onConfirm, - }, - ); -} - -export default showCreateWebhookDialog; +import { Button, Input } from "@usememos/mui"; +import { XIcon } from "lucide-react"; +import React, { useEffect, useState } from "react"; +import { toast } from "react-hot-toast"; +import { webhookServiceClient } from "@/grpcweb"; +import useLoading from "@/hooks/useLoading"; +import { useTranslate } from "@/utils/i18n"; +import { generateDialog } from "./Dialog"; + +interface Props extends DialogProps { + webhookId?: number; + onConfirm: () => void; +} + +interface State { + name: string; + url: string; +} + +const CreateWebhookDialog: React.FC = (props: Props) => { + const { webhookId, destroy, onConfirm } = props; + const t = useTranslate(); + const [state, setState] = useState({ + name: "", + url: "", + }); + const requestState = useLoading(false); + const isCreating = webhookId === undefined; + + useEffect(() => { + if (webhookId) { + webhookServiceClient + .getWebhook({ + id: webhookId, + }) + .then((webhook) => { + setState({ + name: webhook.name, + url: webhook.url, + }); + }); + } + }, []); + + const setPartialState = (partialState: Partial) => { + setState({ + ...state, + ...partialState, + }); + }; + + const handleTitleInputChange = (e: React.ChangeEvent) => { + setPartialState({ + name: e.target.value, + }); + }; + + const handleUrlInputChange = (e: React.ChangeEvent) => { + setPartialState({ + url: e.target.value, + }); + }; + + const handleSaveBtnClick = async () => { + if (!state.name || !state.url) { + toast.error(t("message.fill-all-required-fields")); + return; + } + + try { + if (isCreating) { + await webhookServiceClient.createWebhook({ + name: state.name, + url: state.url, + }); + } else { + await webhookServiceClient.updateWebhook({ + webhook: { + id: webhookId, + name: state.name, + url: state.url, + }, + updateMask: ["name", "url"], + }); + } + + onConfirm(); + destroy(); + } catch (error: any) { + console.error(error); + toast.error(error.details); + } + }; + + return ( +
+
+

+ {isCreating ? t("setting.webhook-section.create-dialog.create-webhook") : t("setting.webhook-section.create-dialog.edit-webhook")} +

+ +
+
+
+ + {t("setting.webhook-section.create-dialog.title")} * + +
+ +
+
+
+ + {t("setting.webhook-section.create-dialog.payload-url")} * + +
+ +
+
+
+ + +
+
+
+ ); +}; + +function showCreateWebhookDialog(onConfirm: () => void) { + generateDialog( + { + className: "create-webhook-dialog", + dialogName: "create-webhook-dialog", + }, + CreateWebhookDialog, + { + onConfirm, + }, + ); +} + +export default showCreateWebhookDialog; diff --git a/web/src/components/LocaleSelect.tsx b/web/src/components/LocaleSelect.tsx index 5662c043..01100404 100644 --- a/web/src/components/LocaleSelect.tsx +++ b/web/src/components/LocaleSelect.tsx @@ -33,7 +33,7 @@ const LocaleSelect: FC = (props: Props) => { ); } - } catch (error) { + } catch { // do nth } diff --git a/web/src/components/MemoActionMenu.tsx b/web/src/components/MemoActionMenu.tsx index b0694cee..29be1442 100644 --- a/web/src/components/MemoActionMenu.tsx +++ b/web/src/components/MemoActionMenu.tsx @@ -77,7 +77,7 @@ const MemoActionMenu = (props: Props) => { ["pinned"], ); } - } catch (error) { + } catch { // do nth } }; @@ -108,7 +108,7 @@ const MemoActionMenu = (props: Props) => { } if (isInMemoDetailPage) { - memo.state === State.ARCHIVED ? navigateTo("/") : navigateTo("/archived"); + navigateTo(memo.state === State.ARCHIVED ? "/" : "/archived"); } memoUpdatedCallback(); }; diff --git a/web/src/components/MemoContent/CodeBlock.tsx b/web/src/components/MemoContent/CodeBlock.tsx index 1b4a14a1..23d34b9e 100644 --- a/web/src/components/MemoContent/CodeBlock.tsx +++ b/web/src/components/MemoContent/CodeBlock.tsx @@ -45,7 +45,7 @@ const CodeBlock: React.FC = ({ language, content }: Props) => { language: formatedLanguage, }).value; } - } catch (error) { + } catch { // Skip error and use default highlighted code. } diff --git a/web/src/components/MemoContent/LineBreak.tsx b/web/src/components/MemoContent/LineBreak.tsx index 2d5db554..b60b1bf6 100644 --- a/web/src/components/MemoContent/LineBreak.tsx +++ b/web/src/components/MemoContent/LineBreak.tsx @@ -1,8 +1,4 @@ -import { BaseProps } from "./types"; - -interface Props extends BaseProps {} - -const LineBreak: React.FC = () => { +const LineBreak = () => { return
; }; diff --git a/web/src/components/MemoContent/Link.tsx b/web/src/components/MemoContent/Link.tsx index 24162a73..f507efcc 100644 --- a/web/src/components/MemoContent/Link.tsx +++ b/web/src/components/MemoContent/Link.tsx @@ -14,7 +14,7 @@ const getFaviconWithGoogleS2 = (url: string) => { try { const urlObject = new URL(url); return `https://www.google.com/s2/favicons?sz=128&domain=${urlObject.hostname}`; - } catch (error) { + } catch { return undefined; } }; diff --git a/web/src/components/MemoEditor/ActionButton/AddMemoRelationPopover.tsx b/web/src/components/MemoEditor/ActionButton/AddMemoRelationPopover.tsx index 94919ba6..575b3ea0 100644 --- a/web/src/components/MemoEditor/ActionButton/AddMemoRelationPopover.tsx +++ b/web/src/components/MemoEditor/ActionButton/AddMemoRelationPopover.tsx @@ -1,187 +1,187 @@ -import { Autocomplete, AutocompleteOption, Chip } from "@mui/joy"; -import { Button, Checkbox } from "@usememos/mui"; -import { uniqBy } from "lodash-es"; -import { LinkIcon } from "lucide-react"; -import React, { useContext, useState } from "react"; -import { toast } from "react-hot-toast"; -import useDebounce from "react-use/lib/useDebounce"; -import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/Popover"; -import { memoServiceClient } from "@/grpcweb"; -import { DEFAULT_LIST_MEMOS_PAGE_SIZE } from "@/helpers/consts"; -import useCurrentUser from "@/hooks/useCurrentUser"; -import { extractMemoIdFromName } from "@/store/v1"; -import { Memo, MemoRelation_Memo, MemoRelation_Type } from "@/types/proto/api/v1/memo_service"; -import { useTranslate } from "@/utils/i18n"; -import { EditorRefActions } from "../Editor"; -import { MemoEditorContext } from "../types"; - -interface Props { - editorRef: React.RefObject; -} - -const AddMemoRelationPopover = (props: Props) => { - const { editorRef } = props; - const t = useTranslate(); - const context = useContext(MemoEditorContext); - const user = useCurrentUser(); - const [searchText, setSearchText] = useState(""); - const [isFetching, setIsFetching] = useState(true); - const [fetchedMemos, setFetchedMemos] = useState([]); - const [selectedMemos, setSelectedMemos] = useState([]); - const [embedded, setEmbedded] = useState(false); - const [popoverOpen, setPopoverOpen] = useState(false); - - const filteredMemos = fetchedMemos.filter( - (memo) => - !selectedMemos.includes(memo) && - memo.name !== context.memoName && - !context.relationList.some((relation) => relation.relatedMemo?.name === memo.name), - ); - - useDebounce( - async () => { - if (!popoverOpen) return; - - setIsFetching(true); - try { - const conditions = []; - if (searchText) { - conditions.push(`content_search == [${JSON.stringify(searchText)}]`); - } - const { memos } = await memoServiceClient.listMemos({ - parent: user.name, - pageSize: DEFAULT_LIST_MEMOS_PAGE_SIZE, - oldFilter: conditions.length > 0 ? conditions.join(" && ") : undefined, - }); - setFetchedMemos(memos); - } catch (error: any) { - toast.error(error.details); - console.error(error); - } - setIsFetching(false); - }, - 300, - [popoverOpen, searchText], - ); - - const getHighlightedContent = (content: string) => { - const index = content.toLowerCase().indexOf(searchText.toLowerCase()); - if (index === -1) { - return content; - } - let before = content.slice(0, index); - if (before.length > 20) { - before = "..." + before.slice(before.length - 20); - } - const highlighted = content.slice(index, index + searchText.length); - let after = content.slice(index + searchText.length); - if (after.length > 20) { - after = after.slice(0, 20) + "..."; - } - - return ( - <> - {before} - {highlighted} - {after} - - ); - }; - - const addMemoRelations = async () => { - // If embedded mode is enabled, embed the memo instead of creating a relation. - if (embedded) { - if (!editorRef.current) { - toast.error(t("message.failed-to-embed-memo")); - return; - } - - const cursorPosition = editorRef.current.getCursorPosition(); - const prevValue = editorRef.current.getContent().slice(0, cursorPosition); - if (prevValue !== "" && !prevValue.endsWith("\n")) { - editorRef.current.insertText("\n"); - } - for (const memo of selectedMemos) { - editorRef.current.insertText(`![[memos/${extractMemoIdFromName(memo.name)}]]\n`); - } - setTimeout(() => { - editorRef.current?.scrollToCursor(); - editorRef.current?.focus(); - }); - } else { - context.setRelationList( - uniqBy( - [ - ...selectedMemos.map((memo) => ({ - memo: MemoRelation_Memo.fromPartial({ name: memo.name }), - relatedMemo: MemoRelation_Memo.fromPartial({ name: memo.name }), - type: MemoRelation_Type.REFERENCE, - })), - ...context.relationList, - ].filter((relation) => relation.relatedMemo !== context.memoName), - "relatedMemo", - ), - ); - } - setSelectedMemos([]); - setPopoverOpen(false); - }; - - return ( - - - - - -
- setSearchText(value.trim())} - getOptionKey={(memo) => memo.name} - getOptionLabel={(memo) => memo.content} - isOptionEqualToValue={(memo, value) => memo.name === value.name} - renderOption={(props, memo) => ( - -
-

{memo.displayTime?.toLocaleString()}

-

{searchText ? getHighlightedContent(memo.content) : memo.snippet}

-
-
- )} - renderTags={(memos) => - memos.map((memo) => ( - -
-

{memo.displayTime?.toLocaleString()}

- {memo.content} -
-
- )) - } - onChange={(_, value) => setSelectedMemos(value)} - /> -
- setEmbedded(e.target.checked)} /> - -
-
-
-
- ); -}; - -export default AddMemoRelationPopover; +import { Autocomplete, AutocompleteOption, Chip } from "@mui/joy"; +import { Button, Checkbox } from "@usememos/mui"; +import { uniqBy } from "lodash-es"; +import { LinkIcon } from "lucide-react"; +import React, { useContext, useState } from "react"; +import { toast } from "react-hot-toast"; +import useDebounce from "react-use/lib/useDebounce"; +import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/Popover"; +import { memoServiceClient } from "@/grpcweb"; +import { DEFAULT_LIST_MEMOS_PAGE_SIZE } from "@/helpers/consts"; +import useCurrentUser from "@/hooks/useCurrentUser"; +import { extractMemoIdFromName } from "@/store/v1"; +import { Memo, MemoRelation_Memo, MemoRelation_Type } from "@/types/proto/api/v1/memo_service"; +import { useTranslate } from "@/utils/i18n"; +import { EditorRefActions } from "../Editor"; +import { MemoEditorContext } from "../types"; + +interface Props { + editorRef: React.RefObject; +} + +const AddMemoRelationPopover = (props: Props) => { + const { editorRef } = props; + const t = useTranslate(); + const context = useContext(MemoEditorContext); + const user = useCurrentUser(); + const [searchText, setSearchText] = useState(""); + const [isFetching, setIsFetching] = useState(true); + const [fetchedMemos, setFetchedMemos] = useState([]); + const [selectedMemos, setSelectedMemos] = useState([]); + const [embedded, setEmbedded] = useState(false); + const [popoverOpen, setPopoverOpen] = useState(false); + + const filteredMemos = fetchedMemos.filter( + (memo) => + !selectedMemos.includes(memo) && + memo.name !== context.memoName && + !context.relationList.some((relation) => relation.relatedMemo?.name === memo.name), + ); + + useDebounce( + async () => { + if (!popoverOpen) return; + + setIsFetching(true); + try { + const conditions = []; + if (searchText) { + conditions.push(`content_search == [${JSON.stringify(searchText)}]`); + } + const { memos } = await memoServiceClient.listMemos({ + parent: user.name, + pageSize: DEFAULT_LIST_MEMOS_PAGE_SIZE, + oldFilter: conditions.length > 0 ? conditions.join(" && ") : undefined, + }); + setFetchedMemos(memos); + } catch (error: any) { + toast.error(error.details); + console.error(error); + } + setIsFetching(false); + }, + 300, + [popoverOpen, searchText], + ); + + const getHighlightedContent = (content: string) => { + const index = content.toLowerCase().indexOf(searchText.toLowerCase()); + if (index === -1) { + return content; + } + let before = content.slice(0, index); + if (before.length > 20) { + before = "..." + before.slice(before.length - 20); + } + const highlighted = content.slice(index, index + searchText.length); + let after = content.slice(index + searchText.length); + if (after.length > 20) { + after = after.slice(0, 20) + "..."; + } + + return ( + <> + {before} + {highlighted} + {after} + + ); + }; + + const addMemoRelations = async () => { + // If embedded mode is enabled, embed the memo instead of creating a relation. + if (embedded) { + if (!editorRef.current) { + toast.error(t("message.failed-to-embed-memo")); + return; + } + + const cursorPosition = editorRef.current.getCursorPosition(); + const prevValue = editorRef.current.getContent().slice(0, cursorPosition); + if (prevValue !== "" && !prevValue.endsWith("\n")) { + editorRef.current.insertText("\n"); + } + for (const memo of selectedMemos) { + editorRef.current.insertText(`![[memos/${extractMemoIdFromName(memo.name)}]]\n`); + } + setTimeout(() => { + editorRef.current?.scrollToCursor(); + editorRef.current?.focus(); + }); + } else { + context.setRelationList( + uniqBy( + [ + ...selectedMemos.map((memo) => ({ + memo: MemoRelation_Memo.fromPartial({ name: memo.name }), + relatedMemo: MemoRelation_Memo.fromPartial({ name: memo.name }), + type: MemoRelation_Type.REFERENCE, + })), + ...context.relationList, + ].filter((relation) => relation.relatedMemo !== context.memoName), + "relatedMemo", + ), + ); + } + setSelectedMemos([]); + setPopoverOpen(false); + }; + + return ( + + + + + +
+ setSearchText(value.trim())} + getOptionKey={(memo) => memo.name} + getOptionLabel={(memo) => memo.content} + isOptionEqualToValue={(memo, value) => memo.name === value.name} + renderOption={(props, memo) => ( + +
+

{memo.displayTime?.toLocaleString()}

+

{searchText ? getHighlightedContent(memo.content) : memo.snippet}

+
+
+ )} + renderTags={(memos) => + memos.map((memo) => ( + +
+

{memo.displayTime?.toLocaleString()}

+ {memo.content} +
+
+ )) + } + onChange={(_, value) => setSelectedMemos(value)} + /> +
+ setEmbedded(e.target.checked)} /> + +
+
+
+
+ ); +}; + +export default AddMemoRelationPopover; diff --git a/web/src/components/MemoEditor/Editor/TagSuggestions.tsx b/web/src/components/MemoEditor/Editor/TagSuggestions.tsx index 26ca72f8..41bb958e 100644 --- a/web/src/components/MemoEditor/Editor/TagSuggestions.tsx +++ b/web/src/components/MemoEditor/Editor/TagSuggestions.tsx @@ -86,7 +86,11 @@ const TagSuggestions = observer(({ editorRef, editorActions }: Props) => { const caretCordinates = getCaretCoordinates(editor, index); caretCordinates.top -= editor.scrollTop; - isActive ? setPosition(caretCordinates) : hide(); + if (isActive) { + setPosition(caretCordinates); + } else { + hide(); + } }; const listenersAreRegisteredRef = useRef(false); diff --git a/web/src/components/MemoRelationForceGraph/types.ts b/web/src/components/MemoRelationForceGraph/types.ts index b91afad7..3860ef49 100644 --- a/web/src/components/MemoRelationForceGraph/types.ts +++ b/web/src/components/MemoRelationForceGraph/types.ts @@ -4,6 +4,7 @@ export interface NodeType { memo: MemoRelation_Memo; } +// eslint-disable-next-line @typescript-eslint/no-empty-object-type export interface LinkType { // ...add more additional properties relevant to the link here. } diff --git a/web/src/components/ReactionSelector.tsx b/web/src/components/ReactionSelector.tsx index 2a6ed256..45783434 100644 --- a/web/src/components/ReactionSelector.tsx +++ b/web/src/components/ReactionSelector.tsx @@ -49,7 +49,7 @@ const ReactionSelector = (props: Props) => { }); } await memoStore.getOrFetchMemoByName(memo.name, { skipCache: true }); - } catch (error) { + } catch { // skip error. } setOpen(false); diff --git a/web/src/components/ReactionView.tsx b/web/src/components/ReactionView.tsx index 5a33e3ac..6e52cb1d 100644 --- a/web/src/components/ReactionView.tsx +++ b/web/src/components/ReactionView.tsx @@ -58,7 +58,7 @@ const ReactionView = (props: Props) => { await memoServiceClient.deleteMemoReaction({ id: reaction.id }); } } - } catch (error) { + } catch { // Skip error. } await memoStore.getOrFetchMemoByName(memo.name, { skipCache: true }); diff --git a/web/src/components/ui/Popover.tsx b/web/src/components/ui/Popover.tsx index a642ea97..9431efc4 100644 --- a/web/src/components/ui/Popover.tsx +++ b/web/src/components/ui/Popover.tsx @@ -9,7 +9,6 @@ const PopoverTrigger = PopoverPrimitive.Trigger; const PopoverContent = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef - // eslint-disable-next-line react/prop-types >(({ className, align = "center", sideOffset = 4, ...props }, ref) => ( { try { new URL(url); return true; - } catch (err) { + } catch { return false; } };