GeezerVison is showing github.com — tools: refactor tools JS code · nodejs/node@580ae56
File treeExpand file treeCollapse file tree Open diff view settings node-lint-md-cli-rollup/src
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: tools/doc/addon-verify.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -81,7 +81,7 @@ ${files[name].replace( | 81 | 81 | target_name: 'addon', | 82 | 82 | sources: files.map(({ name }) => name), | 83 | 83 | includes: ['../common.gypi'], | 84 | | - } | | 84 | + }, | 85 | 85 | ] | 86 | 86 | }) | 87 | 87 | }); | |
Collapse file Copy file name to clipboardExpand all lines: tools/doc/generate.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -41,7 +41,7 @@ let nodeVersion = null; | 41 | 41 | let outputDir = null; | 42 | 42 | let apilinks = {}; | 43 | 43 |
| 44 | | -args.forEach(function(arg) { | | 44 | +args.forEach((arg) => { | 45 | 45 | if (!arg.startsWith('--')) { | 46 | 46 | filename = arg; | 47 | 47 | } else if (arg.startsWith('--node-version=')) { | |
Collapse file Copy file name to clipboardExpand all lines: tools/doc/html.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -413,7 +413,7 @@ function altDocs(filename, docCreated) { | 413 | 413 | { num: '5.x' }, | 414 | 414 | { num: '4.x' }, | 415 | 415 | { num: '0.12.x' }, | 416 | | - { num: '0.10.x' } | | 416 | + { num: '0.10.x' }, | 417 | 417 | ]; | 418 | 418 |
| 419 | 419 | const getHref = (versionNum) => | |
Collapse file Copy file name to clipboardExpand all lines: tools/eslint-rules/required-modules.js +2-4Lines changed: 2 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -71,11 +71,9 @@ module.exports = function(context) { | 71 | 71 | 'Program:exit'(node) { | 72 | 72 | if (foundModules.length < requiredModules.length) { | 73 | 73 | var missingModules = requiredModules.filter( | 74 | | - function(module) { | 75 | | - return foundModules.indexOf(module) === -1; | 76 | | - } | | 74 | + (module) => foundModules.indexOf(module) === -1 | 77 | 75 | ); | 78 | | - missingModules.forEach(function(moduleName) { | | 76 | + missingModules.forEach((moduleName) => { | 79 | 77 | context.report( | 80 | 78 | node, | 81 | 79 | 'Mandatory module "{{moduleName}}" must be loaded.', | |
Collapse file Copy file name to clipboardExpand all lines: tools/eslint-rules/rules-utils.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -69,7 +69,7 @@ module.exports.inSkipBlock = function(node) { | 69 | 69 | node.test.operator === '!') { | 70 | 70 | const consequent = node.consequent; | 71 | 71 | if (consequent.body) { | 72 | | - consequent.body.some(function(expressionStatement) { | | 72 | + consequent.body.some((expressionStatement) => { | 73 | 73 | if (hasSkip(expressionStatement.expression)) { | 74 | 74 | return hasSkipBlock = true; | 75 | 75 | } | |
Collapse file Copy file name to clipboardExpand all lines: tools/license2rtf.js +4-12Lines changed: 4 additions & 12 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -222,20 +222,12 @@ function rtfEscape(string) { | 222 | 222 | } | 223 | 223 |
| 224 | 224 | return string | 225 | | - .replace(/[\\{}]/g, function(m) { | 226 | | - return `\\${m}`; | 227 | | - }) | 228 | | - .replace(/\t/g, function() { | 229 | | - return '\\tab '; | 230 | | - }) | | 225 | + .replace(/[\\{}]/g, (m) => `\\${m}`) | | 226 | + .replace(/\t/g, () => '\\tab ') | 231 | 227 | // eslint-disable-next-line no-control-regex | 232 | | - .replace(/[\x00-\x1f\x7f-\xff]/g, function(m) { | 233 | | - return `\\'${toHex(m.charCodeAt(0), 2)}`; | 234 | | - }) | | 228 | + .replace(/[\x00-\x1f\x7f-\xff]/g, (m) => `\\'${toHex(m.charCodeAt(0), 2)}`) | 235 | 229 | .replace(/\ufeff/g, '') | 236 | | - .replace(/[\u0100-\uffff]/g, function(m) { | 237 | | - return `\\u${toHex(m.charCodeAt(0), 4)}?`; | 238 | | - }); | | 230 | + .replace(/[\u0100-\uffff]/g, (m) => `\\u${toHex(m.charCodeAt(0), 4)}?`); | 239 | 231 | } | 240 | 232 |
| 241 | 233 | /* | |
Collapse file Copy file name to clipboardExpand all lines: tools/lint-js.js +5-7Lines changed: 5 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -86,9 +86,7 @@ if (cluster.isMaster) { | 86 | 86 | outFn = function(str) { | 87 | 87 | fs.writeSync(fd, str, 'utf8'); | 88 | 88 | }; | 89 | | - process.on('exit', function() { | 90 | | - fs.closeSync(fd); | 91 | | - }); | | 89 | + process.on('exit', () => { fs.closeSync(fd); }); | 92 | 90 | } else { | 93 | 91 | outFn = function(str) { | 94 | 92 | process.stdout.write(str); | @@ -117,20 +115,20 @@ if (cluster.isMaster) { | 117 | 115 |
| 118 | 116 | if (showProgress) { | 119 | 117 | // Start the progress display update timer when the first worker is ready | 120 | | - cluster.once('online', function() { | | 118 | + cluster.once('online', () => { | 121 | 119 | startTime = process.hrtime(); | 122 | 120 | setInterval(printProgress, 1000).unref(); | 123 | 121 | printProgress(); | 124 | 122 | }); | 125 | 123 | } | 126 | 124 |
| 127 | | - cluster.on('online', function(worker) { | | 125 | + cluster.on('online', (worker) => { | 128 | 126 | // Configure worker and give it some initial work to do | 129 | 127 | worker.send(workerConfig); | 130 | 128 | sendWork(worker); | 131 | 129 | }); | 132 | 130 |
| 133 | | - process.on('exit', function(code) { | | 131 | + process.on('exit', (code) => { | 134 | 132 | if (showProgress) { | 135 | 133 | curPath = 'Done'; | 136 | 134 | printProgress(); | @@ -232,7 +230,7 @@ if (cluster.isMaster) { | 232 | 230 | // Worker | 233 | 231 |
| 234 | 232 | var config = {}; | 235 | | - process.on('message', function(files) { | | 233 | + process.on('message', (files) => { | 236 | 234 | if (files instanceof Array) { | 237 | 235 | // Lint some files | 238 | 236 | const report = cli.executeOnFiles(files); | |
Collapse file Copy file name to clipboardExpand all lines: tools/node-lint-md-cli-rollup/src/cli-entry.js +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -14,7 +14,7 @@ const args = { | 14 | 14 | description: cli.description, | 15 | 15 | version: [ | 16 | 16 | proc.name + ': ' + proc.version, | 17 | | - cli.name + ': ' + cli.version | | 17 | + cli.name + ': ' + cli.version, | 18 | 18 | ].join(', '), | 19 | 19 | ignoreName: '.' + proc.name + 'ignore', | 20 | 20 | extensions: extensions | @@ -23,7 +23,7 @@ const config = options(process.argv.slice(2), args); | 23 | 23 | config.detectConfig = false; | 24 | 24 | config.plugins = plugins; | 25 | 25 |
| 26 | | -engine(config, function done(err, code) { | | 26 | +engine(config, (err, code) => { | 27 | 27 | if (err) console.error(err); | 28 | 28 | process.exit(code); | 29 | 29 | }); |
|