Skip to content

Commit aa70b24

Browse files
committed
build: replace prettier with oxfmt
1 parent 5b0a75a commit aa70b24

File tree

141 files changed

+949
-1761
lines changed

Some content is hidden

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

141 files changed

+949
-1761
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ contact_links:
1010

1111
- name: Telegram
1212
url: https://t.me/walinejs
13-
about: 'Official Telegram Group'
13+
about: Official Telegram Group

.oxfmtrc.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"$schema": "./node_modules/oxfmt/configuration_schema.json",
3+
"ignorePatterns": ["coverage/", ".vuepress/.cache/**", ".vuepress/.temp/**", ".vuepress/dist/**"],
4+
"singleQuote": true,
5+
"experimentalSortPackageJson": {
6+
"sortScripts": true
7+
}
8+
}

commitlint.config.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ import { readdirSync } from 'node:fs';
22
import { dirname, join } from 'node:path';
33
import { fileURLToPath } from 'node:url';
44

5-
const packages = readdirSync(
6-
join(dirname(fileURLToPath(import.meta.url)), './packages/'),
7-
);
5+
const packages = readdirSync(join(dirname(fileURLToPath(import.meta.url)), './packages/'));
86

97
export default {
108
extends: ['@commitlint/config-conventional'],

docs/src/.vuepress/client.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ export default defineClientConfig({
4444
{},
4545
{
4646
contentAfter: () =>
47-
frontmatter.value.home
48-
? h(resolveComponent('CommentService'))
49-
: null,
47+
frontmatter.value.home ? h(resolveComponent('CommentService')) : null,
5048
},
5149
);
5250
},

docs/src/.vuepress/components/MigrationTool.vue

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@
22
import { useLocaleConfig } from '@vuepress/helper/client';
33
import { ref } from 'vue';
44
5-
import {
6-
type OriginalType,
7-
type TransformType,
8-
exportRaw,
9-
transform,
10-
} from '../utils/index.js';
5+
import { type OriginalType, type TransformType, exportRaw, transform } from '../utils/index.js';
116
127
const from = ref<OriginalType | 'typecho'>('valine');
138
const to = ref<TransformType>('wcloudbase');
@@ -84,10 +79,7 @@ const click = (): void => {
8479
text = JSON.stringify(text, null, '\t');
8580
}
8681
87-
exportRaw(
88-
'output.' + (to.value !== 'wsql' ? 'json' : 'csv'),
89-
text as string,
90-
);
82+
exportRaw('output.' + (to.value !== 'wsql' ? 'json' : 'csv'), text as string);
9183
}
9284
};
9385
</script>
@@ -137,10 +129,7 @@ const click = (): void => {
137129
<p v-html="i18n.typecho" />
138130
</div>
139131

140-
<div
141-
v-else-if="from === 'valine' && to === 'wleancloud'"
142-
class="custom-block warning"
143-
>
132+
<div v-else-if="from === 'valine' && to === 'wleancloud'" class="custom-block warning">
144133
<p class="custom-block-title">{{ i18n.tip }}</p>
145134

146135
<p v-text="i18n.tip" />

docs/src/.vuepress/navbar.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,7 @@ export const zhNavbarConfig = navbar([
3131
text: '高级',
3232
icon: 'advanced',
3333
prefix: '/advanced/',
34-
children: [
35-
'intro',
36-
'design',
37-
'ecosystem',
38-
'faq',
39-
'contribution',
40-
'privacy',
41-
],
34+
children: ['intro', 'design', 'ecosystem', 'faq', 'contribution', 'privacy'],
4235
},
4336
]);
4437

@@ -73,13 +66,6 @@ export const enNavbarConfig = navbar([
7366
text: 'Advanced',
7467
icon: 'advanced',
7568
prefix: '/en/advanced/',
76-
children: [
77-
'intro',
78-
'design',
79-
'ecosystem',
80-
'faq',
81-
'contribution',
82-
'privacy',
83-
],
69+
children: ['intro', 'design', 'ecosystem', 'faq', 'contribution', 'privacy'],
8470
},
8571
]);

