Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: enable array-callback-return ESLint rule #17858

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ rules:
# Best Practices
# http://eslint.org/docs/rules/#best-practices
accessor-pairs: error
array-callback-return: error
dot-location: [error, property]
eqeqeq: [error, smart]
no-fallthrough: error
Expand Down
4 changes: 1 addition & 3 deletions lib/readline.js
Original file line number Diff line number Diff line change
Expand Up @@ -500,9 +500,7 @@ Interface.prototype._tabComplete = function(lastKeypressWasTab) {
}

// If there is a common prefix to all matches, then apply that portion.
var f = completions.filter(function completionFilter(e) {
if (e) return e;
});
var f = completions.filter((e) => e);
var prefix = commonPrefix(f);
if (prefix.length > completeOn.length) {
self._insertString(prefix.slice(completeOn.length));
Expand Down
8 changes: 4 additions & 4 deletions test/parallel/test-https-options-boolean-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const invalidCertRE = /^The "cert" argument must be one of type string, Buffer,
[false, [certStr, certStr2]],
[[{ pem: keyBuff }], false],
[[{ pem: keyBuff }, { pem: keyBuff }], false]
].map((params) => {
].forEach((params) => {
assert.doesNotThrow(() => {
https.createServer({
key: params[0],
Expand Down Expand Up @@ -100,7 +100,7 @@ const invalidCertRE = /^The "cert" argument must be one of type string, Buffer,
[[keyStr, keyStr2], [true, false], invalidCertRE],
[[keyStr, keyStr2], true, invalidCertRE],
[true, [certBuff, certBuff2], invalidKeyRE]
].map((params) => {
].forEach((params) => {
common.expectsError(() => {
https.createServer({
key: params[0],
Expand All @@ -123,7 +123,7 @@ const invalidCertRE = /^The "cert" argument must be one of type string, Buffer,
[keyBuff, certBuff, caArrBuff],
[keyBuff, certBuff, caArrDataView],
[keyBuff, certBuff, false],
].map((params) => {
].forEach((params) => {
assert.doesNotThrow(() => {
https.createServer({
key: params[0],
Expand All @@ -141,7 +141,7 @@ const invalidCertRE = /^The "cert" argument must be one of type string, Buffer,
[keyBuff, certBuff, 1],
[keyBuff, certBuff, true],
[keyBuff, certBuff, [caCert, true]]
].map((params) => {
].forEach((params) => {
common.expectsError(() => {
https.createServer({
key: params[0],
Expand Down
12 changes: 6 additions & 6 deletions test/parallel/test-tls-options-boolean-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const invalidCertRE = /^The "cert" argument must be one of type string, Buffer,
[false, [certStr, certStr2]],
[[{ pem: keyBuff }], false],
[[{ pem: keyBuff }, { pem: keyBuff }], false]
].map(([key, cert]) => {
].forEach(([key, cert]) => {
assert.doesNotThrow(() => {
tls.createServer({ key, cert });
});
Expand Down Expand Up @@ -97,7 +97,7 @@ const invalidCertRE = /^The "cert" argument must be one of type string, Buffer,
[[keyStr, keyStr2], [true, false], invalidCertRE],
[[keyStr, keyStr2], true, invalidCertRE],
[true, [certBuff, certBuff2], invalidKeyRE]
].map(([key, cert, message]) => {
].forEach(([key, cert, message]) => {
common.expectsError(() => {
tls.createServer({ key, cert });
}, {
Expand All @@ -117,7 +117,7 @@ const invalidCertRE = /^The "cert" argument must be one of type string, Buffer,
[keyBuff, certBuff, caArrBuff],
[keyBuff, certBuff, caArrDataView],
[keyBuff, certBuff, false],
].map(([key, cert, ca]) => {
].forEach(([key, cert, ca]) => {
assert.doesNotThrow(() => {
tls.createServer({ key, cert, ca });
});
Expand All @@ -131,7 +131,7 @@ const invalidCertRE = /^The "cert" argument must be one of type string, Buffer,
[keyBuff, certBuff, 1],
[keyBuff, certBuff, true],
[keyBuff, certBuff, [caCert, true]]
].map(([key, cert, ca]) => {
].forEach(([key, cert, ca]) => {
common.expectsError(() => {
tls.createServer({ key, cert, ca });
}, {
Expand All @@ -149,7 +149,7 @@ const invalidCertRE = /^The "cert" argument must be one of type string, Buffer,
[keyBuff, certBuff, 1],
[keyBuff, certBuff, true],
[keyBuff, certBuff, [caCert, true]]
].map(([key, cert, ca]) => {
].forEach(([key, cert, ca]) => {
common.expectsError(() => {
tls.createServer({ key, cert, ca });
}, {
Expand All @@ -167,7 +167,7 @@ const invalidCertRE = /^The "cert" argument must be one of type string, Buffer,
[undefined, undefined, undefined],
['', '', ''],
[0, 0, 0]
].map(([key, cert, ca]) => {
].forEach(([key, cert, ca]) => {
assert.doesNotThrow(() => {
tls.createSecureContext({ key, cert, ca });
});
Expand Down