Skip to content

Commit

Permalink
[js] Enable prefer-const linting rule
Browse files Browse the repository at this point in the history
Manually convert some lets into consts
  • Loading branch information
pmurias committed Oct 23, 2017
1 parent 33d6db5 commit 5f702e0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.js
Expand Up @@ -13,6 +13,7 @@ module.exports = {
"prefer-rest-params": "off",
"prefer-spread": "off",
"no-invalid-this": "off",
"no-throw-literal": "off"
"no-throw-literal": "off",
"prefer-const": "error"
}
};
9 changes: 3 additions & 6 deletions src/vm/js/nqp-runtime/deserialization.js
Expand Up @@ -194,15 +194,14 @@ class BinaryCursor {
}

locateThing(thingType) {
let packed;
let scId;
let index;

const PACKED_SC_SHIFT = 20;
const PACKED_SC_OVERFLOW = 0xfff;
const PACKED_SC_IDX_MASK = 0x000fffff;

packed = this.varint();
const packed = this.varint();
scId = packed >>> PACKED_SC_SHIFT;
index = packed & PACKED_SC_IDX_MASK;

Expand Down Expand Up @@ -255,17 +254,15 @@ class BinaryCursor {
// XXX TODO - length checks
varint() {
let result;
let first;
let need;
const buffer = this.buffer;

first = buffer.readUInt8(this.offset++);
const first = buffer.readUInt8(this.offset++);

if (first & 0x80) {
return first - 129;
}

need = first >> 4;
const need = first >> 4;

if (!need) {
// unrolled loop for optimization
Expand Down
2 changes: 1 addition & 1 deletion src/vm/js/nqp-runtime/null.js
@@ -1,6 +1,6 @@
'use strict';
const NQPObject = require('./nqp-object.js');
let singleton;
let singleton; // eslint-disable-line prefer-const
class Null extends NQPObject {
$$toBool(ctx) {
return 0;
Expand Down

0 comments on commit 5f702e0

Please sign in to comment.