docs/src/.vuepress/utils/csv.js

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ var CSV = {};
2626
r = t.encoding || 'UTF-8';
2727
((e.onload = function (e) {
2828
var r = p.extractFields(p.parse(e.target.result, t), t);
29-
((r.useMemoryStore = !0),
30-
(r.metadata = { filename: t.file.name }),
31-
n.resolve(r));
29+
((r.useMemoryStore = !0), (r.metadata = { filename: t.file.name }), n.resolve(r));
3230
}),
3331
(e.onerror = function (e) {
3432
n.reject({
@@ -67,8 +65,7 @@ var CSV = {};
6765
.catch(function (e, r) {
6866
n.reject({
6967
error: {
70-
message:
71-
'Failed to load file. ' + e.statusText + '. Code: ' + e.status,
68+
message: 'Failed to load file. ' + e.statusText + '. Code: ' + e.status,
7269
request: e,
7370
},
7471
});
@@ -90,10 +87,7 @@ var CSV = {};
9087
skipinitialspace: !0,
9188
skipinitialrows: 0,
9289
};
93-
for (var t in e)
94-
'trim' === t
95-
? (r.skipinitialspace = e.trim)
96-
: (r[t.toLowerCase()] = e[t]);
90+
for (var t in e) 'trim' === t ? (r.skipinitialspace = e.trim) : (r[t.toLowerCase()] = e[t]);
9791
return r;
9892
}),
9993
(p.parse = function (e, r) {
@@ -103,10 +97,7 @@ var CSV = {};
10397
i = p.normalizeDialectOptions(r);
10498
((t = e),
10599
(n = i.lineterminator),
106-
(e =
107-
t.charAt(t.length - n.length) !== n
108-
? t
109-
: t.substring(0, t.length - n.length)));
100+
(e = t.charAt(t.length - n.length) !== n ? t : t.substring(0, t.length - n.length)));
110101
var o,
111102
a,
112103
l = '',
@@ -120,9 +111,7 @@ var CSV = {};
120111
return (
121112
!0 !== u &&
122113
('' === e ? (e = null) : !0 === i.skipinitialspace && (e = v(e)),
123-
h.test(e)
124-
? (e = parseInt(e, 10))
125-
: m.test(e) && (e = parseFloat(e, 10))),
114+
h.test(e) ? (e = parseInt(e, 10)) : m.test(e) && (e = parseFloat(e, 10))),
126115
e
127116
);
128117
},
@@ -145,17 +134,11 @@ var CSV = {};
145134
(c = ''),
146135
(u = !1)));
147136
return (
148-
(c = a(c)),
149-
f.push(c),
150-
d.push(f),
151-
i.skipinitialrows && (d = d.slice(i.skipinitialrows)),
152-
d
137+
(c = a(c)), f.push(c), d.push(f), i.skipinitialrows && (d = d.slice(i.skipinitialrows)), d
153138
);
154139
}),
155140
(p.normalizeLineTerminator = function (e, r) {
156-
return (r = r || {}).lineterminator
157-
? e
158-
: e.replace(/(\r\n|\n|\r)/gm, '\n');
141+
return (r = r || {}).lineterminator ? e : e.replace(/(\r\n|\n|\r)/gm, '\n');
159142
}),
160143
(p.objectToArray = function (e) {
161144
for (var r = [], t = [], n = [], i = 0; i < e.fields.length; i++) {
@@ -166,8 +149,7 @@ var CSV = {};
166149
}
167150
r.push(t);
168151
for (i = 0; i < e.records.length; i++) {
169-
for (var l = [], s = e.records[i], u = 0; u < n.length; u++)
170-
l.push(s[n[u]]);
152+
for (var l = [], s = e.records[i], u = 0; u < n.length; u++) l.push(s[n[u]]);
171153
r.push(l);
172154
}
173155
return r;

docs/src/.vuepress/utils/transform/artalk2lc.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ export const artalk2lc = (input) => {
5252
vote_up,
5353
}) => {
5454
const time =
55-
date || created_at
56-
? new Date((date || created_at).replace(/-/g, '/')).toISOString()
57-
: '';
55+
date || created_at ? new Date((date || created_at).replace(/-/g, '/')).toISOString() : '';
5856
const url = parseKey(page_key);
5957
return {
6058
objectId: id,

docs/src/.vuepress/utils/transform/commento2lc.ts

Lines changed: 25 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -38,43 +38,32 @@ export const commento2lc = (input: string) => {
3838
return {
3939
results: comments
4040
.filter(({ deleted }) => !deleted)
41-
.map(
42-
({
43-
commentHex,
44-
commenterHex,
45-
parentHex,
46-
creationDate,
47-
html,
48-
markdown,
49-
url,
50-
state,
51-
}) => {
52-
const commenter = commenters[commenterHex] || {
53-
nick: 'Anonymous',
54-
mail: '',
55-
link: '',
56-
};
41+
.map(({ commentHex, commenterHex, parentHex, creationDate, html, markdown, url, state }) => {
42+
const commenter = commenters[commenterHex] || {
43+
nick: 'Anonymous',
44+
mail: '',
45+
link: '',
46+
};
5747

58-
return Object.assign(
59-
{
60-
objectId: commentHex,
61-
comment: html || markdown,
62-
insertedAt: {
63-
__type: 'Date',
64-
iso: creationDate,
65-
},
66-
createdAt: creationDate,
67-
updatedAt: creationDate,
68-
ip: '',
69-
ua: '',
70-
url: url,
71-
pid: parentHex !== 'root' ? parentHex : '',
72-
rid: rootHexMaps[commentHex] ? rootHexMaps[commentHex] : '',
73-
status: state === 'approved' ? 'approved' : 'waiting',
48+
return Object.assign(
49+
{
50+
objectId: commentHex,
51+
comment: html || markdown,
52+
insertedAt: {
53+
__type: 'Date',
54+
iso: creationDate,
7455
},
75-
commenter,
76-
);
77-
},
78-
),
56+
createdAt: creationDate,
57+
updatedAt: creationDate,
58+
ip: '',
59+
ua: '',
60+
url: url,
61+
pid: parentHex !== 'root' ? parentHex : '',
62+
rid: rootHexMaps[commentHex] ? rootHexMaps[commentHex] : '',
63+
status: state === 'approved' ? 'approved' : 'waiting',
64+
},
65+
commenter,
66+
);
67+
}),
7968
};
8069
};

docs/src/.vuepress/utils/transform/disqus2lc.ts

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,14 @@
55
export const disqus2lc = (input: string) => {
66
const parser = new DOMParser();
77
const dom = parser.parseFromString(input, 'application/xml');
8-
const posts = Array.from(dom.querySelectorAll<HTMLElement>('post')).filter(
9-
(postEl) => {
10-
const isDeletedEl = postEl.querySelector('isDeleted');
11-
if (
12-
isDeletedEl &&
13-
isDeletedEl.textContent?.toLocaleLowerCase() === 'true'
14-
) {
15-
return false;
16-
}
8+
const posts = Array.from(dom.querySelectorAll<HTMLElement>('post')).filter((postEl) => {
9+
const isDeletedEl = postEl.querySelector('isDeleted');
10+
if (isDeletedEl && isDeletedEl.textContent?.toLocaleLowerCase() === 'true') {
11+
return false;
12+
}
1713

18-
return true;
19-
},
20-
);
14+
return true;
15+
});
2116
const threads = Array.from(dom.querySelectorAll('disqus > thread'));
2217

2318
const articleMap: Record<string, string> = {};
@@ -68,17 +63,14 @@ export const disqus2lc = (input: string) => {
6863
const data = posts.map((postEl) => {
6964
const objectId = postEl.getAttribute('dsq:id')!;
7065
const comment = postEl.querySelector('message')?.textContent;
71-
const insertedAt = new Date(
72-
postEl.querySelector('createdAt')?.textContent!,
73-
).toISOString();
66+
const insertedAt = new Date(postEl.querySelector('createdAt')?.textContent!).toISOString();
7467
const nick = postEl.querySelector('author name')?.textContent;
7568
const threadId = postEl.querySelector('thread')?.getAttribute('dsq:id')!;
7669
const url = articleMap[threadId];
7770
const parent = postEl.querySelector('parent');
7871
const pid = parent ? parent.getAttribute('dsq:id') : null;
7972
const rid = parent ? rootIdMap[objectId] : null;
80-
const isSpam =
81-
postEl.querySelector('isSpam')?.textContent?.toLowerCase() !== 'false';
73+
const isSpam = postEl.querySelector('isSpam')?.textContent?.toLowerCase() !== 'false';
8274

8375
return {
8476
objectId,

0 commit comments

Comments
 (0)