From 84bf04b0c1bf4c8eb38e507c2253d4e6697e1381 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 12 Jan 2017 22:45:23 -0800 Subject: [PATCH] test,util: remove lint workarounds Remove assignments to `SIMD` that are only to pacify ESLint. Instead, use either `global.SIMD` or provide an comment letting ESLint know in cases where `SIMD` is guaranteed to be a defined global identifier. PR-URL: https://github.com/nodejs/node/pull/10785 Reviewed-By: Luigi Pinca Reviewed-By: Teddy Katz Reviewed-By: James M Snell Reviewed-By: Michael Dawson --- lib/util.js | 9 +++------ test/parallel/test-util-inspect-simd.js | 3 +-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/util.js b/lib/util.js index 85af547ebb81f7..4069fc3b4872de 100644 --- a/lib/util.js +++ b/lib/util.js @@ -27,16 +27,13 @@ var simdFormatters; if (typeof global.SIMD === 'object' && global.SIMD !== null) { simdFormatters = new Map(); - const make = (extractLane, count) => { - return (ctx, value, recurseTimes, visibleKeys, keys) => { + const make = + (extractLane, count) => (ctx, value, recurseTimes, visibleKeys, keys) => { const output = new Array(count); for (var i = 0; i < count; i += 1) output[i] = formatPrimitive(ctx, extractLane(value, i)); return output; }; - }; - - const SIMD = global.SIMD; // Pacify eslint. const countPerType = { Bool16x8: 8, @@ -52,7 +49,7 @@ if (typeof global.SIMD === 'object' && global.SIMD !== null) { }; for (const key in countPerType) { - const type = SIMD[key]; + const type = global.SIMD[key]; simdFormatters.set(type, make(type.extractLane, countPerType[key])); } } diff --git a/test/parallel/test-util-inspect-simd.js b/test/parallel/test-util-inspect-simd.js index ec4ccc1875a817..5e0a2740840c93 100644 --- a/test/parallel/test-util-inspect-simd.js +++ b/test/parallel/test-util-inspect-simd.js @@ -1,12 +1,11 @@ // Flags: --harmony_simd +/* global SIMD */ 'use strict'; require('../common'); const assert = require('assert'); const inspect = require('util').inspect; -const SIMD = global.SIMD; // Pacify eslint. - assert.strictEqual( inspect(SIMD.Bool16x8()), 'Bool16x8 [ false, false, false, false, false, false, false, false ]');