diff --git a/gulpfile.js b/gulpfile.js index 7b55d404..49bdea91 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -4,7 +4,6 @@ const exec = require('child_process').exec; const gulp = require('gulp'); const jsonEditor = require('gulp-json-editor'); const path = require('path'); -const util = require('util'); function execCb(cb, err, stdout, stderr) { console.log(stdout); @@ -41,7 +40,7 @@ function bump(cb) { } function coverage(cb) { - const cmd = util.format('./node_modules/.bin/nyc --reporter=html %s -T', options.nodeBin); + const cmd = `./node_modules/.bin/nyc --reporter=html ${options.nodeBin} -T`; exec(cmd, execCb.bind(null, cb)); } @@ -56,7 +55,7 @@ function lint(cb) { } function test(cb) { - const cmd = util.format('%s "%s" -T', options.nodePath, options.nodeBin); + const cmd = `${options.nodePath} "${options.nodeBin}" -T`; exec(cmd, execCb.bind(null, cb)); } diff --git a/lib/jsdoc/doclet.js b/lib/jsdoc/doclet.js index f24c0f62..3a3e6b14 100644 --- a/lib/jsdoc/doclet.js +++ b/lib/jsdoc/doclet.js @@ -19,7 +19,6 @@ const jsdoc = { }; const path = require('jsdoc/path'); const Syntax = jsdoc.src.Syntax; -const util = require('util'); function applyTag(doclet, {title, value}) { if (title === 'name') { @@ -383,10 +382,10 @@ class Doclet { if (!scopeNames.includes(scope)) { filepath = getFilepath(this); - errorMessage = util.format('The scope name "%s" is not recognized. Use one of the ' + - 'following values: %j', scope, scopeNames); + errorMessage = `The scope name "${scope}" is not recognized. Use one of the ` + + `following values: ${scopeNames}`; if (filepath) { - errorMessage += util.format(' (Source file: %s)', filepath); + errorMessage += ` (Source file: ${filepath})`; } throw new Error(errorMessage); diff --git a/lib/jsdoc/opts/argparser.js b/lib/jsdoc/opts/argparser.js index 0618511b..ae23432f 100644 --- a/lib/jsdoc/opts/argparser.js +++ b/lib/jsdoc/opts/argparser.js @@ -3,7 +3,6 @@ * @module jsdoc/opts/argparser */ const _ = require('lodash'); -const util = require('util'); const hasOwnProp = Object.prototype.hasOwnProperty; @@ -252,7 +251,7 @@ class ArgParser { } if (option === null) { - throw new Error( util.format('Unknown command-line option "%s".', name) ); + throw new Error(`Unknown command-line option "${name}".`); } if (option.hasValue) { @@ -260,7 +259,7 @@ class ArgParser { i++; if (value === null || value.charAt(0) === '-') { - throw new Error( util.format('The command-line option "%s" requires a value.', name) ); + throw new Error(`The command-line option "${name}" requires a value.`); } } else { diff --git a/lib/jsdoc/src/astnode.js b/lib/jsdoc/src/astnode.js index 483797f5..bc676999 100644 --- a/lib/jsdoc/src/astnode.js +++ b/lib/jsdoc/src/astnode.js @@ -4,7 +4,6 @@ const cast = require('jsdoc/util/cast').cast; const env = require('jsdoc/env'); const name = require('jsdoc/name'); const Syntax = require('jsdoc/src/syntax').Syntax; -const util = require('util'); // Counter for generating unique node IDs. let uid = 100000000; @@ -203,7 +202,7 @@ const nodeToValue = exports.nodeToValue = node => { // could be computed (like foo['bar']) or not (like foo.bar) str = nodeToValue(node.object); if (node.computed) { - str += util.format('[%s]', node.property.raw); + str += `[${node.property.raw}]`; } else { str += `.${nodeToValue(node.property)}`; @@ -293,8 +292,7 @@ const nodeToValue = exports.nodeToValue = node => { } else { // this shouldn't happen - throw new Error( util.format('Found a UnaryExpression with a postfix operator: %j', - node) ); + throw new Error(`Found a UnaryExpression with a postfix operator: ${node}`); } break; diff --git a/lib/jsdoc/tag.js b/lib/jsdoc/tag.js index 3b9376c3..a997c464 100644 --- a/lib/jsdoc/tag.js +++ b/lib/jsdoc/tag.js @@ -21,7 +21,6 @@ const jsdoc = { } }; const path = require('jsdoc/path'); -const util = require('util'); // Check whether the text is the same as a symbol name with leading or trailing whitespace. If so, // the whitespace must be preserved, and the text cannot be trimmed. @@ -37,7 +36,7 @@ function trim(text, opts, meta) { text = String(typeof text === 'undefined' ? '' : text); if ( mustPreserveWhitespace(text, meta) ) { - text = util.format('"%s"', text); + text = `"${text}"`; } else if (opts.keepsWhitespace) { text = text.replace(/^[\n\r\f]+|[\n\r\f]+$/g, ''); diff --git a/lib/jsdoc/util/markdown.js b/lib/jsdoc/util/markdown.js index 9ffe36fc..94a0404b 100644 --- a/lib/jsdoc/util/markdown.js +++ b/lib/jsdoc/util/markdown.js @@ -8,7 +8,6 @@ const MarkdownIt = require('markdown-it'); const marked = require('marked'); const mda = require('markdown-it-anchor'); const path = require('jsdoc/path'); -const util = require('util'); /** * Enumeration of Markdown parsers that are available. @@ -110,13 +109,13 @@ function highlight(code, language) { } if (language !== 'plain') { - classString = util.format(' class="prettyprint source%s"', langClass); + classString = ` class="prettyprint source${langClass}"`; } else { classString = ' class="source"'; } - return util.format('
%s', classString, escapeCode(code));
+ return `${escapeCode(code)}`;
}
/**
@@ -203,7 +202,7 @@ function getParseFunction(parserName, conf) {
renderer = new marked.Renderer();
if (!conf.idInHeadings) {
- renderer.heading = (text, level) => util.format('