Skip to content

Commit

Permalink
tools: remove legacy indentation linting
Browse files Browse the repository at this point in the history
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 <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Claudio Rodriguez <cjrodr@yahoo.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
  • Loading branch information
Trott authored and MylesBorins committed Sep 5, 2017
1 parent a3cd733 commit 62de339
Show file tree
Hide file tree
Showing 20 changed files with 59 additions and 86 deletions.
19 changes: 7 additions & 12 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
18 changes: 9 additions & 9 deletions benchmark/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ example, buffers/buffer-read.js has the following configuration:
<!-- eslint-disable strict, no-undef, no-unused-vars -->
```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
Expand Down
2 changes: 1 addition & 1 deletion benchmark/buffers/buffer-compare-offset.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion benchmark/child_process/child-process-read-ipc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
34 changes: 17 additions & 17 deletions doc/api/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.<anonymous> (/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.<anonymous> (/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:
Expand Down Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: <Buffer ...>
// Prints: <Buffer ...>
});
```

Expand Down
2 changes: 1 addition & 1 deletion doc/api/net.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions doc/api/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/_debugger.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
Expand Down
4 changes: 2 additions & 2 deletions lib/_stream_readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
10 changes: 5 additions & 5 deletions lib/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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));
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/freelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};


Expand Down
2 changes: 1 addition & 1 deletion lib/internal/readline.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions lib/internal/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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'
);
Expand Down
4 changes: 2 additions & 2 deletions lib/readline.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
4 changes: 2 additions & 2 deletions lib/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 0 additions & 10 deletions test/.eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 0 additions & 12 deletions tools/.eslintrc.yaml

This file was deleted.

0 comments on commit 62de339

Please sign in to comment.