diff options
author | Rich Trott <rtrott@gmail.com> | 2021-04-05 17:19:42 +0300 |
---|---|---|
committer | Michaƫl Zasso <targos@protonmail.com> | 2021-09-04 16:14:19 +0300 |
commit | d86d37bc9eadcfa8ff54d1a8991dd453906e37dc (patch) | |
tree | a4b76094ee117e48fb842f2f526bd4002a5dee38 /tools | |
parent | f2e1c2267ef2fc1cbb153de94d0ffd67f3ebe690 (diff) |
tools: relax max-len lint rule for template strings
Splitting template strings across multiple lines can make them harder to
read.
PR-URL: https://github.com/nodejs/node/pull/38097
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/doc/apilinks.mjs | 4 | ||||
-rw-r--r-- | tools/doc/checkLinks.mjs | 7 | ||||
-rw-r--r-- | tools/doc/html.mjs | 28 | ||||
-rw-r--r-- | tools/doc/json.mjs | 2 | ||||
-rwxr-xr-x | tools/lint-sh.js | 3 |
5 files changed, 16 insertions, 28 deletions
diff --git a/tools/doc/apilinks.mjs b/tools/doc/apilinks.mjs index 9a3291a37e2..a1b660f1cfa 100644 --- a/tools/doc/apilinks.mjs +++ b/tools/doc/apilinks.mjs @@ -61,8 +61,8 @@ inputs.forEach((file) => { const program = ast.body; // Build link - const link = `https://github.com/${repo}/blob/${tag}/` + - path.relative('.', file).replace(/\\/g, '/'); + const link = + `https://github.com/${repo}/blob/${tag}/${path.relative('.', file).replace(/\\/g, '/')}`; // Scan for exports. const exported = { constructors: [], identifiers: [] }; diff --git a/tools/doc/checkLinks.mjs b/tools/doc/checkLinks.mjs index 52f61af7452..cb302ea27fe 100644 --- a/tools/doc/checkLinks.mjs +++ b/tools/doc/checkLinks.mjs @@ -65,10 +65,9 @@ function checkFile(path) { if (previousDefinitionLabel && previousDefinitionLabel > node.label) { const { line, column } = node.position.start; - console.error((process.env.GITHUB_ACTIONS ? - `::error file=${path},line=${line},col=${column}::` : '') + - `Unordered reference at ${path}:${line}:${column} (` + - `"${node.label}" should be before "${previousDefinitionLabel}")` + console.error( + (process.env.GITHUB_ACTIONS ? `::error file=${path},line=${line},col=${column}::` : '') + + `Unordered reference at ${path}:${line}:${column} ("${node.label}" should be before "${previousDefinitionLabel}")` ); process.exitCode = 1; } diff --git a/tools/doc/html.mjs b/tools/doc/html.mjs index 4d91893c9e1..c2c3a7a1836 100644 --- a/tools/doc/html.mjs +++ b/tools/doc/html.mjs @@ -167,12 +167,10 @@ function linkManPages(text) { const displayAs = `<code>${name}(${number}${optionalCharacter})</code>`; if (BSD_ONLY_SYSCALLS.has(name)) { - return `${beginning}<a href="https://www.freebsd.org/cgi/man.cgi` + - `?query=${name}&sektion=${number}">${displayAs}</a>`; + return `${beginning}<a href="https://www.freebsd.org/cgi/man.cgi?query=${name}&sektion=${number}">${displayAs}</a>`; } - return `${beginning}<a href="http://man7.org/linux/man-pages/man${number}` + - `/${name}.${number}${optionalCharacter}.html">${displayAs}</a>`; + return `${beginning}<a href="http://man7.org/linux/man-pages/man${number}/${name}.${number}${optionalCharacter}.html">${displayAs}</a>`; }); } @@ -210,17 +208,14 @@ export function preprocessElements({ filename }) { } else if (node.type === 'code') { if (!node.lang) { console.warn( - `No language set in ${filename}, ` + - `line ${node.position.start.line}`); + `No language set in ${filename}, line ${node.position.start.line}` + ); } const className = isJSFlavorSnippet(node) ? `language-js ${node.lang}` : `language-${node.lang}`; const highlighted = - `<code class='${className}'>` + - (getLanguage(node.lang || '') ? - highlight(node.value, { language: node.lang }) : node).value + - '</code>'; + `<code class='${className}'>${(getLanguage(node.lang || '') ? highlight(node.value, { language: node.lang }) : node).value}</code>`; node.type = 'html'; if (isJSFlavorSnippet(node)) { @@ -354,8 +349,7 @@ function parseYAML(text) { result += '</table>\n</details>\n'; } else { - result += `${added.description}${deprecated.description}` + - `${removed.description}\n`; + result += `${added.description}${deprecated.description}${removed.description}\n`; } if (meta.napiVersion) { @@ -418,15 +412,14 @@ export function buildToc({ filename, apilinks }) { const hasStability = node.stability !== undefined; toc += ' '.repeat((depth - 1) * 2) + (hasStability ? `* <span class="stability_${node.stability}">` : '* ') + - `<a href="#${isDeprecationHeading ? node.data.hProperties.id : id}">` + - `${headingText}</a>${hasStability ? '</span>' : ''}\n`; + `<a href="#${isDeprecationHeading ? node.data.hProperties.id : id}">${headingText}</a>${hasStability ? '</span>' : ''}\n`; let anchor = `<span><a class="mark" href="#${id}" id="${id}">#</a></span>`; if (realFilename === 'errors' && headingText.startsWith('ERR_')) { - anchor += `<span><a class="mark" href="#${headingText}" ` + - `id="${headingText}">#</a></span>`; + anchor += + `<span><a class="mark" href="#${headingText}" id="${headingText}">#</a></span>`; } const api = headingText.replace(/^.*:\s+/, '').replace(/\(.*/, ''); @@ -476,8 +469,7 @@ function altDocs(filename, docCreated, versions) { `${host}/docs/latest-v${versionNum}/api/${filename}.html`; const wrapInListItem = (version) => - `<li><a href="${getHref(version.num)}">${version.num}` + - `${version.lts ? ' <b>LTS</b>' : ''}</a></li>`; + `<li><a href="${getHref(version.num)}">${version.num}${version.lts ? ' <b>LTS</b>' : ''}</a></li>`; function isDocInVersion(version) { const [versionMajor, versionMinor] = version.num.split('.').map(Number); diff --git a/tools/doc/json.mjs b/tools/doc/json.mjs index 4dd8b9f67c9..318be8fd2ff 100644 --- a/tools/doc/json.mjs +++ b/tools/doc/json.mjs @@ -455,7 +455,6 @@ const callWithParams = r`\([^)]*\)`; const maybeExtends = `(?: +extends +${maybeAncestors}${classId})?`; -/* eslint-disable max-len */ const headingExpressions = [ { type: 'event', re: RegExp( `${eventPrefix}${maybeBacktick}${maybeQuote}(${notQuotes})${maybeQuote}${maybeBacktick}$`, 'i') }, @@ -475,7 +474,6 @@ const headingExpressions = [ { type: 'property', re: RegExp( `^${maybeClassPropertyPrefix}${maybeBacktick}${ancestors}(${id})${maybeBacktick}$`, 'i') }, ]; -/* eslint-enable max-len */ function newSection(header, file) { const text = textJoin(header.children, file); diff --git a/tools/lint-sh.js b/tools/lint-sh.js index 7b0beaadfe2..42889c16b6a 100755 --- a/tools/lint-sh.js +++ b/tools/lint-sh.js @@ -138,8 +138,7 @@ async function checkFiles(...files) { const data = JSON.parse(stdout); for (const { file, line, column, message } of data) { console.error( - `::error file=${file},line=${line},col=${column}::` + - `${file}:${line}:${column}: ${message}` + `::error file=${file},line=${line},col=${column}::${file}:${line}:${column}: ${message}` ); } } |