Skip to content

Commit 017b608

Browse files
committed
💚 修复 react/jsx-no-literals lint问题
1 parent 695f4d1 commit 017b608

12 files changed

Lines changed: 37 additions & 43 deletions

File tree

src/locales/zh-CN/translation.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,5 +447,7 @@
447447
"blacklist_pages_desc": "禁止脚本在指定页面运行,支持通配符",
448448
"development_tools": "开发工具",
449449
"check_script_code_quality": "检查脚本代码质量和错误",
450-
"custom_eslint_rules_config": "自定义 ESLint 规则配置(JSON 格式)"
450+
"custom_eslint_rules_config": "自定义 ESLint 规则配置(JSON 格式)",
451+
"light": "亮色模式",
452+
"dark": "暗色模式"
451453
}

src/pages/components/GMApiSetting/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const GMApiSetting: React.FC = () => {
3737
target="_black"
3838
href="https://github.com/scriptscat/scriptcat/blob/main/example/cat_file_storage.js"
3939
>
40-
CAT_fileStorage
40+
{"CAT_fileStorage"}
4141
</Link>
4242
{t("use_file_system")}
4343
</Typography.Text>

src/pages/components/LogLabel/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ const LogLabel: React.FC<{
4848
onChange({ ...value, condition: opt });
4949
}}
5050
>
51-
<Select.Option value="=">=</Select.Option>
52-
<Select.Option value="=~">=~</Select.Option>
53-
<Select.Option value="!=">!=</Select.Option>
54-
<Select.Option value="!~">!~</Select.Option>
51+
<Select.Option value="=">{"="}</Select.Option>
52+
<Select.Option value="=~">{"=~"}</Select.Option>
53+
<Select.Option value="!=">{"!="}</Select.Option>
54+
<Select.Option value="!~">{"!~"}</Select.Option>
5555
</Select>
5656
<Select
5757
showSearch

