GeezerVison is showing github.com — tools: enable no-unused-expressions lint rule · moander/node@bf31d3c
File treeExpand file treeCollapse file tree Open diff view settings js-native-api/test_general
Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: .eslintrc.js +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -234,6 +234,7 @@ module.exports = { | 234 | 234 | 'no-unreachable': 'error', | 235 | 235 | 'no-unsafe-finally': 'error', | 236 | 236 | 'no-unsafe-negation': 'error', | | 237 | + 'no-unused-expressions': ['error', { allowShortCircuit: true }], | 237 | 238 | 'no-unused-labels': 'error', | 238 | 239 | 'no-unused-vars': ['error', { args: 'none', caughtErrors: 'all' }], | 239 | 240 | 'no-use-before-define': ['error', { | |
Collapse file Copy file name to clipboardExpand all lines: benchmark/_benchmark_progress.js -1Lines changed: 0 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -39,7 +39,6 @@ class BenchmarkProgress { | 39 | 39 | this.completedConfig = 0; | 40 | 40 | // Total number of configurations for the current file | 41 | 41 | this.scheduledConfig = 0; | 42 | | - this.interval; // Updates the elapsed time. | 43 | 42 | } | 44 | 43 |
| 45 | 44 | startQueue(index) { | |
Collapse file Copy file name to clipboardExpand all lines: benchmark/es/destructuring-bench.js +4-2Lines changed: 4 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -12,7 +12,8 @@ function runSwapManual(n) { | 12 | 12 | let x, y, r; | 13 | 13 | bench.start(); | 14 | 14 | for (let i = 0; i < n; i++) { | 15 | | - x = 1, y = 2; | | 15 | + x = 1; | | 16 | + y = 2; | 16 | 17 | r = x; | 17 | 18 | x = y; | 18 | 19 | y = r; | @@ -26,7 +27,8 @@ function runSwapDestructured(n) { | 26 | 27 | let x, y; | 27 | 28 | bench.start(); | 28 | 29 | for (let i = 0; i < n; i++) { | 29 | | - x = 1, y = 2; | | 30 | + x = 1; | | 31 | + y = 2; | 30 | 32 | [x, y] = [y, x]; | 31 | 33 | assert.strictEqual(x, 2); | 32 | 34 | assert.strictEqual(y, 1); | |
Collapse file Copy file name to clipboardExpand all lines: benchmark/perf_hooks/bench-eventlooputil.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -33,7 +33,7 @@ function main({ method, n }) { | 33 | 33 | function benchIdleTime(n) { | 34 | 34 | bench.start(); | 35 | 35 | for (let i = 0; i < n; i++) | 36 | | - nodeTiming.idleTime; | | 36 | + nodeTiming.idleTime; // eslint-disable-line no-unused-expressions | 37 | 37 | bench.end(n); | 38 | 38 | } | 39 | 39 |
| |
Collapse file Copy file name to clipboardExpand all lines: benchmark/process/bench-env.js +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -13,7 +13,7 @@ function main({ n, operation }) { | 13 | 13 | case 'get': | 14 | 14 | bench.start(); | 15 | 15 | for (let i = 0; i < n; i++) { | 16 | | - process.env.PATH; | | 16 | + process.env.PATH; // eslint-disable-line no-unused-expressions | 17 | 17 | } | 18 | 18 | bench.end(n); | 19 | 19 | break; | @@ -42,7 +42,7 @@ function main({ n, operation }) { | 42 | 42 | case 'query': | 43 | 43 | bench.start(); | 44 | 44 | for (let i = 0; i < n; i++) { | 45 | | - 'PATH' in process.env; | | 45 | + 'PATH' in process.env; // eslint-disable-line no-unused-expressions | 46 | 46 | } | 47 | 47 | bench.end(n); | 48 | 48 | break; | |
Collapse file Copy file name to clipboardExpand all lines: benchmark/string_decoder/string-decoder-create.js +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -12,8 +12,7 @@ const bench = common.createBenchmark(main, { | 12 | 12 | function main({ encoding, n }) { | 13 | 13 | bench.start(); | 14 | 14 | for (let i = 0; i < n; ++i) { | 15 | | - const sd = new StringDecoder(encoding); | 16 | | - !!sd.encoding; | | 15 | + new StringDecoder(encoding); | 17 | 16 | } | 18 | 17 | bench.end(n); | 19 | 18 | } |
Collapse file Copy file name to clipboardExpand all lines: doc/.eslintrc.yaml +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 4 | 4 | # ease some restrictions in doc examples | 5 | 5 | no-restricted-properties: off | 6 | 6 | no-undef: off | | 7 | + no-unused-expressions: off | 7 | 8 | no-unused-vars: off | 8 | 9 | symbol-description: off | 9 | 10 |
| |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/assert/assertion_error.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -455,7 +455,7 @@ class AssertionError extends Error { | 455 | 455 | } | 456 | 456 | ErrorCaptureStackTrace(this, stackStartFn || stackStartFunction); | 457 | 457 | // Create error message including the error code in the name. | 458 | | - this.stack; | | 458 | + this.stack; // eslint-disable-line no-unused-expressions | 459 | 459 | // Reset the name. | 460 | 460 | this.name = 'AssertionError'; | 461 | 461 | } | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/buffer.js +12-12Lines changed: 12 additions & 12 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -952,18 +952,18 @@ function writeFloatBackwards(val, offset = 0) { | 952 | 952 | class FastBuffer extends Uint8Array {} | 953 | 953 |
| 954 | 954 | function addBufferPrototypeMethods(proto) { | 955 | | - proto.readBigUInt64LE = readBigUInt64LE, | 956 | | - proto.readBigUInt64BE = readBigUInt64BE, | 957 | | - proto.readBigUint64LE = readBigUInt64LE, | 958 | | - proto.readBigUint64BE = readBigUInt64BE, | 959 | | - proto.readBigInt64LE = readBigInt64LE, | 960 | | - proto.readBigInt64BE = readBigInt64BE, | 961 | | - proto.writeBigUInt64LE = writeBigUInt64LE, | 962 | | - proto.writeBigUInt64BE = writeBigUInt64BE, | 963 | | - proto.writeBigUint64LE = writeBigUInt64LE, | 964 | | - proto.writeBigUint64BE = writeBigUInt64BE, | 965 | | - proto.writeBigInt64LE = writeBigInt64LE, | 966 | | - proto.writeBigInt64BE = writeBigInt64BE, | | 955 | + proto.readBigUInt64LE = readBigUInt64LE; | | 956 | + proto.readBigUInt64BE = readBigUInt64BE; | | 957 | + proto.readBigUint64LE = readBigUInt64LE; | | 958 | + proto.readBigUint64BE = readBigUInt64BE; | | 959 | + proto.readBigInt64LE = readBigInt64LE; | | 960 | + proto.readBigInt64BE = readBigInt64BE; | | 961 | + proto.writeBigUInt64LE = writeBigUInt64LE; | | 962 | + proto.writeBigUInt64BE = writeBigUInt64BE; | | 963 | + proto.writeBigUint64LE = writeBigUInt64LE; | | 964 | + proto.writeBigUint64BE = writeBigUInt64BE; | | 965 | + proto.writeBigInt64LE = writeBigInt64LE; | | 966 | + proto.writeBigInt64BE = writeBigInt64BE; | 967 | 967 |
| 968 | 968 | proto.readUIntLE = readUIntLE; | 969 | 969 | proto.readUInt32LE = readUInt32LE; | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/errors.js +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -332,7 +332,7 @@ function addCodeToName(err, name, code) { | 332 | 332 | err.name = `${name} [${code}]`; | 333 | 333 | // Access the stack to generate the error message including the error code | 334 | 334 | // from the name. | 335 | | - err.stack; | | 335 | + err.stack; // eslint-disable-line no-unused-expressions | 336 | 336 | // Reset the name to the actual name. | 337 | 337 | if (name === 'SystemError') { | 338 | 338 | ObjectDefineProperty(err, 'name', { | @@ -1411,11 +1411,11 @@ E('ERR_TLS_CERT_ALTNAME_INVALID', function(reason, host, cert) { | 1411 | 1411 | }, Error); | 1412 | 1412 | E('ERR_TLS_DH_PARAM_SIZE', 'DH parameter size %s is less than 2048', Error); | 1413 | 1413 | E('ERR_TLS_HANDSHAKE_TIMEOUT', 'TLS handshake timeout', Error); | 1414 | | -E('ERR_TLS_INVALID_CONTEXT', '%s must be a SecureContext', TypeError), | 1415 | | -E('ERR_TLS_INVALID_STATE', 'TLS socket connection must be securely established', | 1416 | | - Error), | | 1414 | +E('ERR_TLS_INVALID_CONTEXT', '%s must be a SecureContext', TypeError); | 1417 | 1415 | E('ERR_TLS_INVALID_PROTOCOL_VERSION', | 1418 | 1416 | '%j is not a valid %s TLS protocol version', TypeError); | | 1417 | +E('ERR_TLS_INVALID_STATE', 'TLS socket connection must be securely established', | | 1418 | + Error); | 1419 | 1419 | E('ERR_TLS_PROTOCOL_VERSION_CONFLICT', | 1420 | 1420 | 'TLS protocol version %j conflicts with secureProtocol %j', TypeError); | 1421 | 1421 | E('ERR_TLS_RENEGOTIATION_DISABLED', | |
|