Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
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.
  • Loading branch information
Trott committed Mar 5, 2016
commit d03d0dbac6c9819c9a3eddd6188fc1a60d838b2a
9 changes: 5 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,13 @@ rules:
no-fallthrough: 2
no-octal: 2
no-redeclare: 2
no-self-assign: 2
no-unused-labels: 2

# Strict Mode
# http://eslint.org/docs/rules/#strict-mode
strict: [2, "global"]

# Variables
# http://eslint.org/docs/rules/#variables
no-delete-var: 2
Expand Down Expand Up @@ -79,10 +84,6 @@ rules:
no-this-before-super: 2
prefer-const: 2

# Strict Mode
# https://github.com/eslint/eslint/tree/master/docs/rules#strict-mode
strict: [2, "global"]

# Custom rules in tools/eslint-rules
new-with-error: [2, "Error", "RangeError", "TypeError", "SyntaxError", "ReferenceError"]

Expand Down
10 changes: 5 additions & 5 deletions benchmark/buffers/buffer-base64-decode.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
'use strict';
var assert = require('assert');
var common = require('../common.js');
const assert = require('assert');
const common = require('../common.js');

var bench = common.createBenchmark(main, {});
const bench = common.createBenchmark(main, {});

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