Skip to content

Commit 7965c89

Browse files
TrottFishrock123
authored andcommitted
tools: enable no-self-assign ESLint rule
Enabled no-self-assign rule in ESLint. This required one change in a benchmark file. Changed a loop (that is outside of the benchmark itself, so performance is not critical) from a for loop that repeats a string to use String.prototype.repeat() instead. While at it, took the opportunity to const-ify the benchmark file. Also moved the "Strict" section in the .eslintrc to match where it is in the ESLint documentation. Updated the link for Strict rules to point to the ESLint website rather than the GitHub-hosted code. PR-URL: #5552 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Johan Bergström <[email protected]> Reviewed-By: targos - Michaël Zasso <[email protected]> Reviewed-By: Roman Reiss <[email protected]>
1 parent eb5a95e commit 7965c89

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

.eslintrc

+8-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ env:
44

55
rules:
66
# Possible Errors
7-
# https://github.com/eslint/eslint/tree/master/docs/rules#possible-errors
7+
# http://eslint.org/docs/rules/#possible-errors
88
comma-dangle: [2, "only-multiline"]
99
no-control-regex: 2
1010
no-debugger: 2
@@ -28,12 +28,17 @@ rules:
2828
valid-typeof: 2
2929

3030
# Best Practices
31-
# https://github.com/eslint/eslint/tree/master/docs/rules#best-practices
31+
# http://eslint.org/docs/rules/#best-practices
3232
no-fallthrough: 2
3333
no-octal: 2
3434
no-redeclare: 2
35+
no-self-assign: 2
3536
no-unused-labels: 2
3637

38+
# Strict Mode
39+
# http://eslint.org/docs/rules/#strict-mode
40+
strict: [2, "global"]
41+
3742
# Variables
3843
# http://eslint.org/docs/rules/#variables
3944
no-delete-var: 2
@@ -48,7 +53,7 @@ rules:
4853
no-restricted-modules: [2, "sys", "_linklist"]
4954

5055
# Stylistic Issues
51-
# https://github.com/eslint/eslint/tree/master/docs/rules#stylistic-issues
56+
# http://eslint.org/docs/rules/#stylistic-issues
5257
comma-spacing: 2
5358
eol-last: 2
5459
indent: [2, 2, {SwitchCase: 1}]
@@ -79,10 +84,6 @@ rules:
7984
no-this-before-super: 2
8085
prefer-const: 2
8186

82-
# Strict Mode
83-
# https://github.com/eslint/eslint/tree/master/docs/rules#strict-mode
84-
strict: [2, "global"]
85-
8687
# Custom rules in tools/eslint-rules
8788
new-with-error: [2, "Error", "RangeError", "TypeError", "SyntaxError", "ReferenceError"]
8889

benchmark/buffers/buffer-base64-decode.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
'use strict';
2-
var assert = require('assert');
3-
var common = require('../common.js');
2+
const assert = require('assert');
3+
const common = require('../common.js');
44

5-
var bench = common.createBenchmark(main, {});
5+
const bench = common.createBenchmark(main, {});
66

77
function main(conf) {
8-
for (var s = 'abcd'; s.length < 32 << 20; s += s);
8+
const s = 'abcd'.repeat(8 << 20);
99
s.match(/./); // Flatten string.
1010
assert.equal(s.length % 4, 0);
11-
var b = Buffer(s.length / 4 * 3);
11+
const b = Buffer(s.length / 4 * 3);
1212
b.write(s, 0, s.length, 'base64');
1313
bench.start();
1414
for (var i = 0; i < 32; i += 1) b.base64Write(s, 0, s.length);

0 commit comments

Comments
 (0)