Browse Source

tools: remove legacy indentation linting

All linting now uses the current ESLint 4.3.0 indentation linting.
Remove legacy indentation rules.

Backport-PR-URL: https://github.com/nodejs/node/pull/14835
PR-URL: https://github.com/nodejs/node/pull/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>
v6.x
Rich Trott 8 years ago
committed by Myles Borins
parent
commit
62de339327
No known key found for this signature in database GPG Key ID: 933B01F40B5CA946
  1. 19
      .eslintrc.yaml
  2. 18
      benchmark/README.md
  3. 2
      benchmark/buffers/buffer-compare-offset.js
  4. 2
      benchmark/child_process/child-process-read-ipc.js
  5. 34
      doc/api/errors.md
  6. 2
      doc/api/fs.md
  7. 2
      doc/api/net.md
  8. 6
      doc/api/process.md
  9. 2
      lib/_debugger.js
  10. 4
      lib/_stream_readable.js
  11. 10
      lib/child_process.js
  12. 2
      lib/fs.js
  13. 2
      lib/internal/child_process.js
  14. 2
      lib/internal/freelist.js
  15. 2
      lib/internal/readline.js
  16. 6
      lib/internal/repl.js
  17. 4
      lib/readline.js
  18. 4
      lib/url.js
  19. 10
      test/.eslintrc.yaml
  20. 12
      tools/.eslintrc.yaml

19
.eslintrc.yaml

@ -99,18 +99,13 @@ rules:
func-call-spacing: 2 func-call-spacing: 2
func-name-matching: 2 func-name-matching: 2
func-style: [2, declaration, {allowArrowFunctions: true}] func-style: [2, declaration, {allowArrowFunctions: true}]
# indent: [2, 2, {ArrayExpression: first, indent: [2, 2, {ArrayExpression: first,
# CallExpression: {arguments: first}, CallExpression: {arguments: first},
# FunctionDeclaration: {parameters: first}, FunctionDeclaration: {parameters: first},
# FunctionExpression: {parameters: first}, FunctionExpression: {parameters: first},
# MemberExpression: off, MemberExpression: off,
# ObjectExpression: first, ObjectExpression: first,
# SwitchCase: 1}] SwitchCase: 1}]
indent-legacy: [2, 2, {ArrayExpression: first,
CallExpression: {arguments: first},
MemberExpression: 1,
ObjectExpression: first,
SwitchCase: 1}]
key-spacing: [2, {mode: minimum}] key-spacing: [2, {mode: minimum}]
keyword-spacing: 2 keyword-spacing: 2
linebreak-style: [2, unix] linebreak-style: [2, unix]

18
benchmark/README.md

@ -37,15 +37,15 @@ example, buffers/buffer-read.js has the following configuration:
<!-- eslint-disable strict, no-undef, no-unused-vars --> <!-- eslint-disable strict, no-undef, no-unused-vars -->
```js ```js
var bench = common.createBenchmark(main, { var bench = common.createBenchmark(main, {
noAssert: [false, true], noAssert: [false, true],
buffer: ['fast', 'slow'], buffer: ['fast', 'slow'],
type: ['UInt8', 'UInt16LE', 'UInt16BE', type: ['UInt8', 'UInt16LE', 'UInt16BE',
'UInt32LE', 'UInt32BE', 'UInt32LE', 'UInt32BE',
'Int8', 'Int16LE', 'Int16BE', 'Int8', 'Int16LE', 'Int16BE',
'Int32LE', 'Int32BE', 'Int32LE', 'Int32BE',
'FloatLE', 'FloatBE', 'FloatLE', 'FloatBE',
'DoubleLE', 'DoubleBE'], 'DoubleLE', 'DoubleBE'],
millions: [1] millions: [1]
}); });
``` ```
The runner takes one item from each of the property array value to build a list The runner takes one item from each of the property array value to build a list

2
benchmark/buffers/buffer-compare-offset.js

