Skip to content

Commit 347c312

Browse files
committed
chore: lint code
1 parent 5250851 commit 347c312

File tree

4 files changed

+31
-16
lines changed

4 files changed

+31
-16
lines changed

src/loader/babel.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,8 @@ function clumpLines(lines: string[], delimiters = [" "], separator = " ") {
222222
while (lines.length > 0) {
223223
const line = lines.shift();
224224
if (
225-
(line && !delimiters.includes(line[0]) && clumps[clumps.length - 1]) ||
226-
containsIncompleteCodeblock(clumps[clumps.length - 1])
225+
(line && !delimiters.includes(line[0]) && clumps.at(-1)) ||
226+
containsIncompleteCodeblock(clumps.at(-1))
227227
) {
228228
clumps[clumps.length - 1] += separator + line;
229229
} else {
@@ -259,15 +259,18 @@ function parseJSDocs(input: string | string[]): Schema {
259259
if (firstTag >= 0) {
260260
const tags = clumpLines(lines.slice(firstTag), ["@"], "\n");
261261
// eslint-disable-next-line unicorn/no-array-reduce
262-
const typedefs = tags.reduce((typedefs, tag) => {
263-
const { typedef, alias } =
264-
tag.match(/@typedef\s+{(?<typedef>[\S\s]+)} (?<alias>.*)/)?.groups ||
265-
{};
266-
if (typedef && alias) {
267-
typedefs[typedef] = alias;
268-
}
269-
return typedefs;
270-
}, {} as Record<string, string>);
262+
const typedefs = tags.reduce(
263+
(typedefs, tag) => {
264+
const { typedef, alias } =
265+
tag.match(/@typedef\s+{(?<typedef>[\S\s]+)} (?<alias>.*)/)?.groups ||
266+
{};
267+
if (typedef && alias) {
268+
typedefs[typedef] = alias;
269+
}
270+
return typedefs;
271+
},
272+
{} as Record<string, string>
273+
);
271274
for (const tag of tags) {
272275
if (tag.startsWith("@type")) {
273276
const type = tag.match(/@type\s+{([\S\s]+)}/)?.[1];

src/schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ async function _resolveSchema(
5858
const schema: Schema = {
5959
type: getType(input),
6060
id: schemaId,
61-
default: !ctx.ignoreDefaults ? safeInput : undefined,
61+
default: ctx.ignoreDefaults ? undefined : safeInput,
6262
};
6363

6464
normalizeSchema(schema, { ignoreDefaults: ctx.ignoreDefaults });

src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,6 @@ export function getTypeDescriptor(type: string | JSType): TypeDescriptor {
170170
return {
171171
...(isJSType(type) ? { type } : {}),
172172
tsType: type,
173-
...(markdownType !== type ? { markdownType } : {}),
173+
...(markdownType === type ? {} : { markdownType }),
174174
};
175175
}

web/components/markdown.vue

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,26 @@ export default defineComponent({
5454

5555
<style>
5656
.markdown {
57-
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial,
58-
sans-serif, Apple Color Emoji, Segoe UI Emoji !important;
57+
font-family:
58+
-apple-system,
59+
BlinkMacSystemFont,
60+
Segoe UI,
61+
Helvetica,
62+
Arial,
63+
sans-serif,
64+
Apple Color Emoji,
65+
Segoe UI Emoji !important;
5966
color: #24292e !important;
6067
word-wrap: break-word;
6168
}
6269
6370
.markdown code {
64-
font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
71+
font-family:
72+
SFMono-Regular,
73+
Consolas,
74+
Liberation Mono,
75+
Menlo,
76+
monospace;
6577
padding: 0.2em 0.4em;
6678
font-size: 85%;
6779
background-color: #f6f8fa;

0 commit comments

Comments
 (0)