Skip to content

Commit 62de339

Browse files
TrottMylesBorins
authored andcommitted
tools: remove legacy indentation linting
All linting now uses the current ESLint 4.3.0 indentation linting. Remove legacy indentation rules. Backport-PR-URL: #14835 PR-URL: #14515 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Claudio Rodriguez <[email protected]> Reviewed-By: Evan Lucas <[email protected]> Reviewed-By: Timothy Gu <[email protected]>
1 parent a3cd733 commit 62de339

20 files changed

+59
-86
lines changed

.eslintrc.yaml

+7-12
Original file line numberDiff line numberDiff line change
@@ -99,18 +99,13 @@ rules:
9999
func-call-spacing: 2
100100
func-name-matching: 2
101101
func-style: [2, declaration, {allowArrowFunctions: true}]
102-
# indent: [2, 2, {ArrayExpression: first,
103-
# CallExpression: {arguments: first},
104-
# FunctionDeclaration: {parameters: first},
105-
# FunctionExpression: {parameters: first},
106-
# MemberExpression: off,
107-
# ObjectExpression: first,
108-
# SwitchCase: 1}]
109-
indent-legacy: [2, 2, {ArrayExpression: first,
110-
CallExpression: {arguments: first},
111-
MemberExpression: 1,
112-
ObjectExpression: first,
113-
SwitchCase: 1}]
102+
indent: [2, 2, {ArrayExpression: first,
103+
CallExpression: {arguments: first},
104+
FunctionDeclaration: {parameters: first},
105+
FunctionExpression: {parameters: first},
106+
MemberExpression: off,
107+
ObjectExpression: first,
108+
SwitchCase: 1}]
114109
key-spacing: [2, {mode: minimum}]
115110
keyword-spacing: 2
116111
linebreak-style: [2, unix]

benchmark/README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ example, buffers/buffer-read.js has the following configuration:
3737
<!-- eslint-disable strict, no-undef, no-unused-vars -->
3838
```js
3939
var bench = common.createBenchmark(main, {
40-
noAssert: [false, true],
41-
buffer: ['fast', 'slow'],
42-
type: ['UInt8', 'UInt16LE', 'UInt16BE',
43-
'UInt32LE', 'UInt32BE',
44-
'Int8', 'Int16LE', 'Int16BE',
45-
'Int32LE', 'Int32BE',
46-
'FloatLE', 'FloatBE',
47-
'DoubleLE', 'DoubleBE'],
48-
millions: [1]
40+
noAssert: [false, true],
41+
buffer: ['fast', 'slow'],
42+
type: ['UInt8', 'UInt16LE', 'UInt16BE',
43+
'UInt32LE', 'UInt32BE',
44+
'Int8', 'Int16LE', 'Int16BE',
45+
'Int32LE', 'Int32BE',
46+
'FloatLE', 'FloatBE',
47+
'DoubleLE', 'DoubleBE'],
48+
millions: [1]
4949
});
5050
```
5151
The runner takes one item from each of the property array value to build a list

