Skip to content

Commit 9ce3e69

Browse files
committed
🚀✨ [eslint upgrade] fixed home-v2 eslint
1 parent 156a074 commit 9ce3e69

File tree

155 files changed

+2239
-3657
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+2239
-3657
lines changed

.eslintrc.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
module.exports = {
33
root: true,
44
extends: [
5-
"@cs-magic/eslint-config/typescript-type-checked", // "@cs-magic/eslint-config/prettier"
5+
"@cs-magic/eslint-config/typescript-type-checked",
6+
// "@cs-magic/eslint-config/prettier" // todo: compatiability test
67
],
78
parserOptions: {
89
project: true,

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,6 @@
7979
[submodule "cases/hand-future-frontend"]
8080
path = cases/xieshou-frontend
8181
url = [email protected]:mark-freelance/hand-future-frontend.git
82+
[submodule "apps/docs"]
83+
path = apps/docs
84+
url = [email protected]:MarkShawn2020/nextra-docs.git

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ brew install "${packages[@]}"
2222
- prepare yarn: `NV=18.19.0 && nvm install $NV && nvm use $NV && npm i -g yarn`
2323
- `export PATH=$(pwd)/node_modules/.bin:$PATH` (sometimes important!)
2424
- installation: `yarn` (db migration will auto exec)
25+
-
26+
```
27+
yarn workspaces foreach -pA add -D npm-run-all
28+
yarn workspaces foreach -pA --include "packages/frontend/*" --include "packages/backend/*" add -D ts-patch typescript-transform-paths
29+
```
2530

2631
## References
2732

apps/cs-magic/thinkow

apps/docs

Submodule docs added at 332424d

apps/home-v1

apps/home-v2

apps/screen-saver/src/components/app/App.tsx

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
import { invoke } from "@tauri-apps/api/tauri";
12
import { useState } from "react";
3+
24
import reactLogo from "../../assets/react.svg";
3-
import { invoke } from "@tauri-apps/api/tauri";
45
import "./App.css";
56

67
function App() {
@@ -17,14 +18,14 @@ function App() {
1718
<h1>Welcome to Tauri!</h1>
1819

1920
<div className="row">
20-
<a href="https://vitejs.dev" target="_blank">
21-
<img src="/vite.svg" className="logo vite" alt="Vite logo" />
21+
<a href="https://vitejs.dev" rel="noreferrer" target="_blank">
22+
<img alt="Vite logo" className="logo vite" src="/vite.svg" />
2223
</a>
23-
<a href="https://tauri.app" target="_blank">
24-
<img src="/tauri.svg" className="logo tauri" alt="Tauri logo" />
24+
<a href="https://tauri.app" rel="noreferrer" target="_blank">
25+
<img alt="Tauri logo" className="logo tauri" src="/tauri.svg" />
2526
</a>
26-
<a href="https://reactjs.org" target="_blank">
27-
<img src={reactLogo} className="logo react" alt="React logo" />
27+
<a href="https://reactjs.org" rel="noreferrer" target="_blank">
28+
<img alt="React logo" className="logo react" src={reactLogo} />
2829
</a>
2930
</div>
3031

@@ -39,8 +40,8 @@ function App() {
3940
>
4041
<input
4142
id="greet-input"
42-
onChange={(e) => setName(e.currentTarget.value)}
4343
placeholder="Enter a name..."
44+
onChange={(e) => setName(e.currentTarget.value)}
4445
/>
4546
<button type="submit">Greet</button>
4647
</form>

apps/screen-saver/src/components/system-dashboard.tsx

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import React, { useState, useEffect } from "react";
21
import { invoke } from "@tauri-apps/api/tauri";
32
import { Activity, Cpu, Zap, Wifi, Globe, Database } from "lucide-react";
3+
import React, { useState, useEffect } from "react";
4+
45
import { Progress } from "@/components/ui/progress";
56

67
// import "./app/App.css";
@@ -32,7 +33,7 @@ const SystemDashboard = () => {
3233

3334
const MetricCard = ({ Icon, title, value, unit }) => (
3435
<div className="bg-gray-800 p-4 rounded-lg flex items-center space-x-4">
35-
<Icon size={24} className="text-cyan-400" />
36+
<Icon className="text-cyan-400" size={24} />
3637
<div>
3738
<h3 className="text-sm text-gray-400">{title}</h3>
3839
<p className="text-xl font-bold">
@@ -68,37 +69,37 @@ const SystemDashboard = () => {
6869
<MetricCard
6970
Icon={Cpu}
7071
title="CPU Usage"
71-
value={systemInfo.cpu_usage}
7272
unit="%"
73+
value={systemInfo.cpu_usage}
7374
/>
7475
<MetricCard
7576
Icon={Database}
7677
title="Memory Usage"
77-
value={systemInfo.memory_usage}
7878
unit="%"
79+
value={systemInfo.memory_usage}
7980
/>
8081
<MetricCard
8182
Icon={Globe}
8283
title="Disk Usage"
83-
value={systemInfo.disk_usage}
8484
unit="%"
85+
value={systemInfo.disk_usage}
8586
/>
8687

8788
<MetricCard
8889
Icon={Activity}
8990
title="Network Speed"
90-
value={systemInfo.network_speed}
9191
unit="Mbps"
92+
value={systemInfo.network_speed}
9293
/>
9394
<MetricCard
9495
Icon={Zap}
9596
title="Battery Level"
96-
value={systemInfo.battery_level}
9797
unit="%"
98+
value={systemInfo.battery_level}
9899
/>
99100
<div className="bg-gray-800 p-4 rounded-lg flex flex-col justify-center">
100101
<h3 className="text-sm text-gray-400 mb-2">System Health</h3>
101-
<Progress value={100 - systemInfo.cpu_usage} className="h-2" />
102+
<Progress className="h-2" value={100 - systemInfo.cpu_usage} />
102103
<p className="text-right text-sm mt-1">
103104
{(100 - systemInfo.cpu_usage).toFixed(2)}%
104105
</p>

apps/screen-saver/src/main.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from "react";
22
import ReactDOM from "react-dom/client";
3+
34
import App from "./components/app/App.tsx";
45
import SystemDashboard from "./components/system-dashboard.tsx";
56
import "@assets/styles/main.css";

apps/todo/src/app/page.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
'use client';
22

33
import React, { useState } from 'react';
4+
45
import AddTodoForm from '../components/AddTodoForm';
56
import TodoList from '../components/TodoList';
6-
import { Todo } from '../types/todo';
7+
import type { Todo } from '../types/todo';
78

89
export default function Home() {
910
const [todos, setTodos] = useState<Todo[]>([]);

apps/todo/src/components/AddTodoForm.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ const AddTodoForm: React.FC<AddTodoFormProps> = ({ onAdd }) => {
1616
};
1717

1818
return (
19-
<form onSubmit={handleSubmit} className="mb-4">
19+
<form className="mb-4" onSubmit={handleSubmit}>
2020
<input
21+
className="border p-2 mr-2"
22+
placeholder="Add a new todo"
2123
type="text"
2224
value={text}
2325
onChange={(e) => setText(e.target.value)}
24-
placeholder="Add a new todo"
25-
className="border p-2 mr-2"
2626
/>
27-
<button type="submit" className="bg-blue-500 text-white p-2 rounded">
27+
<button className="bg-blue-500 text-white p-2 rounded" type="submit">
2828
Add Todo
2929
</button>
3030
</form>

apps/todo/src/components/TodoList.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react';
2-
import { Todo } from '../types/todo';
2+
3+
import type { Todo } from '../types/todo';
34

45
interface TodoListProps {
56
todos: Todo[];
@@ -12,10 +13,10 @@ const TodoList: React.FC<TodoListProps> = ({ todos, onToggle }) => {
1213
{todos.map((todo) => (
1314
<li key={todo.id} className="mb-2">
1415
<input
15-
type="checkbox"
1616
checked={todo.completed}
17-
onChange={() => onToggle(todo.id)}
1817
className="mr-2"
18+
type="checkbox"
19+
onChange={() => onToggle(todo.id)}
1920
/>
2021
<span className={todo.completed ? 'line-through' : ''}>
2122
{todo.text}

apps/uni-pusher

cases/xieshou-frontend

Submodule xieshou-frontend deleted from 7993b24

package.json

+4-21
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
],
2323
"scripts": {
2424
"prepare": "ts-patch install -s",
25+
"postinstall": "prisma generate",
2526
"init-app": "git submodule update --init --progress",
2627
"run-app": "yarn workspace @cs-magic"
2728
},
@@ -99,34 +100,16 @@
99100
"zod-prisma-types": "^3.1.8"
100101
},
101102
"dependencies": {
102-
"@clerk/nextjs": "^6.0.2",
103-
"@mdx-js/esbuild": "^3.0.1",
104-
"@octokit/rest": "^21.0.2",
103+
"@prisma/client": "^5.19.1",
105104
"@types/lodash": "^4.14.202",
106-
"highlight.js": "^11.10.0",
107105
"lodash": "^4.17.21",
108-
"rehype-highlight": "^7.0.0",
109-
"rehype-pretty-code": "^0.14.0",
110-
"shiki": "0.14.5",
111-
"socket.io": "^4.8.0",
112-
"stripe": "13.11.0",
113-
"swr": "^2.2.5",
114-
"ts-patch": "^3.2.1"
106+
"prisma": "^5.21.0"
115107
},
116108
"devDependencies": {
117-
"@prisma/client": "^5.19.1",
118-
"@tailwindcss/forms": "^0.5.9",
119-
"@tailwindcss/typography": "^0.5.15",
120109
"@types/node": "^22.0.0",
121110
"npm-run-all": "^4.1.5",
122-
"postcss-import": "^16.1.0",
123-
"prisma": "^5.21.0",
124-
"protoc-gen-js": "^3.21.2",
125-
"shx": "^0.3.4",
126-
"ttypescript": "^1.5.15",
127111
"turbo": "^2.3.0",
128-
"typescript": "5.5.4",
129-
"typescript-transform-paths": "^3.5.1"
112+
"typescript": "5.5.4"
130113
},
131114
"packageManager": "[email protected]",
132115
"ct3aMetadata": {

packages/backend/common/package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"main": "dist/index.js",
66
"exports": {
77
".": "./dist/index.js",
8-
"./dist/*": "./dist/*",
98
"./*": "./dist/*.js"
109
},
1110
"scripts": {
@@ -54,6 +53,7 @@
5453
"tailwind-merge": "^2.4.0",
5554
"tencentcloud-sdk-nodejs-sms": "^4.0.882",
5655
"triple-beam": "^1.4.1",
56+
"ts-patch": "^3.2.1",
5757
"ulog": "2.0.0-beta.19",
5858
"universal-logger": "^1.0.1",
5959
"util": "^0.12.5",
@@ -73,6 +73,7 @@
7373
"@types/uuid": "^10",
7474
"@types/winston": "^2.4.4",
7575
"@types/yargs-parser": "^21",
76-
"npm-run-all": "^4.1.5"
76+
"npm-run-all": "^4.1.5",
77+
"typescript": "^5.6.3"
7778
}
7879
}

packages/backend/common/src/api/core.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* error handler: Axios & Error handling like a boss 😎 - DEV Community, https://dev.to/mperon/axios-error-handling-like-a-boss-333d
33
*/
4-
import axios, { AxiosError, type AxiosResponse, type CreateAxiosDefaults } from "axios"
4+
import axios, { type AxiosError, type AxiosResponse, type CreateAxiosDefaults } from "axios"
55

66
import { logger } from "@/log"
77

packages/backend/common/src/auth/providers/sms/actions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { prisma } from "@/db/prisma"
44
import logger from "@/log"
55
import { SMS_PROVIDER_ID } from "@/sms.base"
6-
import { IProviderSendSms } from "@/sms.schema"
6+
import type { IProviderSendSms } from "@/sms.schema"
77

88
/**
99
* 发送验证码的时候,要创建Account以存储AccessToken,并在后续验证的时候实现登录

packages/backend/common/src/auth/providers/wechat/sdk.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { IWechatProfile, IWechatRefreshedToken } from "@/auth/providers/wechat/schema"
1+
import type { IWechatProfile, IWechatRefreshedToken } from "@/auth/providers/wechat/schema"
22
import {
33
getWechatAuthToken,
44
getWechatUserProfile,

packages/backend/common/src/auth/providers/wechat/utils.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { api } from "@/api"
22
import { WECHAT_API_URL, WECHAT_AUTH_CALLBACK_URL } from "@/auth/providers/wechat/config"
33
import {
4-
IWechatAdaptedToken,
5-
IWechatProfile,
6-
IWechatRefreshedToken,
7-
IWechatToken,
4+
type IWechatAdaptedToken,
5+
type IWechatProfile,
6+
type IWechatRefreshedToken,
7+
type IWechatToken,
88
WechatScopeType,
99
isWechatError,
1010
} from "@/auth/providers/wechat/schema"

packages/backend/common/src/html/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { HTMLElement } from "node-html-parser"
1+
import type { HTMLElement } from "node-html-parser"
22

33
export const parseMetaFromHtml = (
44
html: HTMLElement,

packages/backend/common/src/log/providers/pino-logflare/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import { env } from "@/env"
1010
// Vercel log drain was setup to send logs here: https://logflare.app/sources/13830
1111

1212
const { stream, send } = logflarePinoVercel({
13-
apiKey: env!.NEXT_PUBLIC_PINO_LOGFLARE_API_KEY!,
14-
sourceToken: env!.NEXT_PUBLIC_PINO_LOGFLARE_SOURCE_TOKEN!,
13+
apiKey: env.NEXT_PUBLIC_PINO_LOGFLARE_API_KEY!,
14+
sourceToken: env.NEXT_PUBLIC_PINO_LOGFLARE_SOURCE_TOKEN!,
1515
})
1616

1717
/**

packages/backend/common/src/log/providers/winston/formats/console-like.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { SPLAT } from "triple-beam"
21
import { inspect } from "util"
2+
3+
import { SPLAT } from "triple-beam"
34
import { format } from "winston"
45

56
/**

packages/backend/common/src/oss/oss.server.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import OSS from "ali-oss"
44

5-
import { IApiResult, api } from "@/api"
5+
import { type IApiResult, api } from "@/api"
66
import { env } from "@/env"
77
import { OSS_BUCKET_NAME, OSS_REGION } from "@/oss/const"
88

packages/backend/common/src/schema/deep-readonly.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* ref: https://stackoverflow.com/a/49670389/9422455
33
*/
4-
export interface DeepReadonlyArray<T> extends ReadonlyArray<DeepReadonly<T>> {}
4+
export type DeepReadonlyArray<T> = ReadonlyArray<DeepReadonly<T>>
55

66
export type DeepReadonlyObject<T> = {
77
readonly [P in keyof T]: DeepReadonly<T[P]>

packages/backend/common/src/schema/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ZodBoolean, ZodEnum, ZodString, z } from "zod"
1+
import type { ZodBoolean, ZodEnum, ZodString, z } from "zod"
22

33
export type LiteralUnionSchema = z.ZodUnion<[z.ZodLiteral<string>, ...z.ZodLiteral<string>[]]>
44
export type CompressLineFunction = (line: string, ratio?: number) => string

packages/backend/common/src/spider/base-simulator.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { chromium } from "playwright"
33
import type { Browser, BrowserType, LaunchOptions, Page } from "playwright-core"
44

55
import logger from "@/log"
6-
import { type DriverType } from "@/spider/schema"
6+
import type { DriverType } from "@/spider/schema"
77

88
const lock = new AsyncLock()
99

0 commit comments

Comments
 (0)