Prefer const in modern

This commit is contained in:
Jordan Eldredge 2019-08-18 14:18:56 -07:00
parent 5e048bc4f0
commit cc0aa9682f
5 changed files with 8 additions and 8 deletions

View file

@ -2,7 +2,6 @@
"rules": {
// TODO: Turn these all back on
"camelcase": "off",
"prefer-const": "off",
"no-shadow": "off",
"no-nested-ternary": "off",
"no-undef": "off",

View file

@ -57,7 +57,8 @@ const parsers = {
sendparams: noop,
elements: (node, parent) => new JsElements(node, parent),
bitmap: async (node, parent, zip) => {
let { file, gammagroup, h, id, w, x, y } = node.attributes;
let { h, w, x, y } = node.attributes;
const { file, gammagroup, id } = node.attributes;
// TODO: Escape file for regex
const img = getCaseInsensitveFile(zip, file);
if (img === undefined) {

View file

@ -135,9 +135,9 @@ export function* interpret(start, program, stack = []) {
case 24:
case 112: {
const methodOffset = command.arg;
let { name: methodName, typeOffset: classesOffset } = methods[
methodOffset
];
const method = methods[methodOffset];
let methodName = method.name;
const classesOffset = method.typeOffset;
methodName = methodName.toLowerCase();
const klass = classes[classesOffset];

View file

@ -10,7 +10,7 @@ const getMakiMethods = obj =>
);
});
for (let [key, Klass] of Object.entries(runtime)) {
for (const [key, Klass] of Object.entries(runtime)) {
const obj = getClass(key);
describe(`${obj.name}`, () => {
test("implements getclassname()", () => {
@ -30,7 +30,7 @@ for (let [key, Klass] of Object.entries(runtime)) {
describe("Maki classes", () => {
const runtimeMethods = new Set();
const objectMethods = new Set();
for (let [key, Klass] of Object.entries(runtime)) {
for (const [key, Klass] of Object.entries(runtime)) {
const obj = getClass(key);
getMakiMethods(Klass.prototype).forEach(methodName => {
runtimeMethods.add(`${obj.name}.${methodName}`);

View file

@ -158,7 +158,7 @@ function findDirectDescendantById(node, id) {
function* iterateLexicalScope(node) {
let currentNode = node;
while (currentNode.parent) {
let { parent } = currentNode;
const { parent } = currentNode;
const { children } = parent;
for (let i = 0; i < children.length; i++) {
const child = children[i];