From 4ff29a8a4a62d1d0f235fbcf959f7807214e5319 Mon Sep 17 00:00:00 2001 From: "Mr.Hope" Date: Mon, 6 May 2024 02:52:16 +0800 Subject: [PATCH] chore: bump deps --- .eslintrc.yml | 369 -- docs/package.json | 6 +- docs/src/.vuepress/client.ts | 2 +- docs/src/.vuepress/shims-vue.d.ts | 2 +- eslint.config.js | 168 +- package.json | 37 +- packages/admin/package.json | 12 +- packages/admin/src/App.jsx | 2 +- packages/admin/src/components/Header.jsx | 4 +- .../admin/src/components/useRecaptchaV3.js | 2 +- packages/admin/src/components/useScript.js | 2 +- packages/admin/src/components/useTurnstile.js | 2 +- .../admin/src/pages/manage-comments/index.jsx | 4 +- packages/admin/src/pages/migration/index.jsx | 2 +- packages/admin/src/pages/profile/index.jsx | 2 +- .../admin/src/pages/profile/twoFactorAuth.jsx | 2 +- packages/admin/src/store/user.js | 2 +- packages/api/src/articleCounter.ts | 9 +- packages/api/src/comment.ts | 17 +- packages/api/src/commentCount.ts | 8 +- packages/api/src/login.ts | 2 +- packages/api/src/pageview.ts | 9 +- packages/api/src/recentComment.ts | 5 +- packages/api/src/user.ts | 10 +- packages/client/__tests__/wordCount.spec.ts | 2 +- packages/client/package.json | 10 +- packages/client/src/comment.ts | 4 +- .../client/src/components/ArticleReaction.vue | 81 +- packages/client/src/components/CommentBox.vue | 784 ++-- .../client/src/components/CommentCard.vue | 186 +- packages/client/src/components/Icons.ts | 3 +- packages/client/src/components/ImageWall.vue | 64 +- .../client/src/components/WalineComment.vue | 185 +- packages/client/src/composables/inputs.ts | 3 +- packages/client/src/composables/like.ts | 2 +- packages/client/src/composables/reaction.ts | 2 +- .../client/src/composables/recaptchaV3.ts | 3 +- packages/client/src/composables/userInfo.ts | 4 +- packages/client/src/config/default.ts | 12 +- packages/client/src/config/i18n/generate.ts | 2 +- packages/client/src/config/i18n/index.ts | 2 +- packages/client/src/entries/comment.ts | 1 + packages/client/src/entries/pageview.ts | 1 + packages/client/src/init.ts | 2 +- packages/client/src/pageview.ts | 11 +- packages/client/src/shims-vue.d.ts | 2 +- packages/client/src/typings/options.ts | 2 +- packages/client/src/typings/waline.ts | 22 +- packages/client/src/utils/config.ts | 16 +- packages/client/src/utils/date.ts | 2 +- packages/client/src/utils/emoji.ts | 4 +- packages/client/src/utils/markdown.ts | 8 +- .../client/src/utils/markedMathExtension.ts | 4 +- packages/client/src/widgets/recentComments.ts | 3 +- packages/client/src/widgets/userList.ts | 5 +- packages/client/vite.config.ts | 1 + packages/server/package.json | 2 +- pnpm-lock.yaml | 3284 +++++++---------- 58 files changed, 2203 insertions(+), 3196 deletions(-) delete mode 100644 .eslintrc.yml diff --git a/.eslintrc.yml b/.eslintrc.yml deleted file mode 100644 index 7dc0cbca250..00000000000 --- a/.eslintrc.yml +++ /dev/null @@ -1,369 +0,0 @@ -root: true - -env: - node: true - es6: true - -extends: - - eslint:recommended - - plugin:prettier/recommended - -ignorePatterns: - - '!.vuepress/**' - - .vuepress/.cache/** - - .vuepress/.temp/** - - '**/dist/**' - - '**/node_modules/**' - - example/** - -plugins: - - import - -parserOptions: - ecmaVersion: 2021 - extraFileExtensions: - - .vue - -rules: - import/consistent-type-specifier-style: - - error - - prefer-inline - - import/dynamic-import-chunkname: - - error - - import/first: - - error - - import/newline-after-import: - - error - - import/no-commonjs: - - error - - import/no-cycle: - - error - - import/no-duplicates: - - error - - considerQueryString: true - prefer-inline: true - - import/no-named-default: - - error - - import/order: - - error - - alphabetize: - order: asc - orderImportKind: asc - groups: - - builtin - - external - - internal - - - parent - - sibling - - index - - object - newlines-between: always - - padding-line-between-statements: - - error - - blankLine: always - prev: - - const - - let - next: - - '*' - - blankLine: any - prev: - - const - - let - next: - - const - - let - - blankLine: always - prev: - - '*' - next: - - return - - vue/block-lang: - - error - - script: - lang: ts - - vue/block-tag-newline: - - error - - vue/component-api-style: - - error - - vue/component-name-in-template-casing: - - error - - vue/component-options-name-casing: - - error - - vue/custom-event-name-casing: - - error - - vue/define-emits-declaration: - - error - - vue/define-macros-order: - - error - - vue/define-props-declaration: - - error - - vue/html-button-has-type: - - error - - vue/html-comment-content-newline: - - error - - vue/html-comment-content-spacing: - - error - - vue/html-comment-indent: - - error - - vue/match-component-file-name: - - error - - vue/match-component-import-name: - - error - - vue/new-line-between-multi-line-property: - - error - - vue/next-tick-style: - - error - - vue/no-boolean-default: - - warn - - vue/no-duplicate-attr-inheritance: - - error - - vue/no-empty-component-block: - - error - - vue/no-multiple-objects-in-class: - - error - - vue/no-potential-component-option-typo: - - error - - vue/no-ref-object-destructure: - - error - - vue/no-required-prop-with-default: - - error - - vue/no-static-inline-styles: - - error - - vue/no-template-target-blank: - - error - - vue/no-this-in-before-route-enter: - - error - - vue/no-undef-components: - - error - - vue/no-undef-properties: - - warn - - vue/no-unsupported-features: - - error - - vue/no-unused-properties: - - error - - vue/no-unused-refs: - - error - - vue/no-useless-mustaches: - - error - - vue/no-useless-v-bind: - - error - - vue/padding-line-between-blocks: - - error - - vue/padding-line-between-tags: - - error - - vue/prefer-prop-type-boolean-first: - - error - - vue/prefer-separate-static-class: - - error - - vue/prefer-true-attribute-shorthand: - - error - - vue/require-direct-export: - - error - - vue/require-emit-validator: - - warn - - vue/require-expose: - - error - - vue/require-name-property: - - error - - vue/require-prop-comment: - - error - - vue/script-indent: - - error - - vue/static-class-names-order: - - error - - vue/v-for-delimiter-style: - - error - -overrides: - - files: - - '*.ts' - - extends: - - plugin:@typescript-eslint/eslint-recommended - - plugin:@typescript-eslint/recommended - - plugin:@typescript-eslint/recommended-requiring-type-checking - - plugin:prettier/recommended - - parser: '@typescript-eslint/parser' - - parserOptions: - project: - - './tsconfig.json' - - rules: - '@typescript-eslint/ban-ts-comment': - - off - - '@typescript-eslint/explicit-function-return-type': - - warn - - allowTypedFunctionExpressions: true - - '@typescript-eslint/naming-convention': - - warn - - selector: default - format: - - camelCase - leadingUnderscore: allowSingleOrDouble - trailingUnderscore: allow - - - selector: - - variable - format: - - camelCase - - PascalCase - - UPPER_CASE - leadingUnderscore: allowSingleOrDouble - trailingUnderscore: allowSingleOrDouble - - - selector: - - parameter - format: - - camelCase - - PascalCase - leadingUnderscore: allow - trailingUnderscore: allow - - - selector: - - property - format: null - custom: - regex: (^/.*/$|^@|^[a-z]+(?:-[a-z]+)*?$) - match: true - # allow locales path like `/zh/`, alias starting with `@` and css property like `line-width` - filter: (^/.*/$|^@|^[a-z]+(?:-[a-z]+)*?$) - leadingUnderscore: allow - trailingUnderscore: allow - - - selector: - - property - format: - - camelCase - - PascalCase - - UPPER_CASE - leadingUnderscore: allow - trailingUnderscore: allow - - - selector: import - format: - - PascalCase - - camelCase - - - selector: typeLike - format: - - PascalCase - - '@typescript-eslint/no-explicit-any': - - warn - - ignoreRestArgs: true - - '@typescript-eslint/no-non-null-assertion': - - off - - '@typescript-eslint/no-unsafe-member-access': - - warn - - - files: - - '*.vue' - - extends: - - plugin:vue/vue3-recommended - - plugin:@typescript-eslint/recommended - - plugin:@typescript-eslint/recommended-requiring-type-checking - - plugin:prettier/recommended - - parser: vue-eslint-parser - - parserOptions: - parser: '@typescript-eslint/parser' - project: - - './tsconfig.json' - extraFileExtensions: - - .vue - vueFeatures: - filter: false - - rules: - '@typescript-eslint/no-non-null-assertion': - - off - - - files: - - '*.d.ts' - rules: - no-underscore-dangle: - - off - - - files: - - '**/__tests__/**/*.spec.{j,t}s?(x)' - - rules: - '@typescript-eslint/no-explicit-any': - - off - '@typescript-eslint/no-unsafe-call': - - off - '@typescript-eslint/no-unsafe-assignment': - - off - '@typescript-eslint/no-unsafe-member-access': - - off - - - files: - - commitlint.config.js - rules: - import/no-commonjs: - - off diff --git a/docs/package.json b/docs/package.json index c49ded6f64f..943adab9977 100644 --- a/docs/package.json +++ b/docs/package.json @@ -16,9 +16,9 @@ "@waline/client": "workspace:*", "marked": "12.0.2", "mathjax-full": "3.2.2", - "vue": "3.4.23", + "vue": "3.4.26", "vuepress": "2.0.0-rc.9", - "vuepress-shared": "2.0.0-rc.37", - "vuepress-theme-hope": "2.0.0-rc.37" + "vuepress-shared": "2.0.0-rc.38", + "vuepress-theme-hope": "2.0.0-rc.38" } } diff --git a/docs/src/.vuepress/client.ts b/docs/src/.vuepress/client.ts index 8b78731f32a..f5ccfb95cd9 100644 --- a/docs/src/.vuepress/client.ts +++ b/docs/src/.vuepress/client.ts @@ -1,5 +1,5 @@ import { Fancybox } from '@fancyapps/ui/dist/fancybox/fancybox.esm.js'; -import { onMounted, onBeforeUnmount } from 'vue'; +import { onBeforeUnmount, onMounted } from 'vue'; import { defineClientConfig } from 'vuepress/client'; export default defineClientConfig({ diff --git a/docs/src/.vuepress/shims-vue.d.ts b/docs/src/.vuepress/shims-vue.d.ts index 215f60f4abb..8afcdfbbc5c 100644 --- a/docs/src/.vuepress/shims-vue.d.ts +++ b/docs/src/.vuepress/shims-vue.d.ts @@ -1,5 +1,5 @@ declare module '*.vue' { - import { type DefineComponent } from 'vue'; + import type { DefineComponent } from 'vue'; const component: DefineComponent; export default component; diff --git a/eslint.config.js b/eslint.config.js index d0e34e1a16b..5d447319772 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,20 +1,15 @@ // @ts-check -import js from '@eslint/js'; -import eslintImport from 'eslint-plugin-import'; -import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'; +import hopeConfig, { + config, + globals, + tsParser, +} from 'eslint-config-mister-hope'; +import { vue, vueParser } from 'eslint-config-mister-hope/vue'; import reactRecommended from 'eslint-plugin-react/configs/recommended.js'; -import vitest from 'eslint-plugin-vitest'; -import pluginVue from 'eslint-plugin-vue'; -import globals from 'globals'; -import tseslint from 'typescript-eslint'; -import vueParser from 'vue-eslint-parser'; -export default tseslint.config( - js.configs.recommended, - ...tseslint.configs.recommendedTypeChecked, - ...tseslint.configs.stylisticTypeChecked, - // @ts-expect-error: The type does not fit - ...pluginVue.configs['flat/recommended'], +export default config( + ...vue, + ...hopeConfig, { ignores: [ '**/.vuepress/.cache/**', @@ -28,23 +23,21 @@ export default tseslint.config( '**/node_modules/**', ], }, + { languageOptions: { ecmaVersion: 'latest', sourceType: 'module', parser: vueParser, parserOptions: { - parser: tseslint.parser, + parser: tsParser, tsconfigDirName: import.meta.dirname, project: ['./tsconfig.eslint.json'], extraFileExtensions: ['.vue'], }, }, }, - { - files: ['**/*.{cjs,js,jsx}'], - ...tseslint.configs.disableTypeChecked, - }, + { files: ['packages/admin/src/**.{js,jsx}'], ...reactRecommended, @@ -65,71 +58,10 @@ export default tseslint.config( }, }, }, - { - plugins: { - import: eslintImport, - }, - rules: { - 'padding-line-between-statements': [ - 'error', - { - blankLine: 'always', - prev: ['const', 'let'], - next: ['*'], - }, - { - blankLine: 'any', - prev: ['const', 'let'], - next: ['const', 'let'], - }, - { - blankLine: 'always', - prev: ['*'], - next: ['return'], - }, - ], - 'import/consistent-type-specifier-style': ['error', 'prefer-inline'], - 'import/dynamic-import-chunkname': 'error', - 'import/first': 'error', - 'import/newline-after-import': 'error', - 'import/no-commonjs': 'error', - 'import/no-cycle': 'error', - 'import/no-duplicates': [ - 'error', - { - considerQueryString: true, - 'prefer-inline': true, - }, - ], - 'import/no-named-default': 'error', - 'import/order': [ - 'error', - { - alphabetize: { - order: 'asc', - orderImportKind: 'asc', - }, - groups: [ - 'builtin', - 'external', - 'internal', - ['parent', 'sibling'], - 'index', - 'object', - ], - 'newlines-between': 'always', - }, - ], - }, - }, + { files: ['**/*.{ts,vue}'], rules: { - '@typescript-eslint/ban-ts-comment': 'off', - '@typescript-eslint/explicit-function-return-type': [ - 'warn', - { allowTypedFunctionExpressions: true }, - ], '@typescript-eslint/naming-convention': [ 'warn', { @@ -174,75 +106,21 @@ export default tseslint.config( format: ['PascalCase'], }, ], - '@typescript-eslint/no-explicit-any': [ - 'warn', - { - ignoreRestArgs: true, - }, - ], - '@typescript-eslint/no-non-null-assertion': 'off', - '@typescript-eslint/no-unsafe-member-access': 'warn', }, }, + { files: ['packages/client/src/**/*.{ts,vue}'], rules: { 'vue/block-lang': [ 'error', { - script: { - lang: 'ts', - }, + script: { lang: 'ts' }, }, ], - 'vue/block-tag-newline': 'error', - 'vue/component-api-style': 'error', - 'vue/component-name-in-template-casing': 'error', - 'vue/component-options-name-casing': 'error', - 'vue/custom-event-name-casing': 'error', - 'vue/define-emits-declaration': 'error', - 'vue/define-macros-order': 'error', - 'vue/define-props-declaration': 'error', - 'vue/html-button-has-type': 'error', - 'vue/html-comment-content-newline': 'error', - 'vue/html-comment-content-spacing': 'error', - 'vue/html-comment-indent': 'error', - 'vue/match-component-file-name': 'error', - 'vue/match-component-import-name': 'error', - 'vue/new-line-between-multi-line-property': 'error', - 'vue/next-tick-style': 'error', - 'vue/no-boolean-default': 'warn', - 'vue/no-duplicate-attr-inheritance': 'error', - 'vue/no-empty-component-block': 'error', - 'vue/no-multiple-objects-in-class': 'error', - 'vue/no-potential-component-option-typo': 'error', - 'vue/no-ref-object-destructure': 'error', - 'vue/no-required-prop-with-default': 'error', - 'vue/no-static-inline-styles': 'error', - 'vue/no-template-target-blank': 'error', - 'vue/no-this-in-before-route-enter': 'error', - 'vue/no-undef-components': 'error', - 'vue/no-undef-properties': 'warn', - 'vue/no-unsupported-features': 'error', - 'vue/no-unused-properties': 'error', - 'vue/no-unused-refs': 'error', - 'vue/no-useless-mustaches': 'error', - 'vue/no-useless-v-bind': 'error', - 'vue/padding-line-between-blocks': 'error', - 'vue/padding-line-between-tags': 'error', - 'vue/prefer-prop-type-boolean-first': 'error', - 'vue/prefer-separate-static-class': 'error', - 'vue/prefer-true-attribute-shorthand': 'error', - 'vue/require-direct-export': 'error', - 'vue/require-emit-validator': 'warn', - 'vue/require-expose': 'error', - 'vue/require-name-property': 'error', - 'vue/require-prop-comment': 'error', - 'vue/script-indent': 'error', - 'vue/static-class-names-order': 'error', - 'vue/v-for-delimiter-style': 'error', }, }, + { files: [ 'packages/cloudbase/**/*.js', @@ -258,6 +136,7 @@ export default tseslint.config( 'import/no-commonjs': 'off', }, }, + { files: ['packages/cloudbase/**/*.js', 'packages/server/**/*.{js,ts}'], languageOptions: { @@ -266,6 +145,7 @@ export default tseslint.config( }, }, }, + { files: ['packages/server/**/*.{js,ts}'], rules: { @@ -273,21 +153,11 @@ export default tseslint.config( '@typescript-eslint/no-empty-function': 'off', }, }, + { files: ['scripts/**.js'], languageOptions: { globals: globals.node, }, }, - { - files: ['**/__tests__/**/*.spec.{j,t}s'], - plugins: { - vitest, - }, - rules: { - ...vitest.configs.recommended.rules, - }, - }, - - eslintPluginPrettierRecommended, ); diff --git a/package.json b/package.json index 690bd08f440..41a26092620 100644 --- a/package.json +++ b/package.json @@ -40,60 +40,49 @@ "singleQuote": true }, "devDependencies": { - "@babel/core": "7.24.4", + "@babel/core": "7.24.5", "@babel/plugin-transform-runtime": "7.24.3", - "@babel/preset-env": "7.24.4", + "@babel/preset-env": "7.24.5", "@babel/preset-react": "7.24.1", - "@babel/runtime": "7.24.4", - "@commitlint/cli": "19.2.2", + "@babel/runtime": "7.24.5", + "@commitlint/cli": "19.3.0", "@commitlint/config-conventional": "19.2.2", - "@eslint/js": "8.57.0", "@rollup/plugin-commonjs": "25.0.7", "@rollup/plugin-node-resolve": "15.2.3", "@rollup/plugin-replace": "5.0.5", - "@types/node": "20.12.7", - "@typescript-eslint/eslint-plugin": "7.7.0", - "@typescript-eslint/parser": "7.7.0", + "@types/node": "20.12.8", "@vitejs/plugin-react": "4.2.1", - "@vue/eslint-config-prettier": "9.0.0", - "@vue/eslint-config-typescript": "13.0.0", "apidoc": "1.2.0", "commitizen": "4.3.0", - "conventional-changelog-cli": "4.1.0", "cross-env": "7.0.3", "cz-conventional-changelog": "3.3.0", "eslint": "8.57.0", - "eslint-config-prettier": "9.1.0", - "eslint-plugin-import": "2.29.1", - "eslint-plugin-prettier": "5.1.3", + "eslint-config-mister-hope": "0.0.10", "eslint-plugin-react": "7.34.1", - "eslint-plugin-vitest": "0.5.3", "eslint-plugin-vue": "9.25.0", - "globals": "15.0.0", "husky": "9.0.11", "markdownlint-cli2": "0.13.0", "nano-staged": "0.8.0", "postcss": "8.4.38", "prettier": "3.2.5", "rimraf": "5.0.5", - "rollup": "4.16.1", + "rollup": "4.17.2", "rollup-plugin-dts": "6.1.0", "rollup-plugin-esbuild": "6.1.1", "rollup-plugin-ts": "3.4.5", - "sass": "1.75.0", + "sass": "1.76.0", "sort-package-json": "2.10.0", "stylelint": "16.5.0", "stylelint-config-hope": "6.0.1", "tslib": "2.6.2", "typescript": "5.4.5", - "typescript-eslint": "7.7.0", - "vercel": "34.1.7", - "vite": "5.2.10", - "vite-plugin-css-injected-by-js": "3.5.0", + "vercel": "34.1.8", + "vite": "5.2.11", + "vite-plugin-css-injected-by-js": "3.5.1", "vite-plugin-svgr": "4.2.0", - "vitest": "1.5.0" + "vitest": "1.6.0" }, - "packageManager": "pnpm@9.0.5", + "packageManager": "pnpm@9.0.6", "apidoc": { "title": "Waline API Documentation" } diff --git a/packages/admin/package.json b/packages/admin/package.json index 7994d46079f..d2cdddcaa42 100644 --- a/packages/admin/package.json +++ b/packages/admin/package.json @@ -50,15 +50,15 @@ "@rematch/core": "2.2.0", "base-icon": "2.3.2", "classnames": "2.5.1", - "i18next": "23.11.2", + "i18next": "23.11.3", "i18next-browser-languagedetector": "7.2.1", "md5": "2.3.0", "qrcode.react": "3.1.0", - "react": "18.2.0", - "react-dom": "18.2.0", - "react-i18next": "14.1.0", - "react-redux": "9.1.1", - "react-router-dom": "6.22.3", + "react": "18.3.1", + "react-dom": "18.3.1", + "react-i18next": "14.1.1", + "react-redux": "9.1.2", + "react-router-dom": "6.23.0", "redux": "5.0.1", "typescript": "5.4.5" }, diff --git a/packages/admin/src/App.jsx b/packages/admin/src/App.jsx index ba3797e5eb2..474a8d9c490 100644 --- a/packages/admin/src/App.jsx +++ b/packages/admin/src/App.jsx @@ -1,6 +1,6 @@ import React, { useEffect } from 'react'; import { Provider, useSelector } from 'react-redux'; -import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'; +import { Route, BrowserRouter as Router, Routes } from 'react-router-dom'; import Forgot from './pages/forgot'; import Login from './pages/login'; diff --git a/packages/admin/src/components/Header.jsx b/packages/admin/src/components/Header.jsx index 0d86d73d41c..581667a8505 100644 --- a/packages/admin/src/components/Header.jsx +++ b/packages/admin/src/components/Header.jsx @@ -1,5 +1,5 @@ -import React, { useState, useMemo, useEffect } from 'react'; -import { useTranslation, Trans } from 'react-i18next'; +import React, { useEffect, useMemo, useState } from 'react'; +import { Trans, useTranslation } from 'react-i18next'; import { useDispatch, useSelector } from 'react-redux'; import { Link, useNavigate } from 'react-router-dom'; diff --git a/packages/admin/src/components/useRecaptchaV3.js b/packages/admin/src/components/useRecaptchaV3.js index b25c5818fdc..1d58db518c9 100644 --- a/packages/admin/src/components/useRecaptchaV3.js +++ b/packages/admin/src/components/useRecaptchaV3.js @@ -1,4 +1,4 @@ -import { useState, useEffect } from 'react'; +import { useEffect, useState } from 'react'; import useScript from './useScript.js'; diff --git a/packages/admin/src/components/useScript.js b/packages/admin/src/components/useScript.js index 110c700cf43..78744f49dd4 100644 --- a/packages/admin/src/components/useScript.js +++ b/packages/admin/src/components/useScript.js @@ -1,6 +1,6 @@ // The hooks original author is @hupe1980 fork from https://github.com/hupe1980/react-script-hook/blob/master/src/use-script.tsx -import { useState, useEffect } from 'react'; +import { useEffect, useState } from 'react'; // Previously loading/loaded scripts and their current status export const scripts = {}; diff --git a/packages/admin/src/components/useTurnstile.js b/packages/admin/src/components/useTurnstile.js index 7edf06722e3..b42d2f5eed3 100644 --- a/packages/admin/src/components/useTurnstile.js +++ b/packages/admin/src/components/useTurnstile.js @@ -1,4 +1,4 @@ -import { useState, useEffect } from 'react'; +import { useEffect, useState } from 'react'; import useScript from './useScript'; diff --git a/packages/admin/src/pages/manage-comments/index.jsx b/packages/admin/src/pages/manage-comments/index.jsx index c3f307be9fd..3d05f31e70d 100644 --- a/packages/admin/src/pages/manage-comments/index.jsx +++ b/packages/admin/src/pages/manage-comments/index.jsx @@ -1,9 +1,9 @@ import cls from 'classnames'; import React, { useEffect, useReducer, useRef, useState } from 'react'; -import { useTranslation, Trans } from 'react-i18next'; +import { Trans, useTranslation } from 'react-i18next'; import { useSelector } from 'react-redux'; -import { buildAvatar, getPostUrl, formatDate } from './utils'; +import { buildAvatar, formatDate, getPostUrl } from './utils'; import Header from '../../components/Header'; import Paginator from '../../components/Paginator'; import { diff --git a/packages/admin/src/pages/migration/index.jsx b/packages/admin/src/pages/migration/index.jsx index 2810ea7a9e5..cb74d68ff99 100644 --- a/packages/admin/src/pages/migration/index.jsx +++ b/packages/admin/src/pages/migration/index.jsx @@ -1,4 +1,4 @@ -import React, { useState, useRef } from 'react'; +import React, { useRef, useState } from 'react'; import { useTranslation } from 'react-i18next'; import Header from '../../components/Header'; diff --git a/packages/admin/src/pages/profile/index.jsx b/packages/admin/src/pages/profile/index.jsx index d2706aa7f57..9db687c30fd 100644 --- a/packages/admin/src/pages/profile/index.jsx +++ b/packages/admin/src/pages/profile/index.jsx @@ -1,6 +1,6 @@ import cls from 'classnames'; import React, { useState } from 'react'; -import { useTranslation, Trans } from 'react-i18next'; +import { Trans, useTranslation } from 'react-i18next'; import { useDispatch, useSelector } from 'react-redux'; import TwoFactorAuth from './twoFactorAuth'; diff --git a/packages/admin/src/pages/profile/twoFactorAuth.jsx b/packages/admin/src/pages/profile/twoFactorAuth.jsx index 3e804b28cf6..78b254aacca 100644 --- a/packages/admin/src/pages/profile/twoFactorAuth.jsx +++ b/packages/admin/src/pages/profile/twoFactorAuth.jsx @@ -1,5 +1,5 @@ import QRCode from 'qrcode.react'; -import React, { useState, useEffect } from 'react'; +import React, { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useSelector } from 'react-redux'; diff --git a/packages/admin/src/store/user.js b/packages/admin/src/store/user.js index d832bd08807..85c6b0e2611 100644 --- a/packages/admin/src/store/user.js +++ b/packages/admin/src/store/user.js @@ -1,4 +1,4 @@ -import { getUserInfo, login, logout, register, forgot } from '../services/auth'; +import { forgot, getUserInfo, login, logout, register } from '../services/auth'; import { updateProfile } from '../services/user'; export const user = { diff --git a/packages/api/src/articleCounter.ts b/packages/api/src/articleCounter.ts index 82ada625ae3..eec0c76ed7c 100644 --- a/packages/api/src/articleCounter.ts +++ b/packages/api/src/articleCounter.ts @@ -1,10 +1,5 @@ -import { - type BaseAPIOptions, - type ErrorStatusResponse, - JSON_HEADERS, - getFetchPrefix, - errorCheck, -} from './utils.js'; +import type { BaseAPIOptions, ErrorStatusResponse } from './utils.js'; +import { JSON_HEADERS, errorCheck, getFetchPrefix } from './utils.js'; export interface GetArticleCounterOptions extends BaseAPIOptions { /** diff --git a/packages/api/src/comment.ts b/packages/api/src/comment.ts index ae22eb51b30..40702698da5 100644 --- a/packages/api/src/comment.ts +++ b/packages/api/src/comment.ts @@ -1,15 +1,10 @@ -import { - type WalineComment, - type WalineCommentData, - type WalineRootComment, +import type { + WalineComment, + WalineCommentData, + WalineRootComment, } from './typings.js'; -import { - type BaseAPIOptions, - type ErrorStatusResponse, - JSON_HEADERS, - errorCheck, - getFetchPrefix, -} from './utils.js'; +import type { BaseAPIOptions, ErrorStatusResponse } from './utils.js'; +import { JSON_HEADERS, errorCheck, getFetchPrefix } from './utils.js'; export interface GetCommentOptions extends BaseAPIOptions { /** diff --git a/packages/api/src/commentCount.ts b/packages/api/src/commentCount.ts index b870bfa7d9b..100f9a71550 100644 --- a/packages/api/src/commentCount.ts +++ b/packages/api/src/commentCount.ts @@ -1,9 +1,5 @@ -import { - type BaseAPIOptions, - type ErrorStatusResponse, - getFetchPrefix, - errorCheck, -} from './utils.js'; +import type { BaseAPIOptions, ErrorStatusResponse } from './utils.js'; +import { errorCheck, getFetchPrefix } from './utils.js'; export interface GetCommentCountOptions extends BaseAPIOptions { /** diff --git a/packages/api/src/login.ts b/packages/api/src/login.ts index 9b0fa95c6e6..b9a265aa31b 100644 --- a/packages/api/src/login.ts +++ b/packages/api/src/login.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ -import { type BaseAPIOptions } from './utils.js'; +import type { BaseAPIOptions } from './utils.js'; export interface UserInfo { /** diff --git a/packages/api/src/pageview.ts b/packages/api/src/pageview.ts index 1f57322ad15..9148d29a9d7 100644 --- a/packages/api/src/pageview.ts +++ b/packages/api/src/pageview.ts @@ -1,9 +1,6 @@ -import { - type GetArticleCounterResponse, - getArticleCounter, - updateArticleCounter, -} from './articleCounter.js'; -import { type BaseAPIOptions } from './utils.js'; +import type { GetArticleCounterResponse } from './articleCounter.js'; +import { getArticleCounter, updateArticleCounter } from './articleCounter.js'; +import type { BaseAPIOptions } from './utils.js'; interface GetPageviewOptions extends BaseAPIOptions { /** diff --git a/packages/api/src/recentComment.ts b/packages/api/src/recentComment.ts index f782a35defa..d0bab8bff3a 100644 --- a/packages/api/src/recentComment.ts +++ b/packages/api/src/recentComment.ts @@ -1,5 +1,6 @@ -import { type BaseWalineResponseComment } from './typings.js'; -import { type BaseAPIOptions, getFetchPrefix } from './utils.js'; +import type { BaseWalineResponseComment } from './typings.js'; +import type { BaseAPIOptions } from './utils.js'; +import { getFetchPrefix } from './utils.js'; export interface GetRecentCommentOptions extends BaseAPIOptions { /** diff --git a/packages/api/src/user.ts b/packages/api/src/user.ts index 5802e89337c..86da29538c8 100644 --- a/packages/api/src/user.ts +++ b/packages/api/src/user.ts @@ -1,10 +1,6 @@ -import { type WalineComment } from './typings.js'; -import { - type BaseAPIOptions, - type ErrorStatusResponse, - errorCheck, - getFetchPrefix, -} from './utils.js'; +import type { WalineComment } from './typings.js'; +import type { BaseAPIOptions, ErrorStatusResponse } from './utils.js'; +import { errorCheck, getFetchPrefix } from './utils.js'; export interface GetUserListOptions extends BaseAPIOptions { /** diff --git a/packages/client/__tests__/wordCount.spec.ts b/packages/client/__tests__/wordCount.spec.ts index 84c10911c00..3f13c257397 100644 --- a/packages/client/__tests__/wordCount.spec.ts +++ b/packages/client/__tests__/wordCount.spec.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; -import { getWords, getChinese, getWordNumber } from '../src/utils/wordCount.js'; +import { getChinese, getWordNumber, getWords } from '../src/utils/wordCount.js'; describe('Words test', () => { it('Should count empty content correctly', () => { diff --git a/packages/client/package.json b/packages/client/package.json index 277bc6e0268..36032be2a27 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -88,17 +88,17 @@ "marked": "^12.0.2", "marked-highlight": "^2.1.1", "recaptcha-v3": "^1.10.0", - "vue": "^3.4.23" + "vue": "^3.4.26" }, "devDependencies": { - "@babel/core": "7.24.4", - "@babel/preset-env": "7.24.4", - "@giphy/js-types": "5.0.0", + "@babel/core": "7.24.5", + "@babel/preset-env": "7.24.5", + "@giphy/js-types": "5.1.0", "@types/autosize": "4.0.3", "@types/marked": "6.0.0", "@vitejs/plugin-vue": "5.0.4", "user-agent-data-types": "0.4.2", - "vite": "5.2.10" + "vite": "5.2.11" }, "engines": { "node": ">=18" diff --git a/packages/client/src/comment.ts b/packages/client/src/comment.ts index e423adb54c2..61860d2deba 100644 --- a/packages/client/src/comment.ts +++ b/packages/client/src/comment.ts @@ -1,6 +1,6 @@ import { fetchCommentCount } from '@waline/api'; -import { type WalineAbort } from './typings/index.js'; +import type { WalineAbort } from './typings/index.js'; import { decodePath, errorHandler, @@ -44,8 +44,6 @@ export interface WalineCommentCountOptions { lang?: string; } -export { type WalineAbort } from './typings/index.js'; - export const commentCount = ({ serverURL, path = window.location.pathname, diff --git a/packages/client/src/components/ArticleReaction.vue b/packages/client/src/components/ArticleReaction.vue index ad9c8e5f807..46b4d1c32c0 100644 --- a/packages/client/src/components/ArticleReaction.vue +++ b/packages/client/src/components/ArticleReaction.vue @@ -1,52 +1,12 @@ - - + + diff --git a/packages/client/src/components/CommentBox.vue b/packages/client/src/components/CommentBox.vue index ccc350170e6..78daaeb1ba4 100644 --- a/packages/client/src/components/CommentBox.vue +++ b/packages/client/src/components/CommentBox.vue @@ -1,311 +1,10 @@ -