Skip to content

Commit

Permalink
chore(tests): lint fixes, test fixes (#7485)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibgreen authored and Pessimistress committed Jan 5, 2023
1 parent 63fb4b9 commit dd948ec
Show file tree
Hide file tree
Showing 21 changed files with 49 additions and 49 deletions.
1 change: 1 addition & 0 deletions modules/aggregation-layers/package.json
Expand Up @@ -38,6 +38,7 @@
"peerDependencies": {
"@deck.gl/core": "^8.0.0",
"@deck.gl/layers": "^8.0.0",
"@luma.gl/api": "9.0.0-alpha.11",
"@luma.gl/core": "9.0.0-alpha.11"
},
"gitHead": "13ace64fc2cee08c133afc882fc307253489a4e4"
Expand Down
Expand Up @@ -24,7 +24,6 @@ import {
project32,
gouraudLighting,
picking,
LayerContext,
LayerProps,
DefaultProps
} from '@deck.gl/core';
Expand Down
@@ -1,6 +1,5 @@
import {Device} from '@luma.gl/api';
import GL from '@luma.gl/constants';
import {isWebGL2} from '@luma.gl/core';

export function getBounds(points: number[][]): number[] {
// Now build bounding box in world space (aligned to world coordiante system)
Expand Down
50 changes: 27 additions & 23 deletions modules/aggregation-layers/src/utils/cpu-aggregator.ts
Expand Up @@ -21,7 +21,8 @@ import BinSorter from './bin-sorter';
import {getScaleFunctionByScaleType} from './scale-utils';
import {getValueFunc, wrapGetValueFunc} from './aggregation-operation-utils';

function nop() {}
// @eslint-disable-next-line @typescript-eslint/no-empty-function
function noop() {}

const dimensionSteps = ['getBins', 'getDomain', 'getScaleFunc'];
const defaultDimensions = [
Expand Down Expand Up @@ -122,27 +123,30 @@ const defaultDimensions = [
];
const defaultGetCellSize = props => props.cellSize;
export default class CPUAggregator {
constructor(opts) {
this.state = {
layerData: {},
dimensions: {
// color: {
// getValue: null,
// domain: null,
// sortedBins: null,
// scaleFunc: nop
// },
// elevation: {
// getValue: null,
// domain: null,
// sortedBins: null,
// scaleFunc: nop
// }
}
};
this.changeFlags = {};
this.dimensionUpdaters = {};
state = {
layerData: {},
dimensions: {
// color: {
// getValue: null,
// domain: null,
// sortedBins: null,
// scaleFunc: noop
// },
// elevation: {
// getValue: null,
// domain: null,
// sortedBins: null,
// scaleFunc: noop
// }
}
};
changeFlags = {};
dimensionUpdaters = {};

_getCellSize;
_getAggregator;

constructor(opts) {
this._getCellSize = opts.getCellSize || defaultGetCellSize;
this._getAggregator = opts.getAggregator;
this._addDimension(opts.dimensions || defaultDimensions);
Expand Down Expand Up @@ -259,7 +263,7 @@ export default class CPUAggregator {
getValue: null,
domain: null,
sortedBins: null,
scaleFunc: nop
scaleFunc: noop
};
});
}
Expand Down Expand Up @@ -484,7 +488,7 @@ export default class CPUAggregator {

getAccessor(dimensionKey) {
if (!this.dimensionUpdaters.hasOwnProperty(dimensionKey)) {
return nop;
return noop;
}
return this.dimensionUpdaters[dimensionKey].attributeAccessor;
}
Expand Down
Expand Up @@ -25,7 +25,6 @@ import {
Transform,
FEATURES,
hasFeatures,
isWebGL2,
readPixelsToBuffer,
withParameters,
clear
Expand Down
2 changes: 1 addition & 1 deletion modules/aggregation-layers/src/utils/resource-utils.ts
@@ -1,6 +1,6 @@
import {Device} from '@luma.gl/api';
import GL from '@luma.gl/constants';
import {Framebuffer, Texture2D, isWebGL2} from '@luma.gl/core';
import {Framebuffer, Texture2D} from '@luma.gl/core';

const DEFAULT_PARAMETERS = {
[GL.TEXTURE_MAG_FILTER]: GL.NEAREST,
Expand Down
2 changes: 1 addition & 1 deletion modules/arcgis/package.json
Expand Up @@ -32,7 +32,7 @@
"peerDependencies": {
"@arcgis/core": "^4.0.0",
"@deck.gl/core": "^8.0.0",
"@luma.gl/core": "^8.0.0"
"@luma.gl/core": "^9.0.0-alpha"
},
"dependencies": {
"esri-loader": "^3.3.0"
Expand Down
5 changes: 4 additions & 1 deletion modules/arcgis/src/commons.ts
Expand Up @@ -6,7 +6,8 @@ import {Deck} from '@deck.gl/core';
import {Model, Buffer, Framebuffer, instrumentGLContext, withParameters} from '@luma.gl/core';

export function initializeResources(device: Device) {
instrumentGLContext(device);
// @ts-expect-error
instrumentGLContext(device.gl);

this.buffer = new Buffer(device, new Int8Array([-1, -1, 1, -1, -1, 1, 1, 1]));

Expand All @@ -30,6 +31,7 @@ export function initializeResources(device: Device) {
}
`,
attributes: {
// eslint-disable-next-line camelcase
a_pos: this.buffer
},
vertexCount: 4,
Expand Down Expand Up @@ -94,6 +96,7 @@ export function render({gl, width, height, viewState}) {
viewport: [0, 0, width, height]
},
() => {
// eslint-disable-next-line camelcase
this.model.setUniforms({u_texture: this.deckFbo}).draw();
}
);
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/lib/deck-picker.ts
Expand Up @@ -19,7 +19,7 @@
// THE SOFTWARE.

import type {Device} from '@luma.gl/api';
import {Framebuffer, Texture2D, isWebGL2, readPixelsToArray} from '@luma.gl/core';
import {Framebuffer, Texture2D, readPixelsToArray} from '@luma.gl/core';
import GL from '@luma.gl/constants';
import PickLayersPass, {PickingColorDecoder} from '../passes/pick-layers-pass';
import {getClosestObject, getUniqueObjects, PickedPixel} from './picking/query-object';
Expand Down
7 changes: 3 additions & 4 deletions modules/core/src/lib/deck.ts
Expand Up @@ -36,7 +36,6 @@ import {WebGLDevice} from '@luma.gl/webgl';
import GL from '@luma.gl/constants';
import {
AnimationLoop,
createGLContext,
instrumentGLContext,
setParameters,
Timeline,
Expand Down Expand Up @@ -769,7 +768,7 @@ export default class Deck {
const {
// width,
// height,
gl,
deviceProps,
glOptions,
debug,
onError,
Expand All @@ -787,6 +786,7 @@ export default class Deck {
onCreateDevice: props =>
luma.createDevice({
...glOptions,
...deviceProps,
...props,
canvas: this.canvas,
debug,
Expand Down Expand Up @@ -916,8 +916,7 @@ export default class Deck {

// if external context...
if (!this.canvas) {
// @ts-expect-error
this.canvas = device.canvasContext.canvas;
this.canvas = this.device.canvasContext.canvas as HTMLCanvasElement;
// @ts-expect-error - Currently luma.gl v9 does not expose these options
// All WebGLDevice contexts are instrumented, but it seems the device
// should have a method to start state tracking even if not enabled?
Expand Down
1 change: 1 addition & 0 deletions modules/extensions/package.json
Expand Up @@ -34,6 +34,7 @@
},
"peerDependencies": {
"@deck.gl/core": "^8.0.0",
"@luma.gl/api": "9.0.0-alpha.11",
"@luma.gl/constants": "9.0.0-alpha.11",
"@luma.gl/core": "9.0.0-alpha.11",
"@math.gl/core": "^3.6.2",
Expand Down
2 changes: 1 addition & 1 deletion modules/extensions/src/data-filter/aggregator.ts
@@ -1,6 +1,6 @@
import {Device} from '@luma.gl/api';
import GL from '@luma.gl/constants';
import {Model, Texture2D, Framebuffer, isWebGL2} from '@luma.gl/core';
import {Model, Texture2D, Framebuffer} from '@luma.gl/core';

const AGGREGATE_VS = `\
#define SHADER_NAME data-filter-vertex-shader
Expand Down
1 change: 1 addition & 0 deletions modules/google-maps/package.json
Expand Up @@ -36,6 +36,7 @@
"@deck.gl/core": "^8.0.0",
"@luma.gl/constants": "9.0.0-alpha.11",
"@luma.gl/core": "9.0.0-alpha.11",
"@luma.gl/gltools": "9.0.0-alpha.11",
"@math.gl/core": "^3.6.0"
},
"gitHead": "13ace64fc2cee08c133afc882fc307253489a4e4"
Expand Down
2 changes: 2 additions & 0 deletions modules/layers/package.json
Expand Up @@ -31,7 +31,9 @@
"dependencies": {
"@loaders.gl/images": "^3.2.10",
"@loaders.gl/schema": "^3.2.10",
"@luma.gl/api": "9.0.0-alpha.11",
"@luma.gl/constants": "9.0.0-alpha.11",
"@luma.gl/gltools": "9.0.0-alpha.11",
"@mapbox/tiny-sdf": "^2.0.5",
"@math.gl/core": "^3.6.2",
"@math.gl/polygon": "^3.6.2",
Expand Down
4 changes: 2 additions & 2 deletions modules/layers/src/bitmap-layer/bitmap-layer.ts
Expand Up @@ -192,7 +192,7 @@ export default class BitmapLayer<ExtraPropsT = {}> extends Layer<

// TODO shouldn't happen, this is an async prop...
if (typeof image === 'string') {
return;
throw new Error('string');
}

const {width, height} = image;
Expand All @@ -203,7 +203,7 @@ export default class BitmapLayer<ExtraPropsT = {}> extends Layer<
// Calculate uv and pixel in bitmap
const uv = unpackUVsFromRGB(info.color);

const pixel = [Math.floor(uv[0] * (width as number)), Math.floor(uv[1] * (height as number))];
const pixel = [Math.floor(uv[0] * width), Math.floor(uv[1] * height)];

info.bitmap = {
size: {width, height}, // Size of bitmap
Expand Down
2 changes: 1 addition & 1 deletion modules/layers/src/column-layer/column-layer.ts
Expand Up @@ -36,7 +36,7 @@ import {
DefaultProps
} from '@deck.gl/core';
import GL from '@luma.gl/constants';
import {Model, isWebGL2, hasFeature, FEATURES} from '@luma.gl/core';
import {Model, hasFeature, FEATURES} from '@luma.gl/core';
import ColumnGeometry from './column-geometry';

import vs from './column-layer-vertex.glsl';
Expand Down
Expand Up @@ -262,7 +262,7 @@ export default class ScenegraphLayer<DataT = any, ExtraPropsT = {}> extends Laye
scenegraphData = props.scenegraph;
}

const options = {layer: this, devicePixelRatio, device: this.context.device};
const options = {layer: this, device: this.context.device};
const scenegraph = props.getScene(scenegraphData, options);
const animator = props.getAnimator(scenegraphData, options);

Expand Down
2 changes: 1 addition & 1 deletion test/modules/core/lib/resource/resource-manager.spec.js
@@ -1,4 +1,4 @@
/* deviceobal setTimeout */
/* global setTimeout */
import test from 'tape-promise/tape';
import {device} from '@deck.gl/test-utils';
import ResourceManager from '@deck.gl/core/lib/resource/resource-manager';
Expand Down
2 changes: 1 addition & 1 deletion test/modules/core/lifecycle/component-state.spec.js
@@ -1,7 +1,7 @@
import test from 'tape-promise/tape';
import ComponentState from '@deck.gl/core/lifecycle/component-state';
import Component from '@deck.gl/core/lifecycle/component';
import {device, gl} from '@deck.gl/test-utils';
import {device} from '@deck.gl/test-utils';

const EMPTY_ARRAY = Object.freeze([]);

Expand Down
Expand Up @@ -19,7 +19,6 @@
// THE SOFTWARE.

import test from 'tape-promise/tape';
import GL from '@luma.gl/constants';

// import {COORDINATE_SYSTEM, Viewport, WebMercatorViewport} from 'deck.gl';
import {COORDINATE_SYSTEM, WebMercatorViewport} from 'deck.gl';
Expand Down
7 changes: 0 additions & 7 deletions test/modules/layers/core-layers.spec.js
Expand Up @@ -37,13 +37,6 @@ import * as FIXTURES from 'deck.gl-test/data';

import {testLayer, generateLayerTests} from '@deck.gl/test-utils';

import {Device} from '@luma.gl/api';
Object.defineProperty(Device, 'beginQuery', {
set: function (value) {
debugger;
}
});

const GRID = [
{position: [37, 122]},
{position: [37.1, 122]},
Expand Down

0 comments on commit dd948ec

Please sign in to comment.