From 2dfa5c24bfd9df0ab9f9fb461a04f0e3666ff461 Mon Sep 17 00:00:00 2001 From: Michele Ceriotti Date: Sun, 17 Sep 2023 23:47:17 -0700 Subject: [PATCH] eslint fixes --- src/dataset.ts | 8 ++++---- src/structure/shapes.ts | 4 ++-- src/structure/viewer.ts | 3 +-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/dataset.ts b/src/dataset.ts index 555e25380..65505f268 100644 --- a/src/dataset.ts +++ b/src/dataset.ts @@ -4,7 +4,7 @@ */ import { CustomShape, Ellipsoid, Sphere } from './structure/shapes'; -import { ShapeParameters, ShapeData } from './structure/shapes'; +import { ShapeData, ShapeParameters } from './structure/shapes'; /** A dataset containing all the data to be displayed. */ export interface Dataset { @@ -243,7 +243,7 @@ export function validateDataset(o: JsObject): void { if ('shapes' in o) { checkShapes(o.shapes as Record, structureCount, envCount); - assignShapes(o.shapes as { [name: string]: ShapeParameters }, o.structures); + assignShapes(o.shapes as { [name: string]: ShapeParameters }, o.structures as Structure[]); } if (!('properties' in o)) { @@ -380,8 +380,8 @@ function assignShapes(shapes: { [name: string]: ShapeParameters }, structures: S for (let i_structure = 0; i_structure < structures.length; i_structure++) { const structure = structures[i_structure]; structure.shapes = {}; - for (let [name, shape] of Object.entries(shapes)) { - let parameters = { + for (const [name, shape] of Object.entries(shapes)) { + const parameters = { global: shape.parameters.global, structure: shape.parameters.structure, atom: shape.parameters.atom, diff --git a/src/structure/shapes.ts b/src/structure/shapes.ts index b21f3c1d2..bd90650b2 100644 --- a/src/structure/shapes.ts +++ b/src/structure/shapes.ts @@ -134,9 +134,9 @@ export class Shape { // orientation is passed to 3dmol in the (x, y, z, w) convention constructor(data: Partial) { - let [qx, qy, qz, qw] = data.orientation || [0, 0, 0, 1]; + const [qx, qy, qz, qw] = data.orientation || [0, 0, 0, 1]; this.orientation = new Quaternion(qx, qy, qz, qw); - let [x, y, z] = data.position || [0, 0, 0]; + const [x, y, z] = data.position || [0, 0, 0]; this.position = { x, y, z }; } diff --git a/src/structure/viewer.ts b/src/structure/viewer.ts index ef7a509c7..82091fe95 100644 --- a/src/structure/viewer.ts +++ b/src/structure/viewer.ts @@ -958,7 +958,7 @@ export class MoleculeViewer { assert(i < current_shape.parameters.atom.length); const atom_pars = current_shape.parameters.atom[i]; shape_data = { ...shape_data, ...atom_pars }; - console.log('atom pars', atom_pars); + let position: [number, number, number] = [ structure.x[i], structure.y[i], @@ -986,7 +986,6 @@ export class MoleculeViewer { shape.outputTo3Dmol(shape_data.color || 0xffffff) ); } else if (current_shape.kind === 'ellipsoid') { - console.log('shape data', shape_data); const shape = new Ellipsoid(shape_data); this._viewer.addCustom( shape.outputTo3Dmol(shape_data.color || 0xffffff)