diff --git a/.eslintrc.yaml b/.eslintrc.yaml index 1e30f5a55463ff..1e660b8de77056 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -99,18 +99,13 @@ rules: func-call-spacing: 2 func-name-matching: 2 func-style: [2, declaration, {allowArrowFunctions: true}] - # indent: [2, 2, {ArrayExpression: first, - # CallExpression: {arguments: first}, - # FunctionDeclaration: {parameters: first}, - # FunctionExpression: {parameters: first}, - # MemberExpression: off, - # ObjectExpression: first, - # SwitchCase: 1}] - indent-legacy: [2, 2, {ArrayExpression: first, - CallExpression: {arguments: first}, - MemberExpression: 1, - ObjectExpression: first, - SwitchCase: 1}] + indent: [2, 2, {ArrayExpression: first, + CallExpression: {arguments: first}, + FunctionDeclaration: {parameters: first}, + FunctionExpression: {parameters: first}, + MemberExpression: off, + ObjectExpression: first, + SwitchCase: 1}] key-spacing: [2, {mode: minimum}] keyword-spacing: 2 linebreak-style: [2, unix] diff --git a/benchmark/README.md b/benchmark/README.md index b63c14fb072f80..4d2cf812540508 100644 --- a/benchmark/README.md +++ b/benchmark/README.md @@ -37,15 +37,15 @@ example, buffers/buffer-read.js has the following configuration: ```js var bench = common.createBenchmark(main, { - noAssert: [false, true], - buffer: ['fast', 'slow'], - type: ['UInt8', 'UInt16LE', 'UInt16BE', - 'UInt32LE', 'UInt32BE', - 'Int8', 'Int16LE', 'Int16BE', - 'Int32LE', 'Int32BE', - 'FloatLE', 'FloatBE', - 'DoubleLE', 'DoubleBE'], - millions: [1] + noAssert: [false, true], + buffer: ['fast', 'slow'], + type: ['UInt8', 'UInt16LE', 'UInt16BE', + 'UInt32LE', 'UInt32BE', + 'Int8', 'Int16LE', 'Int16BE', + 'Int32LE', 'Int32BE', + 'FloatLE', 'FloatBE', + 'DoubleLE', 'DoubleBE'], + millions: [1] }); ``` The runner takes one item from each of the property array value to build a list diff --git a/benchmark/buffers/buffer-compare-offset.js b/benchmark/buffers/buffer-compare-offset.js index 17b36f82883426..5c3b4599af914a 100644 --- a/benchmark/buffers/buffer-compare-offset.js +++ b/benchmark/buffers/buffer-compare-offset.js @@ -50,7 +50,7 @@ function main(conf) { const iter = (conf.millions >>> 0) * 1e6; const size = (conf.size >>> 0); const method = conf.method === 'slice' ? - compareUsingSlice : compareUsingOffset; + compareUsingSlice : compareUsingOffset; method(Buffer.alloc(size, 'a'), Buffer.alloc(size, 'b'), size >> 1, diff --git a/benchmark/child_process/child-process-read-ipc.js b/benchmark/child_process/child-process-read-ipc.js index 30dead18032f98..e6fb9b19c202dc 100644 --- a/benchmark/child_process/child-process-read-ipc.js +++ b/benchmark/child_process/child-process-read-ipc.js @@ -26,7 +26,7 @@ if (process.argv[2] === 'child') { const options = { 'stdio': ['ignore', 1, 2, 'ipc'] }; const child = spawn(process.argv[0], - [process.argv[1], 'child', len], options); + [process.argv[1], 'child', len], options); var bytes = 0; child.on('message', function(msg) { diff --git a/doc/api/errors.md b/doc/api/errors.md index 34fa2cb8a5694c..10a930ddd73c4b 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -316,20 +316,20 @@ function makeFaster() { } makeFaster(); // will throw: - // /home/gbusey/file.js:6 - // throw new Error('oh no!'); - // ^ - // Error: oh no! - // at speedy (/home/gbusey/file.js:6:11) - // at makeFaster (/home/gbusey/file.js:5:3) - // at Object. (/home/gbusey/file.js:10:1) - // at Module._compile (module.js:456:26) - // at Object.Module._extensions..js (module.js:474:10) - // at Module.load (module.js:356:32) - // at Function.Module._load (module.js:312:12) - // at Function.Module.runMain (module.js:497:10) - // at startup (node.js:119:16) - // at node.js:906:3 +// /home/gbusey/file.js:6 +// throw new Error('oh no!'); +// ^ +// Error: oh no! +// at speedy (/home/gbusey/file.js:6:11) +// at makeFaster (/home/gbusey/file.js:5:3) +// at Object. (/home/gbusey/file.js:10:1) +// at Module._compile (module.js:456:26) +// at Object.Module._extensions..js (module.js:474:10) +// at Module.load (module.js:356:32) +// at Function.Module._load (module.js:312:12) +// at Function.Module.runMain (module.js:497:10) +// at startup (node.js:119:16) +// at node.js:906:3 ``` The location information will be one of: @@ -360,7 +360,7 @@ For example: ```js require('net').connect(-1); - // throws "RangeError: "port" option should be >= 0 and < 65536: -1" +// throws "RangeError: "port" option should be >= 0 and < 65536: -1" ``` Node.js will generate and throw `RangeError` instances *immediately* as a form @@ -377,7 +377,7 @@ will do so. ```js doesNotExist; - // throws ReferenceError, doesNotExist is not a variable in this program. +// throws ReferenceError, doesNotExist is not a variable in this program. ``` Unless an application is dynamically generating and running code, @@ -411,7 +411,7 @@ string would be considered a TypeError. ```js require('url').parse(() => { }); - // throws TypeError, since it expected a string +// throws TypeError, since it expected a string ``` Node.js will generate and throw `TypeError` instances *immediately* as a form diff --git a/doc/api/fs.md b/doc/api/fs.md index 2591dc57fd49ab..73dcf213e3fe43 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -137,7 +137,7 @@ support. If `filename` is provided, it will be provided as a `Buffer` if fs.watch('./tmp', {encoding: 'buffer'}, (eventType, filename) => { if (filename) console.log(filename); - // Prints: + // Prints: }); ``` diff --git a/doc/api/net.md b/doc/api/net.md index 72adf6306db77c..5a566dc7cb89c8 100644 --- a/doc/api/net.md +++ b/doc/api/net.md @@ -221,7 +221,7 @@ double-backslashes, such as: ```js net.createServer().listen( - path.join('\\\\?\\pipe', process.cwd(), 'myctl')); + path.join('\\\\?\\pipe', process.cwd(), 'myctl')); ``` The parameter `backlog` behaves the same as in diff --git a/doc/api/process.md b/doc/api/process.md index 03ccbe9b7aad6e..ac83a09de0ebc7 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -320,11 +320,11 @@ custom or application specific warnings. ```js // Emit a warning using a string... process.emitWarning('Something happened!'); - // Prints: (node 12345) Warning: Something happened! +// Prints: (node 12345) Warning: Something happened! // Emit a warning using an object... process.emitWarning('Something Happened!', 'CustomWarning'); - // Prints: (node 12345) CustomWarning: Something happened! +// Prints: (node 12345) CustomWarning: Something happened! // Emit a warning using a custom Error object... class CustomWarning extends Error { @@ -336,7 +336,7 @@ class CustomWarning extends Error { } const myWarning = new CustomWarning('Something happened!'); process.emitWarning(myWarning); - // Prints: (node 12345) CustomWarning: Something happened! +// Prints: (node 12345) CustomWarning: Something happened! ``` #### Emitting custom deprecation warnings diff --git a/lib/_debugger.js b/lib/_debugger.js index 1d5345cde43cea..64a8b70c5e2e58 100644 --- a/lib/_debugger.js +++ b/lib/_debugger.js @@ -1206,7 +1206,7 @@ Interface.prototype.scripts = function() { script.name === client.currentScript || !script.isNative) { scripts.push( - (script.name === client.currentScript ? '* ' : ' ') + + (script.name === client.currentScript ? '* ' : ' ') + id + ': ' + path.basename(script.name) ); diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js index fc6252edf4ba57..541ef1c305d8bf 100644 --- a/lib/_stream_readable.js +++ b/lib/_stream_readable.js @@ -877,8 +877,8 @@ function fromListPartial(n, list, hasStrings) { } else { // result spans more than one buffer ret = (hasStrings - ? copyFromBufferString(n, list) - : copyFromBuffer(n, list)); + ? copyFromBufferString(n, list) + : copyFromBuffer(n, list)); } return ret; } diff --git a/lib/child_process.js b/lib/child_process.js index 0e1d8f29861b60..e0e81c8dec2643 100644 --- a/lib/child_process.js +++ b/lib/child_process.js @@ -48,7 +48,7 @@ exports.fork = function(modulePath /*, args, options*/) { // Use a separate fd=3 for the IPC channel. Inherit stdin, stdout, // and stderr from the parent if silent isn't set. options.stdio = options.silent ? ['pipe', 'pipe', 'pipe', 'ipc'] : - [0, 1, 2, 'ipc']; + [0, 1, 2, 'ipc']; } else if (options.stdio.indexOf('ipc') === -1) { throw new TypeError('Forked processes must have an IPC channel'); } @@ -321,7 +321,7 @@ function normalizeSpawnArguments(file, args, options) { if (process.platform === 'win32') { file = typeof options.shell === 'string' ? options.shell : - process.env.comspec || 'cmd.exe'; + process.env.comspec || 'cmd.exe'; args = ['/s', '/c', '"' + command + '"']; options.windowsVerbatimArguments = true; } else { @@ -427,9 +427,9 @@ function spawnSync(/*file, args, options*/) { pipe.input = Buffer.from(input, options.encoding); else throw new TypeError(util.format( - 'stdio[%d] should be Buffer or string not %s', - i, - typeof input)); + 'stdio[%d] should be Buffer or string not %s', + i, + typeof input)); } } diff --git a/lib/fs.js b/lib/fs.js index ca95d9d0ba3336..10e960504a79bc 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -1325,7 +1325,7 @@ fs.writeFile = function(path, data, options, callback_) { function writeFd(fd, isUserFd) { var buffer = (data instanceof Buffer) ? - data : Buffer.from('' + data, options.encoding || 'utf8'); + data : Buffer.from('' + data, options.encoding || 'utf8'); var position = /a/.test(flag) ? null : 0; writeAll(fd, isUserFd, buffer, 0, buffer.length, position, callback); diff --git a/lib/internal/child_process.js b/lib/internal/child_process.js index 36675b225e17c4..764cdd3cf26997 100644 --- a/lib/internal/child_process.js +++ b/lib/internal/child_process.js @@ -343,7 +343,7 @@ ChildProcess.prototype.spawn = function(options) { // when i === 0 - we're dealing with stdin // (which is the only one writable pipe) stream.socket = createSocket(self.pid !== 0 ? - stream.handle : null, i > 0); + stream.handle : null, i > 0); if (i > 0 && self.pid !== 0) { self._closesNeeded++; diff --git a/lib/internal/freelist.js b/lib/internal/freelist.js index 90f5483724e97e..e59821cefda102 100644 --- a/lib/internal/freelist.js +++ b/lib/internal/freelist.js @@ -10,7 +10,7 @@ exports.FreeList = function(name, max, constructor) { exports.FreeList.prototype.alloc = function() { return this.list.length ? this.list.pop() : - this.constructor.apply(this, arguments); + this.constructor.apply(this, arguments); }; diff --git a/lib/internal/readline.js b/lib/internal/readline.js index dbe8775dba3aac..00ac41ee768065 100644 --- a/lib/internal/readline.js +++ b/lib/internal/readline.js @@ -56,7 +56,7 @@ function isFullWidthCodePoint(code) { // Code points are derived from: // http://www.unicode.org/Public/UNIDATA/EastAsianWidth.txt if (code >= 0x1100 && ( - code <= 0x115f || // Hangul Jamo + code <= 0x115f || // Hangul Jamo 0x2329 === code || // LEFT-POINTING ANGLE BRACKET 0x232a === code || // RIGHT-POINTING ANGLE BRACKET // CJK Radicals Supplement .. Enclosed CJK Letters and Months diff --git a/lib/internal/repl.js b/lib/internal/repl.js index b4167cc56aecad..ca4016cee38d1a 100644 --- a/lib/internal/repl.js +++ b/lib/internal/repl.js @@ -134,14 +134,14 @@ function setupHistory(repl, historyPath, oldHistoryPath, ready) { // If pre-v3.0, the user had set NODE_REPL_HISTORY_FILE to // ~/.node_repl_history, warn the user about it and proceed. repl._writeToOutput( - '\nThe old repl history file has the same name and location as ' + + '\nThe old repl history file has the same name and location as ' + `the new one i.e., ${historyPath} and is empty.\nUsing it as is.\n`); repl._refreshLine(); } else if (oldHistoryPath) { // Grab data from the older pre-v3.0 JSON NODE_REPL_HISTORY_FILE format. repl._writeToOutput( - '\nConverting old JSON repl history to line-separated history.\n' + + '\nConverting old JSON repl history to line-separated history.\n' + `The new repl history file can be found at ${historyPath}.\n`); repl._refreshLine(); @@ -225,7 +225,7 @@ function setupHistory(repl, historyPath, oldHistoryPath, ready) { function _replHistoryMessage() { if (this.history.length === 0) { this._writeToOutput( - '\nPersistent history support disabled. ' + + '\nPersistent history support disabled. ' + 'Set the NODE_REPL_HISTORY environment\nvariable to ' + 'a valid, user-writable path to enable.\n' ); diff --git a/lib/readline.js b/lib/readline.js index 05a30f1ece5595..c167db6eb10f08 100644 --- a/lib/readline.js +++ b/lib/readline.js @@ -1127,5 +1127,5 @@ exports.isFullWidthCodePoint = internalUtil.deprecate( exports.stripVTControlCharacters = internalUtil.deprecate( - stripVTControlCharacters, - 'stripVTControlCharacters is deprecated and will be removed.'); + stripVTControlCharacters, + 'stripVTControlCharacters is deprecated and will be removed.'); diff --git a/lib/url.js b/lib/url.js index ad5e715f063496..cb2a17146d464d 100644 --- a/lib/url.js +++ b/lib/url.js @@ -371,8 +371,8 @@ Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) { var firstIdx = (questionIdx !== -1 && (hashIdx === -1 || questionIdx < hashIdx) - ? questionIdx - : hashIdx); + ? questionIdx + : hashIdx); if (firstIdx === -1) { if (rest.length > 0) this.pathname = rest; diff --git a/test/.eslintrc.yaml b/test/.eslintrc.yaml index aaf3b378c035ad..4fea04d632f2d4 100644 --- a/test/.eslintrc.yaml +++ b/test/.eslintrc.yaml @@ -1,16 +1,6 @@ ## Test-specific linter rules rules: - # Stylistic Issues - # http://eslint.org/docs/rules/#stylistic-issues - indent: [error, 2, {ArrayExpression: first, - CallExpression: {arguments: first}, - FunctionDeclaration: {parameters: first}, - FunctionExpression: {parameters: first}, - MemberExpression: off, - ObjectExpression: first, - SwitchCase: 1}] - indent-legacy: off # ECMAScript 6 # http://eslint.org/docs/rules/#ecmascript-6 no-var: 2 diff --git a/tools/.eslintrc.yaml b/tools/.eslintrc.yaml deleted file mode 100644 index e1405dd718bf0f..00000000000000 --- a/tools/.eslintrc.yaml +++ /dev/null @@ -1,12 +0,0 @@ -## Tools-specific linter rules - -rules: - # Stylistic Issues - # http://eslint.org/docs/rules/#stylistic-issues - indent: [2, 2, {ArrayExpression: first, - CallExpression: {arguments: first}, - FunctionDeclaration: {parameters: first}, - FunctionExpression: {parameters: first}, - MemberExpression: off, - ObjectExpression: first, - SwitchCase: 1}]