src/pages/components/layout/MainLayout.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const MainLayout: React.FC<{
6767
</div>
6868
{stat.msg.length > 0 && (
6969
<>
70-
<b>{t("failure_info")}:</b>
70+
<b>{t("failure_info") + ":"}</b>
7171
{stat.msg}
7272
</>
7373
)}
@@ -85,7 +85,7 @@ const MainLayout: React.FC<{
8585
function simpleDigestMessage(message: string) {
8686
const encoder = new TextEncoder();
8787
const data = encoder.encode(message);
88-
return crypto.subtle.digest("SHA-1", data).then((hashBuffer) => {
88+
return crypto.subtle.digest("SHA-1", data as BufferSource).then((hashBuffer) => {
8989
const hashArray = new Uint8Array(hashBuffer);
9090
let hex = "";
9191
for (let i = 0; i < hashArray.length; i++) {
@@ -211,7 +211,7 @@ const MainLayout: React.FC<{
211211
<div className="flex row items-center">
212212
<img style={{ height: "40px" }} src="/assets/logo.png" alt="ScriptCat" />
213213
<Typography.Title heading={4} className="!m-0">
214-
ScriptCat
214+
{"ScriptCat"}
215215
</Typography.Title>
216216
</div>
217217
<Space size="small" className="action-tools">
@@ -275,10 +275,10 @@ const MainLayout: React.FC<{
275275
selectedKeys={[lightMode]}
276276
>
277277
<Menu.Item key="light">
278-
<IconSunFill /> Light
278+
<IconSunFill /> {t("light")}
279279
</Menu.Item>
280280
<Menu.Item key="dark">
281-
<IconMoonFill /> Dark
281+
<IconMoonFill /> {t("dark")}
282282
</Menu.Item>
283283
<Menu.Item key="auto">
284284
<IconDesktop /> {t("system_follow")}

src/pages/components/layout/Sider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ const Sider: React.FC = () => {
124124
</Menu.Item>
125125
<Menu.Item key="GitHub">
126126
<a href="https://github.com/scriptscat/scriptcat" target="_blank" rel="noreferrer">
127-
<IconGithub /> GitHub
127+
<IconGithub /> {"GitHub"}
128128
</a>
129129
</Menu.Item>
130130
</Menu.SubMenu>

src/pages/confirm/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ function App() {
6565
<span className="text-2xl font-500">{confirm?.title}</span>
6666
{metadata.map((key) => (
6767
<span className="text-base" key={key}>
68-
{key}: {confirm!.metadata![key]}
68+
{`${key}: ${confirm!.metadata![key]}`}
6969
</span>
7070
))}
7171
<span className="text-xl font-500">{confirm?.describe}</span>
7272
<div>
7373
<Button type="primary" onClick={handleConfirm(false, 1)}>
74-
{t("ignore")} ({second})
74+
{`${t("ignore")} (${second})`}
7575
</Button>
7676
</div>
7777
<div>

src/pages/import/App.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,15 @@ const ScriptListItem = React.memo(
4040
<Typography.Title heading={6} style={{ color: "rgb(var(--blue-5))" }}>
4141
{item.script?.script?.name || item.error || t("unknown")}
4242
</Typography.Title>
43+
<span className="text-sm color-gray-5">{`${t("author")}: ${item.script?.script?.metadata.author?.[0]}`}</span>
4344
<span className="text-sm color-gray-5">
44-
{t("author")}: {item.script?.script?.metadata.author?.[0]}
45+
{`${t("description")}: ${item.script?.script?.metadata.description?.[0]}`}
4546
</span>
4647
<span className="text-sm color-gray-5">
47-
{t("description")}: {item.script?.script?.metadata.description?.[0]}
48+
{`${t("source")}: ${item.options?.meta.file_url || t("local_creation")}`}
4849
</span>
4950
<span className="text-sm color-gray-5">
50-
{t("source")}: {item.options?.meta.file_url || t("local_creation")}
51-
</span>
52-
<span className="text-sm color-gray-5">
53-
{t("operation")}:{" "}
51+
{`${t("operation")}: `}
5452
{(item.install && (item.script?.oldScript ? t("update") : t("add_new"))) ||
5553
(item.error
5654
? `${t("error")}: ${item.options?.meta.name} - ${item.options?.meta.uuid}`
@@ -281,20 +279,20 @@ function App() {
281279
</Button>
282280
</Space>
283281
<Typography.Text>
284-
{t("select_scripts_to_import")}:{" "}
282+
{`${t("select_scripts_to_import")}: `}
285283
<Checkbox checked={selectAll[0]} onChange={handleSelectAllScripts}>
286284
{t("select_all")}
287285
</Checkbox>
288286
<Divider type="vertical" />
289-
{t("script_import_progress")}: {installNum[0]}/{scripts.length}
287+
{`${t("script_import_progress")}: ${installNum[0]}/${scripts.length}`}
290288
</Typography.Text>
291289
<Typography.Text>
292-
{t("select_subscribes_to_import")}:{" "}
290+
{`${t("select_subscribes_to_import")}: `}
293291
<Checkbox checked={selectAll[1]} onChange={handleSelectAllSubscribes}>
294292
{t("select_all")}
295293
</Checkbox>
296294
<Divider type="vertical" />
297-
{t("subscribe_import_progress")}: {installNum[1]}/{subscribes.length}
295+
{`${t("subscribe_import_progress")}: ${installNum[1]}/${subscribes.length}`}
298296
</Typography.Text>
299297
{scripts.length > 0 && (
300298
<List

src/pages/install/App.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -466,9 +466,7 @@ function App() {
466466
<Typography.Text bold>{upsertScript && i18nDescription(upsertScript)}</Typography.Text>
467467
</div>
468468
<div>
469-
<Typography.Text bold>
470-
{t("author")}: {metadataLive.author}
471-
</Typography.Text>
469+
<Typography.Text bold>{`${t("author")}: ${metadataLive.author}`}</Typography.Text>
472470
</div>
473471
<div>
474472
<Typography.Text
@@ -481,7 +479,7 @@ function App() {
481479
overflowY: "auto",
482480
}}
483481
>
484-
{t("source")}: {scriptInfo?.url}
482+
{`${t("source")}: ${scriptInfo?.url}`}
485483
</Typography.Text>
486484
</div>
487485
<div className="text-end">

src/pages/options/routes/ScriptList.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -459,9 +459,7 @@ function ScriptList() {
459459
return (
460460
<Tooltip
461461
content={
462-
<p style={{ margin: 0 }}>
463-
{t("subscription_link")}: {decodeURIComponent(item.subscribeUrl)}
464-
</p>
462+
<p style={{ margin: 0 }}>{`${t("subscription_link")}: ${decodeURIComponent(item.subscribeUrl)}`}</p>
465463
}
466464
>
467465
<Tag
@@ -494,9 +492,7 @@ function ScriptList() {
494492
return (
495493
<Tooltip
496494
content={
497-
<p style={{ margin: 0, padding: 0 }}>
498-
{t("script_link")}: {decodeURIComponent(item.origin)}
499-
</p>
495+
<p style={{ margin: 0, padding: 0 }}>{`${t("script_link")}: ${decodeURIComponent(item.origin)}`}</p>
500496
}
501497
>
502498
<Tag
@@ -805,7 +801,7 @@ function ScriptList() {
805801
}}
806802
>
807803
<Space direction="horizontal">
808-
<Typography.Text>{t("batch_operations")}:</Typography.Text>
804+
<Typography.Text>{t("batch_operations") + ":"}</Typography.Text>
809805
<Select
810806
style={{ minWidth: "100px" }}
811807
triggerProps={{ autoAlignPopupWidth: false, autoAlignPopupMinWidth: true, position: "bl" }}
@@ -950,7 +946,7 @@ function ScriptList() {
950946
{t("confirm")}
951947
</Button>
952948
<Divider type="horizontal" />
953-
<Typography.Text>{t("resize_column_width")}:</Typography.Text>
949+
<Typography.Text>{t("resize_column_width") + ":"}</Typography.Text>
954950
<Select
955951
style={{ minWidth: "80px" }}
956952
triggerProps={{ autoAlignPopupWidth: false, autoAlignPopupMinWidth: true, position: "bl" }}

src/pages/options/routes/SubscribeList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ function SubscribeList() {
183183
<Tooltip
184184
content={
185185
<p style={{ margin: 0, padding: 0 }}>
186-
{t("subscribe_url")}: {decodeURIComponent(item.url)}
186+
{t("subscribe_url") + ":"} {decodeURIComponent(item.url)}
187187
</p>
188188
}
189189
>

0 commit comments

Comments
 (0)