diff --git a/package.json b/package.json index cab38415..54967dc6 100644 --- a/package.json +++ b/package.json @@ -20,11 +20,7 @@ "pm2": "concurrently \"pnpm:pm2:*\"", "pm2:server": "pnpm run --dir packages/server pm2", "pm2:client": "pnpm run --dir packages/client pm2", - "lint": "eslint . -c ./.eslintrc.js --fix --quiet 'packages/**/*.{ts,tsx,js,jsx}'", - "format": "npm run format:md && npm run format:json && npm run format:source", - "format:md": "prettier --parser markdown --write './**/*.md'", - "format:json": "prettier --parser json --write './**/*.json'", - "format:source": "prettier --write './**/*.{js,ts}'" + "format": "prettier --write --parser typescript \"packages/**/*.ts?(x)\"" }, "dependencies": { "concurrently": "^7.0.0", @@ -36,7 +32,18 @@ "node": ">=16.5.0" }, "devDependencies": { + "@typescript-eslint/eslint-plugin": "^5.0.0", + "@typescript-eslint/parser": "^5.0.0", + "eslint": "^8.11.0", + "eslint-config-next": "12.0.10", + "eslint-config-prettier": "^8.3.0", + "eslint-import-resolver-typescript": "^2.5.0", + "eslint-plugin-import": "^2.25.4", + "eslint-plugin-jest": "^26.1.1", + "eslint-plugin-prettier": "^4.0.0", + "eslint-plugin-react": "^7.29.3", + "eslint-plugin-react-hooks": "^4.3.0", "prettier": "^2.3.2", "typescript": "^4.5.5" } -} +} \ No newline at end of file diff --git a/packages/client/.eslintrc.json b/packages/client/.eslintrc.json deleted file mode 100644 index bffb357a..00000000 --- a/packages/client/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "next/core-web-vitals" -} diff --git a/packages/client/package.json b/packages/client/package.json index 0faaae85..608281aa 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -6,7 +6,6 @@ "prebuild": "rimraf .next", "build": "next build", "start": "cross-env NODE_ENV=production next start -p 5002", - "lint": "next lint", "pm2": "pm2 start npm --name @think/client -- start" }, "dependencies": { @@ -74,9 +73,7 @@ "devDependencies": { "@types/node": "17.0.13", "@types/react": "17.0.38", - "eslint": "8.8.0", - "eslint-config-next": "12.0.10", "tsconfig-paths-webpack-plugin": "^3.5.2", "typescript": "4.5.5" } -} +} \ No newline at end of file diff --git a/packages/client/src/components/author.tsx b/packages/client/src/components/author.tsx index c6f8f105..2070fcad 100644 --- a/packages/client/src/components/author.tsx +++ b/packages/client/src/components/author.tsx @@ -1,18 +1,16 @@ -import { Space, Typography } from "@douyinfe/semi-ui"; -import { IconLikeHeart } from "@douyinfe/semi-icons"; +import { Space, Typography } from '@douyinfe/semi-ui'; +import { IconLikeHeart } from '@douyinfe/semi-icons'; const { Text } = Typography; export const Author = () => { return ( -
+
Develop by - - fantasticit - - with + fantasticit + with
diff --git a/packages/client/src/components/data-render/index.tsx b/packages/client/src/components/data-render/index.tsx index 27bf7fe3..2b16c67a 100644 --- a/packages/client/src/components/data-render/index.tsx +++ b/packages/client/src/components/data-render/index.tsx @@ -1,5 +1,5 @@ -import React from "react"; -import { Empty, Spin, Typography } from "@douyinfe/semi-ui"; +import React from 'react'; +import { Empty, Spin, Typography } from '@douyinfe/semi-ui'; type RenderProps = React.ReactNode | (() => React.ReactNode); @@ -18,11 +18,10 @@ const defaultLoading = () => { }; const defaultRenderError = (error) => { - return {(error && error.message) || "未知错误"}; + return {(error && error.message) || '未知错误'}; }; -const runRender = (fn, ...args) => - typeof fn === "function" ? fn.apply(null, args) : fn; +const runRender = (fn, ...args) => (typeof fn === 'function' ? fn.apply(null, args) : fn); export const DataRender: React.FC = ({ loading, diff --git a/packages/client/src/components/document-creator/index.tsx b/packages/client/src/components/document-creator/index.tsx index 867c2d77..918d57d9 100644 --- a/packages/client/src/components/document-creator/index.tsx +++ b/packages/client/src/components/document-creator/index.tsx @@ -1,17 +1,14 @@ -import React from "react"; -import { Button } from "@douyinfe/semi-ui"; -import { useToggle } from "hooks/useToggle"; -import { useQuery } from "hooks/useQuery"; -import { DocumentCreator as DocumenCreatorForm } from "components/document/create"; +import React from 'react'; +import { Button } from '@douyinfe/semi-ui'; +import { useToggle } from 'hooks/useToggle'; +import { useQuery } from 'hooks/useQuery'; +import { DocumentCreator as DocumenCreatorForm } from 'components/document/create'; interface IProps { onCreateDocument?: () => void; } -export const DocumentCreator: React.FC = ({ - onCreateDocument, - children, -}) => { +export const DocumentCreator: React.FC = ({ onCreateDocument, children }) => { const { wikiId, docId } = useQuery<{ wikiId?: string; docId?: string }>(); const [visible, toggleVisible] = useToggle(false); diff --git a/packages/client/src/components/document/actions/index.tsx b/packages/client/src/components/document/actions/index.tsx index 3e151ffe..944f889f 100644 --- a/packages/client/src/components/document/actions/index.tsx +++ b/packages/client/src/components/document/actions/index.tsx @@ -1,11 +1,11 @@ -import React, { useCallback } from "react"; -import { Dropdown, Button, Typography, Space } from "@douyinfe/semi-ui"; -import { IconMore, IconStar, IconPlus } from "@douyinfe/semi-icons"; -import { DocumentLinkCopyer } from "components/document/link"; -import { DocumentDeletor } from "components/document/delete"; -import { DocumentCreator } from "components/document/create"; -import { DocumentStar } from "components/document/star"; -import { useToggle } from "hooks/useToggle"; +import React, { useCallback } from 'react'; +import { Dropdown, Button, Typography, Space } from '@douyinfe/semi-ui'; +import { IconMore, IconStar, IconPlus } from '@douyinfe/semi-icons'; +import { DocumentLinkCopyer } from 'components/document/link'; +import { DocumentDeletor } from 'components/document/delete'; +import { DocumentCreator } from 'components/document/create'; +import { DocumentStar } from 'components/document/star'; +import { useToggle } from 'hooks/useToggle'; interface IProps { wikiId: string; @@ -65,8 +65,8 @@ export const DocumentActions: React.FC = ({ {text} @@ -80,22 +80,13 @@ export const DocumentActions: React.FC = ({ - + } > {children || ( - + ); @@ -150,13 +134,13 @@ export const DocumentCollaboration: React.FC = ({ > toggleVisible(false)} maskClosable={false} - style={{ maxWidth: "96vw" }} + style={{ maxWidth: '96vw' }} footer={null} > @@ -169,14 +153,14 @@ export const DocumentCollaboration: React.FC = ({ > 邀请成功后,请将该链接发送给对方。 - +