summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2017-04-21 18:50:52 -0400
committerEvan Lucas <evanlucas@me.com>2017-05-02 12:46:18 -0500
commit258eeaa5193b2837e4cd58e0493e7dba4010c194 (patch)
tree1ec99ff29c299425fd71f1c2e863a564cc57f5b4
parentac529233083007af9eaf81386576d9df77484570 (diff)
downloadnode-new-258eeaa5193b2837e4cd58e0493e7dba4010c194.tar.gz
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>
-rw-r--r--.eslintrc.yaml1
-rw-r--r--doc/api/errors.md1
-rw-r--r--doc/api/stream.md1
-rw-r--r--lib/dgram.js1
-rw-r--r--test/parallel/test-require-symlink.js4
-rw-r--r--tools/doc/json.js4
6 files changed, 5 insertions, 7 deletions
diff --git a/.eslintrc.yaml b/.eslintrc.yaml
index b44c59caf3..d06dff8fcd 100644
--- a/.eslintrc.yaml
+++ b/.eslintrc.yaml
@@ -46,6 +46,7 @@ rules:
no-unused-labels: 2
no-useless-call: 2
no-useless-escape: 2
+ no-useless-return: 2
no-void: 2
no-with: 2
diff --git a/doc/api/errors.md b/doc/api/errors.md
index 96409a5367..76679d3be4 100644
--- a/doc/api/errors.md
+++ b/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) => {
diff --git a/doc/api/stream.md b/doc/api/stream.md
index 29eb47cbe3..4f95d03692 100644
--- a/doc/api/stream.md
+++ b/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;
diff --git a/lib/dgram.js b/lib/dgram.js
index 4beb283519..c43cb55082 100644
--- a/lib/dgram.js
+++ b/lib/dgram.js
@@ -282,7 +282,6 @@ function enqueue(self, toEnqueue) {
self.once('listening', clearQueue);
}
self._queue.push(toEnqueue);
- return;
}
diff --git a/test/parallel/test-require-symlink.js b/test/parallel/test-require-symlink.js
index 4e74606bed..964f856829 100644
--- a/test/parallel/test-require-symlink.js
+++ b/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();
diff --git a/tools/doc/json.js b/tools/doc/json.js
index 3e329a965f..c711783f14 100644
--- a/tools/doc/json.js
+++ b/tools/doc/json.js
@@ -222,7 +222,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' +
@@ -495,9 +494,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;
}
}
});