Skip to content

Commit b6ea5a7

Browse files
committed
fix: fix linting error
1 parent 85bccdf commit b6ea5a7

File tree

1 file changed

+30
-16
lines changed

1 file changed

+30
-16
lines changed

docs/build.js

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ const __dirname = dirname(__filename);
1616
const inputDir = join(cwd, 'docs');
1717
const outputDir = join(cwd, 'public');
1818
const templateFile = join(inputDir, '_document.html');
19-
const isUppercase = str => /[A-Z_]+/.test(str);
20-
const getTitle = str => str === 'INDEX' ? '' : titleize(str.replace(/_/g, ' ')) + ' - ';
19+
const isUppercase = (str) => /[A-Z_]+/.test(str);
20+
const getTitle = (str) =>
21+
str === 'INDEX' ? '' : titleize(str.replace(/_/g, ' ')) + ' - ';
2122
function convertTestsToTable(name, tests) {
2223
let total = 0;
2324
let passing = 0;
@@ -27,22 +28,24 @@ function convertTestsToTable(name, tests) {
2728
total += value.total;
2829
passing += value.pass;
2930
table += ` | ${key}`;
30-
table += ` | ${(value.pass)} of ${(value.total)}`;
31-
table += ` | ${((value.pass) / value.total * 100).toFixed()}%`;
31+
table += ` | ${value.pass} of ${value.total}`;
32+
table += ` | ${((value.pass / value.total) * 100).toFixed()}%`;
3233
table += ' |\n';
3334
}
3435
return `\n<details name="markdown-spec">
35-
<summary>${name} (${(passing / total * 100).toFixed()}%)</summary>
36+
<summary>${name} (${((passing / total) * 100).toFixed()}%)</summary>
3637
${table}
3738
</details>\n`;
3839
}
3940

40-
const markedInstance = new marked.Marked(markedHighlight((code, language) => {
41-
if (!language) {
42-
return highlightAuto(code).value;
43-
}
44-
return highlight(code, { language }).value;
45-
}));
41+
const markedInstance = new marked.Marked(
42+
markedHighlight((code, language) => {
43+
if (!language) {
44+
return highlightAuto(code).value;
45+
}
46+
return highlight(code, { language }).value;
47+
}),
48+
);
4649

4750
async function init() {
4851
console.log('Cleaning up output directory ' + outputDir);
@@ -52,13 +55,25 @@ async function init() {
5255
console.log(`Copying file ${join(inputDir, 'LICENSE.md')}`);
5356
await copyFile(join(cwd, 'LICENSE.md'), join(inputDir, 'LICENSE.md'));
5457
console.log(`Copying file ${join(outputDir, 'lib/marked.umd.js')}`);
55-
await copyFile(join(cwd, 'lib/marked.umd.js'), join(outputDir, 'lib/marked.umd.js'));
58+
await copyFile(
59+
join(cwd, 'lib/marked.umd.js'),
60+
join(outputDir, 'lib/marked.umd.js'),
61+
);
5662
console.log(`Copying file ${join(outputDir, 'lib/marked.umd.js.map')}`);
57-
await copyFile(join(cwd, 'lib/marked.umd.js.map'), join(outputDir, 'lib/marked.umd.js.map'));
63+
await copyFile(
64+
join(cwd, 'lib/marked.umd.js.map'),
65+
join(outputDir, 'lib/marked.umd.js.map'),
66+
);
5867
console.log(`Copying file ${join(outputDir, 'lib/marked.esm.js')}`);
59-
await copyFile(join(cwd, 'lib/marked.esm.js'), join(outputDir, 'lib/marked.esm.js'));
68+
await copyFile(
69+
join(cwd, 'lib/marked.esm.js'),
70+
join(outputDir, 'lib/marked.esm.js'),
71+
);
6072
console.log(`Copying file ${join(outputDir, 'lib/marked.esm.js.map')}`);
61-
await copyFile(join(cwd, 'lib/marked.esm.js.map'), join(outputDir, 'lib/marked.esm.js.map'));
73+
await copyFile(
74+
join(cwd, 'lib/marked.esm.js.map'),
75+
join(outputDir, 'lib/marked.esm.js.map'),
76+
);
6277
const tmpl = await readFile(templateFile, 'utf8');
6378
console.log('Building markdown...');
6479
const [original, commonmark, gfm] = await getTests([
@@ -110,7 +125,6 @@ async function build(currentDir, tmpl, testResultsTable) {
110125
await mkdir(dirname(outfile), { recursive: true });
111126
console.log('Writing file ' + outfile);
112127
await writeFile(outfile, html, { mode });
113-
114128
// For .html files generated from .md, also create clean URL version (slug/index.html)
115129
// This preserves backwards compatibility with existing links like /using_pro
116130
if (parsed.ext === '.html' && parsed.name !== 'index') {

0 commit comments

Comments
 (0)