@ -50,7 +50,7 @@ function main(conf) {
const iter = (conf.millions >>> 0) * 1e6; const iter = (conf.millions >>> 0) * 1e6;
const size = (conf.size >>> 0); const size = (conf.size >>> 0);
const method = conf.method === 'slice' ? const method = conf.method === 'slice' ?
compareUsingSlice : compareUsingOffset; compareUsingSlice : compareUsingOffset;
method(Buffer.alloc(size, 'a'), method(Buffer.alloc(size, 'a'),
Buffer.alloc(size, 'b'), Buffer.alloc(size, 'b'),
size >> 1, size >> 1,

2
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 options = { 'stdio': ['ignore', 1, 2, 'ipc'] };
const child = spawn(process.argv[0], const child = spawn(process.argv[0],
[process.argv[1], 'child', len], options); [process.argv[1], 'child', len], options);
var bytes = 0; var bytes = 0;
child.on('message', function(msg) { child.on('message', function(msg) {

34
doc/api/errors.md

@ -316,20 +316,20 @@ function makeFaster() {
} }
makeFaster(); // will throw: makeFaster(); // will throw:
// /home/gbusey/file.js:6 // /home/gbusey/file.js:6
// throw new Error('oh no!'); // throw new Error('oh no!');
// ^ // ^
// Error: oh no! // Error: oh no!
// at speedy (/home/gbusey/file.js:6:11) // at speedy (/home/gbusey/file.js:6:11)
// at makeFaster (/home/gbusey/file.js:5:3) // at makeFaster (/home/gbusey/file.js:5:3)
// at Object.<anonymous> (/home/gbusey/file.js:10:1) // at Object.<anonymous> (/home/gbusey/file.js:10:1)
// at Module._compile (module.js:456:26) // at Module._compile (module.js:456:26)
// at Object.Module._extensions..js (module.js:474:10) // at Object.Module._extensions..js (module.js:474:10)
// at Module.load (module.js:356:32) // at Module.load (module.js:356:32)
// at Function.Module._load (module.js:312:12) // at Function.Module._load (module.js:312:12)
// at Function.Module.runMain (module.js:497:10) // at Function.Module.runMain (module.js:497:10)
// at startup (node.js:119:16) // at startup (node.js:119:16)
// at node.js:906:3 // at node.js:906:3
``` ```
The location information will be one of: The location information will be one of:
@ -360,7 +360,7 @@ For example:
```js ```js
require('net').connect(-1); 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 Node.js will generate and throw `RangeError` instances *immediately* as a form
@ -377,7 +377,7 @@ will do so.
```js ```js
doesNotExist; 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, Unless an application is dynamically generating and running code,
@ -411,7 +411,7 @@ string would be considered a TypeError.
```js ```js
require('url').parse(() => { }); 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 Node.js will generate and throw `TypeError` instances *immediately* as a form

2
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) => { fs.watch('./tmp', {encoding: 'buffer'}, (eventType, filename) => {
if (filename) if (filename)
console.log(filename); console.log(filename);
// Prints: <Buffer ...> // Prints: <Buffer ...>
}); });
``` ```

2
doc/api/net.md

@ -221,7 +221,7 @@ double-backslashes, such as:
```js ```js
net.createServer().listen( net.createServer().listen(
path.join('\\\\?\\pipe', process.cwd(), 'myctl')); path.join('\\\\?\\pipe', process.cwd(), 'myctl'));
``` ```
The parameter `backlog` behaves the same as in The parameter `backlog` behaves the same as in

6
doc/api/process.md

@ -320,11 +320,11 @@ custom or application specific warnings.
```js ```js
// Emit a warning using a string... // Emit a warning using a string...
process.emitWarning('Something happened!'); process.emitWarning('Something happened!');
// Prints: (node 12345) Warning: Something happened! // Prints: (node 12345) Warning: Something happened!
// Emit a warning using an object... // Emit a warning using an object...
process.emitWarning('Something Happened!', 'CustomWarning'); 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... // Emit a warning using a custom Error object...
class CustomWarning extends Error { class CustomWarning extends Error {
@ -336,7 +336,7 @@ class CustomWarning extends Error {
} }
const myWarning = new CustomWarning('Something happened!'); const myWarning = new CustomWarning('Something happened!');
process.emitWarning(myWarning); process.emitWarning(myWarning);
// Prints: (node 12345) CustomWarning: Something happened! // Prints: (node 12345) CustomWarning: Something happened!
``` ```
#### Emitting custom deprecation warnings #### Emitting custom deprecation warnings

2
lib/_debugger.js

@ -1206,7 +1206,7 @@ Interface.prototype.scripts = function() {
script.name === client.currentScript || script.name === client.currentScript ||
!script.isNative) { !script.isNative) {
scripts.push( scripts.push(
(script.name === client.currentScript ? '* ' : ' ') + (script.name === client.currentScript ? '* ' : ' ') +
id + ': ' + id + ': ' +
path.basename(script.name) path.basename(script.name)
); );

4
lib/_stream_readable.js

@ -877,8 +877,8 @@ function fromListPartial(n, list, hasStrings) {
} else { } else {
// result spans more than one buffer // result spans more than one buffer
ret = (hasStrings ret = (hasStrings
? copyFromBufferString(n, list) ? copyFromBufferString(n, list)
: copyFromBuffer(n, list)); : copyFromBuffer(n, list));
} }
return ret; return ret;
} }

10
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, // Use a separate fd=3 for the IPC channel. Inherit stdin, stdout,
// and stderr from the parent if silent isn't set. // and stderr from the parent if silent isn't set.
options.stdio = options.silent ? ['pipe', 'pipe', 'pipe', 'ipc'] : options.stdio = options.silent ? ['pipe', 'pipe', 'pipe', 'ipc'] :
[0, 1, 2, 'ipc']; [0, 1, 2, 'ipc'];
} else if (options.stdio.indexOf('ipc') === -1) { } else if (options.stdio.indexOf('ipc') === -1) {
throw new TypeError('Forked processes must have an IPC channel'); throw new TypeError('Forked processes must have an IPC channel');
} }
@ -321,7 +321,7 @@ function normalizeSpawnArguments(file, args, options) {
if (process.platform === 'win32') { if (process.platform === 'win32') {
file = typeof options.shell === 'string' ? options.shell : file = typeof options.shell === 'string' ? options.shell :
process.env.comspec || 'cmd.exe'; process.env.comspec || 'cmd.exe';
args = ['/s', '/c', '"' + command + '"']; args = ['/s', '/c', '"' + command + '"'];
options.windowsVerbatimArguments = true; options.windowsVerbatimArguments = true;
} else { } else {
@ -427,9 +427,9 @@ function spawnSync(/*file, args, options*/) {
pipe.input = Buffer.from(input, options.encoding); pipe.input = Buffer.from(input, options.encoding);
else else
throw new TypeError(util.format( throw new TypeError(util.format(
'stdio[%d] should be Buffer or string not %s', 'stdio[%d] should be Buffer or string not %s',
i, i,
typeof input)); typeof input));
} }
} }

2
lib/fs.js

@ -1325,7 +1325,7 @@ fs.writeFile = function(path, data, options, callback_) {
function writeFd(fd, isUserFd) { function writeFd(fd, isUserFd) {
var buffer = (data instanceof Buffer) ? 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; var position = /a/.test(flag) ? null : 0;
writeAll(fd, isUserFd, buffer, 0, buffer.length, position, callback); writeAll(fd, isUserFd, buffer, 0, buffer.length, position, callback);

2
lib/internal/child_process.js

@ -343,7 +343,7 @@ ChildProcess.prototype.spawn = function(options) {
// when i === 0 - we're dealing with stdin // when i === 0 - we're dealing with stdin
// (which is the only one writable pipe) // (which is the only one writable pipe)
stream.socket = createSocket(self.pid !== 0 ? stream.socket = createSocket(self.pid !== 0 ?
stream.handle : null, i > 0); stream.handle : null, i > 0);
if (i > 0 && self.pid !== 0) { if (i > 0 && self.pid !== 0) {
self._closesNeeded++; self._closesNeeded++;

2
lib/internal/freelist.js

@ -10,7 +10,7 @@ exports.FreeList = function(name, max, constructor) {
exports.FreeList.prototype.alloc = function() { exports.FreeList.prototype.alloc = function() {
return this.list.length ? this.list.pop() : return this.list.length ? this.list.pop() :
this.constructor.apply(this, arguments); this.constructor.apply(this, arguments);
}; };

2
lib/internal/readline.js

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

6
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 // If pre-v3.0, the user had set NODE_REPL_HISTORY_FILE to
// ~/.node_repl_history, warn the user about it and proceed. // ~/.node_repl_history, warn the user about it and proceed.
repl._writeToOutput( 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`); `the new one i.e., ${historyPath} and is empty.\nUsing it as is.\n`);
repl._refreshLine(); repl._refreshLine();
} else if (oldHistoryPath) { } else if (oldHistoryPath) {
// Grab data from the older pre-v3.0 JSON NODE_REPL_HISTORY_FILE format. // Grab data from the older pre-v3.0 JSON NODE_REPL_HISTORY_FILE format.
repl._writeToOutput( 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`); `The new repl history file can be found at ${historyPath}.\n`);
repl._refreshLine(); repl._refreshLine();
@ -225,7 +225,7 @@ function setupHistory(repl, historyPath, oldHistoryPath, ready) {
function _replHistoryMessage() { function _replHistoryMessage() {
if (this.history.length === 0) { if (this.history.length === 0) {
this._writeToOutput( this._writeToOutput(
'\nPersistent history support disabled. ' + '\nPersistent history support disabled. ' +
'Set the NODE_REPL_HISTORY environment\nvariable to ' + 'Set the NODE_REPL_HISTORY environment\nvariable to ' +
'a valid, user-writable path to enable.\n' 'a valid, user-writable path to enable.\n'
); );

4
lib/readline.js

@ -1127,5 +1127,5 @@ exports.isFullWidthCodePoint = internalUtil.deprecate(
exports.stripVTControlCharacters = internalUtil.deprecate( exports.stripVTControlCharacters = internalUtil.deprecate(
stripVTControlCharacters, stripVTControlCharacters,
'stripVTControlCharacters is deprecated and will be removed.'); 'stripVTControlCharacters is deprecated and will be removed.');

4
lib/url.js

@ -371,8 +371,8 @@ Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
var firstIdx = (questionIdx !== -1 && var firstIdx = (questionIdx !== -1 &&
(hashIdx === -1 || questionIdx < hashIdx) (hashIdx === -1 || questionIdx < hashIdx)
? questionIdx ? questionIdx
: hashIdx); : hashIdx);
if (firstIdx === -1) { if (firstIdx === -1) {
if (rest.length > 0) if (rest.length > 0)
this.pathname = rest; this.pathname = rest;

10
test/.eslintrc.yaml

@ -1,16 +1,6 @@
## Test-specific linter rules ## Test-specific linter rules
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 # ECMAScript 6
# http://eslint.org/docs/rules/#ecmascript-6 # http://eslint.org/docs/rules/#ecmascript-6
no-var: 2 no-var: 2

12
tools/.eslintrc.yaml

@ -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}]
Loading…
Cancel
Save