Browse Source

tools: enable no-useless-return eslint rule

PR-URL: https://github.com/nodejs/node/pull/12577
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
v6
cjihrig 8 years ago
parent
commit
7a4d383c75
  1. 1
      .eslintrc.yaml
  2. 1
      doc/api/errors.md
  3. 1
      doc/api/stream.md
  4. 1
      lib/dgram.js
  5. 4
      test/parallel/test-require-symlink.js
  6. 4
      tools/doc/json.js

1
.eslintrc.yaml

@ -50,6 +50,7 @@ rules:
no-unused-labels: 2
no-useless-call: 2
no-useless-escape: 2
no-useless-return: 2
no-void: 2
no-with: 2

1
doc/api/errors.md

@ -64,6 +64,7 @@ Errors that occur within _Asynchronous APIs_ may be reported in multiple ways:
argument is not `null` and is an instance of `Error`, then an error occurred
that should be handled.
<!-- eslint-disable no-useless-return -->
```js
const fs = require('fs');
fs.readFile('a file that does not exist', (err, data) => {

1
doc/api/stream.md

@ -1566,6 +1566,7 @@ unexpected and inconsistent behavior depending on whether the stream is
operating in flowing or paused mode. Using the `'error'` event ensures
consistent and predictable handling of errors.
<!-- eslint-disable no-useless-return -->
```js
const Readable = require('stream').Readable;

1
lib/dgram.js

@ -307,7 +307,6 @@ function enqueue(self, toEnqueue) {
self.once('listening', onListenSuccess);
}
self._queue.push(toEnqueue);
return;
}

4
test/parallel/test-require-symlink.js

@ -30,9 +30,9 @@ if (common.isWindows) {
if (err || !o.includes('SeCreateSymbolicLinkPrivilege')) {
common.skip('insufficient privileges');
return;
} else {
test();
}
test();
});
} else {
test();

4
tools/doc/json.js

@ -243,7 +243,6 @@ function processList(section) {
current.options.push(n);
current = n;
}
return;
} else if (type === 'list_item_end') {
if (!current) {
throw new Error('invalid list - end without current item\n' +
@ -516,9 +515,6 @@ function finishSection(section, parent) {
parent[k] = parent[k].concat(section[k]);
} else if (!parent[k]) {
parent[k] = section[k];
} else {
// parent already has, and it's not an array.
return;
}
}
});

Loading…
Cancel
Save