benchmark/buffers/buffer-compare-offset.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function main(conf) {
5050
const iter = (conf.millions >>> 0) * 1e6;
5151
const size = (conf.size >>> 0);
5252
const method = conf.method === 'slice' ?
53-
compareUsingSlice : compareUsingOffset;
53+
compareUsingSlice : compareUsingOffset;
5454
method(Buffer.alloc(size, 'a'),
5555
Buffer.alloc(size, 'b'),
5656
size >> 1,

benchmark/child_process/child-process-read-ipc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ if (process.argv[2] === 'child') {
2626

2727
const options = { 'stdio': ['ignore', 1, 2, 'ipc'] };
2828
const child = spawn(process.argv[0],
29-
[process.argv[1], 'child', len], options);
29+
[process.argv[1], 'child', len], options);
3030

3131
var bytes = 0;
3232
child.on('message', function(msg) {

doc/api/errors.md

+17-17
Original file line numberDiff line numberDiff line change
@@ -316,20 +316,20 @@ function makeFaster() {
316316
}
317317

318318
makeFaster(); // will throw:
319-
// /home/gbusey/file.js:6
320-
// throw new Error('oh no!');
321-
// ^
322-
// Error: oh no!
323-
// at speedy (/home/gbusey/file.js:6:11)
324-
// at makeFaster (/home/gbusey/file.js:5:3)
325-
// at Object.<anonymous> (/home/gbusey/file.js:10:1)
326-
// at Module._compile (module.js:456:26)
327-
// at Object.Module._extensions..js (module.js:474:10)
328-
// at Module.load (module.js:356:32)
329-
// at Function.Module._load (module.js:312:12)
330-
// at Function.Module.runMain (module.js:497:10)
331-
// at startup (node.js:119:16)
332-
// at node.js:906:3
319+
// /home/gbusey/file.js:6
320+
// throw new Error('oh no!');
321+
// ^
322+
// Error: oh no!
323+
// at speedy (/home/gbusey/file.js:6:11)
324+
// at makeFaster (/home/gbusey/file.js:5:3)
325+
// at Object.<anonymous> (/home/gbusey/file.js:10:1)
326+
// at Module._compile (module.js:456:26)
327+
// at Object.Module._extensions..js (module.js:474:10)
328+
// at Module.load (module.js:356:32)
329+
// at Function.Module._load (module.js:312:12)
330+
// at Function.Module.runMain (module.js:497:10)
331+
// at startup (node.js:119:16)
332+
// at node.js:906:3
333333
```
334334

335335
The location information will be one of:
@@ -360,7 +360,7 @@ For example:
360360

361361
```js
362362
require('net').connect(-1);
363-
// throws "RangeError: "port" option should be >= 0 and < 65536: -1"
363+
// throws "RangeError: "port" option should be >= 0 and < 65536: -1"
364364
```
365365

366366
Node.js will generate and throw `RangeError` instances *immediately* as a form
@@ -377,7 +377,7 @@ will do so.
377377

378378
```js
379379
doesNotExist;
380-
// throws ReferenceError, doesNotExist is not a variable in this program.
380+
// throws ReferenceError, doesNotExist is not a variable in this program.
381381
```
382382

383383
Unless an application is dynamically generating and running code,
@@ -411,7 +411,7 @@ string would be considered a TypeError.
411411

412412
```js
413413
require('url').parse(() => { });
414-
// throws TypeError, since it expected a string
414+
// throws TypeError, since it expected a string
415415
```
416416

417417
Node.js will generate and throw `TypeError` instances *immediately* as a form

doc/api/fs.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ support. If `filename` is provided, it will be provided as a `Buffer` if
137137
fs.watch('./tmp', {encoding: 'buffer'}, (eventType, filename) => {
138138
if (filename)
139139
console.log(filename);
140-
// Prints: <Buffer ...>
140+
// Prints: <Buffer ...>
141141
});
142142
```
143143

doc/api/net.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ double-backslashes, such as:
221221

222222
```js
223223
net.createServer().listen(
224-
path.join('\\\\?\\pipe', process.cwd(), 'myctl'));
224+
path.join('\\\\?\\pipe', process.cwd(), 'myctl'));
225225
```
226226

227227
The parameter `backlog` behaves the same as in

doc/api/process.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -320,11 +320,11 @@ custom or application specific warnings.
320320
```js
321321
// Emit a warning using a string...
322322
process.emitWarning('Something happened!');
323-
// Prints: (node 12345) Warning: Something happened!
323+
// Prints: (node 12345) Warning: Something happened!
324324

325325
// Emit a warning using an object...
326326
process.emitWarning('Something Happened!', 'CustomWarning');
327-
// Prints: (node 12345) CustomWarning: Something happened!
327+
// Prints: (node 12345) CustomWarning: Something happened!
328328

329329
// Emit a warning using a custom Error object...
330330
class CustomWarning extends Error {
@@ -336,7 +336,7 @@ class CustomWarning extends Error {
336336
}
337337
const myWarning = new CustomWarning('Something happened!');
338338
process.emitWarning(myWarning);
339-
// Prints: (node 12345) CustomWarning: Something happened!
339+
// Prints: (node 12345) CustomWarning: Something happened!
340340
```
341341

342342
#### Emitting custom deprecation warnings

lib/_debugger.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,7 @@ Interface.prototype.scripts = function() {
12061206
script.name === client.currentScript ||
12071207
!script.isNative) {
12081208
scripts.push(
1209-
(script.name === client.currentScript ? '* ' : ' ') +
1209+
(script.name === client.currentScript ? '* ' : ' ') +
12101210
id + ': ' +
12111211
path.basename(script.name)
12121212
);

lib/_stream_readable.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -877,8 +877,8 @@ function fromListPartial(n, list, hasStrings) {
877877
} else {
878878
// result spans more than one buffer
879879
ret = (hasStrings
880-
? copyFromBufferString(n, list)
881-
: copyFromBuffer(n, list));
880+
? copyFromBufferString(n, list)
881+
: copyFromBuffer(n, list));
882882
}
883883
return ret;
884884
}

lib/child_process.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ exports.fork = function(modulePath /*, args, options*/) {
4848
// Use a separate fd=3 for the IPC channel. Inherit stdin, stdout,
4949
// and stderr from the parent if silent isn't set.
5050
options.stdio = options.silent ? ['pipe', 'pipe', 'pipe', 'ipc'] :
51-
[0, 1, 2, 'ipc'];
51+
[0, 1, 2, 'ipc'];
5252
} else if (options.stdio.indexOf('ipc') === -1) {
5353
throw new TypeError('Forked processes must have an IPC channel');
5454
}
@@ -321,7 +321,7 @@ function normalizeSpawnArguments(file, args, options) {
321321

322322
if (process.platform === 'win32') {
323323
file = typeof options.shell === 'string' ? options.shell :
324-
process.env.comspec || 'cmd.exe';
324+
process.env.comspec || 'cmd.exe';
325325
args = ['/s', '/c', '"' + command + '"'];
326326
options.windowsVerbatimArguments = true;
327327
} else {
@@ -427,9 +427,9 @@ function spawnSync(/*file, args, options*/) {
427427
pipe.input = Buffer.from(input, options.encoding);
428428
else
429429
throw new TypeError(util.format(
430-
'stdio[%d] should be Buffer or string not %s',
431-
i,
432-
typeof input));
430+
'stdio[%d] should be Buffer or string not %s',
431+
i,
432+
typeof input));
433433
}
434434
}
435435

lib/fs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1325,7 +1325,7 @@ fs.writeFile = function(path, data, options, callback_) {
13251325

13261326
function writeFd(fd, isUserFd) {
13271327
var buffer = (data instanceof Buffer) ?
1328-
data : Buffer.from('' + data, options.encoding || 'utf8');
1328+
data : Buffer.from('' + data, options.encoding || 'utf8');
13291329
var position = /a/.test(flag) ? null : 0;
13301330

13311331
writeAll(fd, isUserFd, buffer, 0, buffer.length, position, callback);

lib/internal/child_process.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ ChildProcess.prototype.spawn = function(options) {
343343
// when i === 0 - we're dealing with stdin
344344
// (which is the only one writable pipe)
345345
stream.socket = createSocket(self.pid !== 0 ?
346-
stream.handle : null, i > 0);
346+
stream.handle : null, i > 0);
347347

348348
if (i > 0 && self.pid !== 0) {
349349
self._closesNeeded++;

lib/internal/freelist.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ exports.FreeList = function(name, max, constructor) {
1010

1111
exports.FreeList.prototype.alloc = function() {
1212
return this.list.length ? this.list.pop() :
13-
this.constructor.apply(this, arguments);
13+
this.constructor.apply(this, arguments);
1414
};
1515

1616

lib/internal/readline.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function isFullWidthCodePoint(code) {
5656
// Code points are derived from:
5757
// http://www.unicode.org/Public/UNIDATA/EastAsianWidth.txt
5858
if (code >= 0x1100 && (
59-
code <= 0x115f || // Hangul Jamo
59+
code <= 0x115f || // Hangul Jamo
6060
0x2329 === code || // LEFT-POINTING ANGLE BRACKET
6161
0x232a === code || // RIGHT-POINTING ANGLE BRACKET
6262
// CJK Radicals Supplement .. Enclosed CJK Letters and Months

lib/internal/repl.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,14 @@ function setupHistory(repl, historyPath, oldHistoryPath, ready) {
134134
// If pre-v3.0, the user had set NODE_REPL_HISTORY_FILE to
135135
// ~/.node_repl_history, warn the user about it and proceed.
136136
repl._writeToOutput(
137-
'\nThe old repl history file has the same name and location as ' +
137+
'\nThe old repl history file has the same name and location as ' +
138138
`the new one i.e., ${historyPath} and is empty.\nUsing it as is.\n`);
139139
repl._refreshLine();
140140

141141
} else if (oldHistoryPath) {
142142
// Grab data from the older pre-v3.0 JSON NODE_REPL_HISTORY_FILE format.
143143
repl._writeToOutput(
144-
'\nConverting old JSON repl history to line-separated history.\n' +
144+
'\nConverting old JSON repl history to line-separated history.\n' +
145145
`The new repl history file can be found at ${historyPath}.\n`);
146146
repl._refreshLine();
147147

@@ -225,7 +225,7 @@ function setupHistory(repl, historyPath, oldHistoryPath, ready) {
225225
function _replHistoryMessage() {
226226
if (this.history.length === 0) {
227227
this._writeToOutput(
228-
'\nPersistent history support disabled. ' +
228+
'\nPersistent history support disabled. ' +
229229
'Set the NODE_REPL_HISTORY environment\nvariable to ' +
230230
'a valid, user-writable path to enable.\n'
231231
);

lib/readline.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1127,5 +1127,5 @@ exports.isFullWidthCodePoint = internalUtil.deprecate(
11271127

11281128

11291129
exports.stripVTControlCharacters = internalUtil.deprecate(
1130-
stripVTControlCharacters,
1131-
'stripVTControlCharacters is deprecated and will be removed.');
1130+
stripVTControlCharacters,
1131+
'stripVTControlCharacters is deprecated and will be removed.');

lib/url.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,8 @@ Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
371371

372372
var firstIdx = (questionIdx !== -1 &&
373373
(hashIdx === -1 || questionIdx < hashIdx)
374-
? questionIdx
375-
: hashIdx);
374+
? questionIdx
375+
: hashIdx);
376376
if (firstIdx === -1) {
377377
if (rest.length > 0)
378378
this.pathname = rest;

test/.eslintrc.yaml

-10
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
## Test-specific linter rules
22

33
rules:
4-
# Stylistic Issues
5-
# http://eslint.org/docs/rules/#stylistic-issues
6-
indent: [error, 2, {ArrayExpression: first,
7-
CallExpression: {arguments: first},
8-
FunctionDeclaration: {parameters: first},
9-
FunctionExpression: {parameters: first},
10-
MemberExpression: off,
11-
ObjectExpression: first,
12-
SwitchCase: 1}]
13-
indent-legacy: off
144
# ECMAScript 6
155
# http://eslint.org/docs/rules/#ecmascript-6
166
no-var: 2

tools/.eslintrc.yaml

-12
This file was deleted.

0 commit comments

Comments
 (0)