Skip to content

Commit

Permalink
style: update prettier print width to 100
Browse files Browse the repository at this point in the history
  • Loading branch information
gizmo-ds committed Mar 16, 2024
1 parent 61bf62c commit 0233d7e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"semi": false,
"singleQuote": true,
"printWidth": 80
"printWidth": 100
}
17 changes: 4 additions & 13 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,10 @@ export function vcc_auto_translate(e: any, t: any) {
)
else if (
// 忽略不受支持的 Element
!supported_element_name.find(
(e) => e === element_name || `Styled(${e})` === element_name
)
!supported_element_name.find((e) => e === element_name || `Styled(${e})` === element_name)
) {
if (element_name && debug_mode)
console.warn(
'not supported element:',
`[${element_name}]`,
t.children ?? t.placeholder
)
console.warn('not supported element:', `[${element_name}]`, t.children ?? t.placeholder)
return t
}

Expand All @@ -93,8 +87,7 @@ export function vcc_auto_translate(e: any, t: any) {
if (!children_translated) children_translated = k === 'children' && r[0]
t[k] = r[1]
}
if (Array.isArray(t[k]))
t[k] = t[k].map((e: any) => (typeof e === 'string' ? tr(e)[1] : e))
if (Array.isArray(t[k])) t[k] = t[k].map((e: any) => (typeof e === 'string' ? tr(e)[1] : e))
}
// 如果 children 没有被翻译的话, 尝试使用匹配器进行翻译
if (t.children && typeof t.children === 'string' && !children_translated)
Expand All @@ -110,9 +103,7 @@ export function vcc_auto_translate(e: any, t: any) {
/* 样式优化 */
// 修复 Projects 标题的换行问题
if (element_name == 'Title1' && t.children === localization['Projects'])
t.style = t.style
? Object.assign(t.style, { whiteSpace: 'nowrap' })
: { whiteSpace: 'nowrap' }
t.style = t.style ? Object.assign(t.style, { whiteSpace: 'nowrap' }) : { whiteSpace: 'nowrap' }
return t
}

Expand Down

0 comments on commit 0233d7e

Please sign in to comment.