Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4f683ab

Browse filesBrowse files
TrottMyles Borins
authored andcommitted
src,tools: use template literals
Convert string concatenation to template literals. Enforce with lint rule. PR-URL: #5778 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <mic.besace@gmail.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
1 parent 200f763 commit 4f683ab
Copy full SHA for 4f683ab

File tree

Expand file treeCollapse file tree

2 files changed

+11
-8
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+11
-8
lines changed
Open diff view settings
Collapse file

‎src/.eslintrc‎

Copy file name to clipboard
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# ECMAScript-6
2+
# http://eslint.org/docs/rules/#ecmascript-6
3+
prefer-template: 2
Collapse file

‎src/node.js‎

Copy file name to clipboardExpand all lines: src/node.js
+8-8Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -564,19 +564,19 @@
564564
module.paths = Module._nodeModulePaths(cwd);
565565
var script = process._eval;
566566
var body = script;
567-
script = 'global.__filename = ' + JSON.stringify(name) + ';\n' +
567+
script = `global.__filename = ${JSON.stringify(name)};\n` +
568568
'global.exports = exports;\n' +
569569
'global.module = module;\n' +
570570
'global.__dirname = __dirname;\n' +
571571
'global.require = require;\n' +
572572
'return require("vm").runInThisContext(' +
573-
JSON.stringify(body) + ', { filename: ' +
574-
JSON.stringify(name) + ' });\n';
573+
`${JSON.stringify(body)}, { filename: ` +
574+
`${JSON.stringify(name)} });\n`;
575575
// Defer evaluation for a tick. This is a workaround for deferred
576576
// events not firing when evaluating scripts from the command line,
577577
// see https://github.com/nodejs/node/issues/1600.
578578
process.nextTick(function() {
579-
var result = module._compile(script, name + '-wrapper');
579+
var result = module._compile(script, `${name}-wrapper`);
580580
if (process._print_eval) console.log(result);
581581
});
582582
}
@@ -768,7 +768,7 @@
768768
sig.slice(0, 3) === 'SIG') {
769769
err = process._kill(pid, startup.lazyConstants()[sig]);
770770
} else {
771-
throw new Error('Unknown signal: ' + sig);
771+
throw new Error(`Unknown signal: ${sig}`);
772772
}
773773
}
774774

@@ -873,7 +873,7 @@
873873
}
874874

875875
function NativeModule(id) {
876-
this.filename = id + '.js';
876+
this.filename = `${id}.js`;
877877
this.id = id;
878878
this.exports = {};
879879
this.loaded = false;
@@ -893,10 +893,10 @@
893893
}
894894

895895
if (!NativeModule.exists(id)) {
896-
throw new Error('No such native module ' + id);
896+
throw new Error(`No such native module ${id}`);
897897
}
898898

899-
process.moduleLoadList.push('NativeModule ' + id);
899+
process.moduleLoadList.push(`NativeModule ${id}`);
900900

901901
var nativeModule = new NativeModule(id);
902902

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.