From 42409a2bc7a7eabd056ea56b59cbddd21a86a20c Mon Sep 17 00:00:00 2001 From: Alexander Rose <alexander.rose@weirdbyte.de> Date: Sun, 12 Sep 2021 19:27:40 -0700 Subject: [PATCH] lint: add array-bracket-spacing rule --- .eslintrc.json | 3 +- src/cli/cifschema/index.ts | 2 +- src/cli/cifschema/util/cif-dic.ts | 2 +- src/cli/cifschema/util/generate.ts | 2 +- src/extensions/cellpack/model.ts | 2 +- .../dnatco/confal-pyramids/color.ts | 4 +-- src/extensions/geo-export/glb-exporter.ts | 10 +++--- src/extensions/geo-export/mesh-exporter.ts | 4 +-- src/extensions/rcsb/assembly-symmetry/prop.ts | 2 +- src/mol-canvas3d/passes/multi-sample.ts | 34 +++++++++---------- src/mol-geo/geometry/mesh/color-smoothing.ts | 2 +- .../geometry/texture-mesh/color-smoothing.ts | 2 +- src/mol-geo/primitive/plane.ts | 2 +- src/mol-geo/util/marching-cubes/tables.ts | 24 ++++++------- src/mol-gl/_spec/gl.shim.ts | 8 ++--- src/mol-gl/_spec/renderer.spec.ts | 4 +-- src/mol-gl/webgl/resources.ts | 2 +- src/mol-io/reader/ccp4/parser.ts | 2 +- src/mol-io/reader/cif/data-model.ts | 2 +- src/mol-math/geometry/boundary-helper.ts | 8 ++--- src/mol-math/geometry/gaussian-density/cpu.ts | 2 +- src/mol-math/geometry/gaussian-density/gpu.ts | 8 ++--- src/mol-math/geometry/molecular-surface.ts | 4 +-- src/mol-math/geometry/primitives/box3d.ts | 4 +-- .../linear-algebra/_spec/vec3.spec.ts | 8 ++--- src/mol-model-formats/shape/ply.ts | 6 ++-- .../structure/_spec/cif-core.spec.ts | 2 +- .../structure/_spec/pdb.spec.ts | 2 +- .../computed/chemistry/functional-group.ts | 2 +- .../computed/chemistry/geometry.ts | 8 ++--- .../computed/chemistry/valence-model.ts | 4 +-- .../cross-link-restraint/format.ts | 2 +- .../cross-link-restraint/property.ts | 2 +- .../model/properties/atomic/bonds.ts | 6 ++-- .../structure/structure/element/loci.ts | 6 ++-- src/mol-plugin-state/actions/volume.ts | 2 +- src/mol-plugin-state/formats/registry.ts | 2 +- src/mol-plugin-state/transforms/helpers.ts | 2 +- src/mol-plugin-ui/controls/color.tsx | 2 +- src/mol-plugin-ui/structure/volume.tsx | 4 +-- .../behavior/dynamic/volume-streaming/util.ts | 6 ++-- src/mol-repr/volume/util.ts | 4 +-- src/mol-script/language/builder.ts | 6 ++-- .../script/mol-script/script-macro.ts | 2 +- src/mol-theme/color/hydrophobicity.ts | 2 +- src/mol-theme/color/molecule-type.ts | 2 +- src/mol-theme/color/operator-hkl.ts | 2 +- src/mol-theme/color/residue-name.ts | 2 +- src/mol-theme/color/secondary-structure.ts | 2 +- src/mol-util/color/color.ts | 4 +-- src/mol-util/color/lists.ts | 4 +-- src/mol-util/file-info.ts | 4 +-- src/mol-util/polyfill.ts | 4 +-- src/mol-util/zip/deflate.ts | 20 +++++------ src/mol-util/zip/util.ts | 2 +- src/perf-tests/mol-script.ts | 2 +- src/servers/model/server/api.ts | 18 +++++----- 57 files changed, 143 insertions(+), 142 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index ec73c676b..76990ee25 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -41,7 +41,8 @@ ], "no-throw-literal": "error", "key-spacing": "error", - "object-curly-spacing": ["error", "always"] + "object-curly-spacing": ["error", "always"], + "array-bracket-spacing": "error" }, "overrides": [ { diff --git a/src/cli/cifschema/index.ts b/src/cli/cifschema/index.ts index 8845afe9c..94584492e 100644 --- a/src/cli/cifschema/index.ts +++ b/src/cli/cifschema/index.ts @@ -129,7 +129,7 @@ async function getFieldNamesFilter(fieldNamesPath: string): Promise<Filter> { const filter: Filter = {}; fieldNames.forEach((name, i) => { - const [ category, field ] = name.split('.'); + const [category, field] = name.split('.'); // console.log(category, field) if (!filter[ category ]) filter[ category ] = {}; filter[ category ][ field ] = true; diff --git a/src/cli/cifschema/util/cif-dic.ts b/src/cli/cifschema/util/cif-dic.ts index 8e1eadc14..a4ad9ee28 100644 --- a/src/cli/cifschema/util/cif-dic.ts +++ b/src/cli/cifschema/util/cif-dic.ts @@ -189,7 +189,7 @@ function getContainer(d: Data.CifFrame, imports: Imports, ctx: FrameData) { function getCode(d: Data.CifFrame, imports: Imports, ctx: FrameData): [string, string[] | undefined, string | undefined ] | undefined { const code = getField('item_type', 'code', d, imports, ctx) || getField('type', 'contents', d, imports, ctx); if (code) { - return [ code.str(0), getEnums(d, imports, ctx), getContainer(d, imports, ctx) ]; + return [code.str(0), getEnums(d, imports, ctx), getContainer(d, imports, ctx)]; } else { console.log(`item_type.code or type.contents not found for '${d.header}'`); } diff --git a/src/cli/cifschema/util/generate.ts b/src/cli/cifschema/util/generate.ts index e3a017a2d..a47f4e5b6 100644 --- a/src/cli/cifschema/util/generate.ts +++ b/src/cli/cifschema/util/generate.ts @@ -128,7 +128,7 @@ export function generate (name: string, info: string, schema: Database, fields: codeLines.push(''); codeLines.push(`export const ${name}_Aliases = {`); Object.keys(schema.aliases).forEach(path => { - const [ table, columnName ] = path.split('.'); + const [table, columnName] = path.split('.'); if (fields && !fields[table]) return; if (fields && !fields[table][columnName]) return; diff --git a/src/extensions/cellpack/model.ts b/src/extensions/cellpack/model.ts index 8213f1adc..6d58b6802 100644 --- a/src/extensions/cellpack/model.ts +++ b/src/extensions/cellpack/model.ts @@ -196,7 +196,7 @@ function getAssembly(transforms: Mat4[], structure: Structure) { for (let i = 0, il = transforms.length; i < il; ++i) { const id = `${i + 1}`; - const op = SymmetryOperator.create(id, transforms[i], { assembly: { id, operId: i, operList: [ id ] } }); + const op = SymmetryOperator.create(id, transforms[i], { assembly: { id, operId: i, operList: [id] } }); for (const unit of units) { builder.addWithOperator(unit, op); } diff --git a/src/extensions/dnatco/confal-pyramids/color.ts b/src/extensions/dnatco/confal-pyramids/color.ts index 9f934e0ea..26d2b3f68 100644 --- a/src/extensions/dnatco/confal-pyramids/color.ts +++ b/src/extensions/dnatco/confal-pyramids/color.ts @@ -165,8 +165,8 @@ export function ConfalPyramidsColorTheme(ctx: ThemeDataContext, props: PD.Values legend: TableLegend(iterableToArray(ColorMapping.entries()).map(([conformer, color]) => { return [conformer, color] as [string, Color]; }).concat([ - [ 'Error', ErrorColor ], - [ 'Unknown', DefaultColor ] + ['Error', ErrorColor], + ['Unknown', DefaultColor] ])) }; } diff --git a/src/extensions/geo-export/glb-exporter.ts b/src/extensions/geo-export/glb-exporter.ts index 36da76db4..74bca43b0 100644 --- a/src/extensions/geo-export/glb-exporter.ts +++ b/src/extensions/geo-export/glb-exporter.ts @@ -53,7 +53,7 @@ export class GlbExporter extends MeshExporter<GlbData> { max[j] = Math.max(a[i + j], max[j]); } } - return [ min, max ]; + return [min, max]; } private addBuffer(buffer: ArrayBuffer, componentType: number, type: string, count: number, target: number, min?: any, max?: any, normalized?: boolean) { @@ -108,7 +108,7 @@ export class GlbExporter extends MeshExporter<GlbData> { indexArray = indices!.slice(0, drawCount); } - const [ vertexMin, vertexMax ] = GlbExporter.vec3MinMax(vertexArray); + const [vertexMin, vertexMax] = GlbExporter.vec3MinMax(vertexArray); let vertexBuffer = vertexArray.buffer; let normalBuffer = normalArray.buffer; @@ -273,14 +273,14 @@ export class GlbExporter extends MeshExporter<GlbData> { if (padding) { chunk.push(padding.buffer); } - return [ chunk, 8 + byteLength ]; + return [chunk, 8 + byteLength]; }; const jsonString = JSON.stringify(gltf); const jsonBuffer = new Uint8Array(jsonString.length); asciiWrite(jsonBuffer, jsonString); - const [ jsonChunk, jsonChunkLength ] = createChunk(0x4E4F534A, [jsonBuffer.buffer], jsonBuffer.length, 0x20); - const [ binaryChunk, binaryChunkLength ] = createChunk(0x004E4942, this.binaryBuffer, binaryBufferLength, 0x00); + const [jsonChunk, jsonChunkLength] = createChunk(0x4E4F534A, [jsonBuffer.buffer], jsonBuffer.length, 0x20); + const [binaryChunk, binaryChunkLength] = createChunk(0x004E4942, this.binaryBuffer, binaryBufferLength, 0x00); const glbBufferLength = 12 + jsonChunkLength + binaryChunkLength; const header = new ArrayBuffer(12); diff --git a/src/extensions/geo-export/mesh-exporter.ts b/src/extensions/geo-export/mesh-exporter.ts index 8070e54a2..00481f66a 100644 --- a/src/extensions/geo-export/mesh-exporter.ts +++ b/src/extensions/geo-export/mesh-exporter.ts @@ -102,7 +102,7 @@ export abstract class MeshExporter<D extends RenderObjectExportData> implements } const framebuffer = webgl.namedFramebuffers[GeoExportName]; - const [ width, height ] = colorTexDim; + const [width, height] = colorTexDim; const colorGrid = new Uint8Array(width * height * 4); framebuffer.bind(); @@ -357,7 +357,7 @@ export abstract class MeshExporter<D extends RenderObjectExportData> implements } const framebuffer = webgl.namedFramebuffers[GeoExportName]; - const [ width, height ] = values.uGeoTexDim.ref.value; + const [width, height] = values.uGeoTexDim.ref.value; const vertices = new Float32Array(width * height * 4); const normals = new Float32Array(width * height * 4); const groups = webgl.isWebGL2 ? new Uint8Array(width * height * 4) : new Float32Array(width * height * 4); diff --git a/src/extensions/rcsb/assembly-symmetry/prop.ts b/src/extensions/rcsb/assembly-symmetry/prop.ts index f076ed6d6..699964040 100644 --- a/src/extensions/rcsb/assembly-symmetry/prop.ts +++ b/src/extensions/rcsb/assembly-symmetry/prop.ts @@ -130,7 +130,7 @@ export function getSymmetrySelectParam(structure?: Structure) { for (let i = 0, il = assemblySymmetryData.length; i < il; ++i) { const { symbol, kind } = assemblySymmetryData[i]; if (symbol !== 'C1') { - options.push([ i, `${i + 1}: ${symbol} ${kind}` ]); + options.push([i, `${i + 1}: ${symbol} ${kind}`]); } } if (options.length > 1) { diff --git a/src/mol-canvas3d/passes/multi-sample.ts b/src/mol-canvas3d/passes/multi-sample.ts index a4b56b204..51376216a 100644 --- a/src/mol-canvas3d/passes/multi-sample.ts +++ b/src/mol-canvas3d/passes/multi-sample.ts @@ -278,33 +278,33 @@ export class MultiSamplePass { const JitterVectors = [ [ - [ 0, 0 ] + [0, 0] ], [ - [ 4, 4 ], [ -4, -4 ] + [4, 4], [-4, -4] ], [ - [ -2, -6 ], [ 6, -2 ], [ -6, 2 ], [ 2, 6 ] + [-2, -6], [6, -2], [-6, 2], [2, 6] ], [ - [ 1, -3 ], [ -1, 3 ], [ 5, 1 ], [ -3, -5 ], - [ -5, 5 ], [ -7, -1 ], [ 3, 7 ], [ 7, -7 ] + [1, -3], [-1, 3], [5, 1], [-3, -5], + [-5, 5], [-7, -1], [3, 7], [7, -7] ], [ - [ 1, 1 ], [ -1, -3 ], [ -3, 2 ], [ 4, -1 ], - [ -5, -2 ], [ 2, 5 ], [ 5, 3 ], [ 3, -5 ], - [ -2, 6 ], [ 0, -7 ], [ -4, -6 ], [ -6, 4 ], - [ -8, 0 ], [ 7, -4 ], [ 6, 7 ], [ -7, -8 ] + [1, 1], [-1, -3], [-3, 2], [4, -1], + [-5, -2], [2, 5], [5, 3], [3, -5], + [-2, 6], [0, -7], [-4, -6], [-6, 4], + [-8, 0], [7, -4], [6, 7], [-7, -8] ], [ - [ -4, -7 ], [ -7, -5 ], [ -3, -5 ], [ -5, -4 ], - [ -1, -4 ], [ -2, -2 ], [ -6, -1 ], [ -4, 0 ], - [ -7, 1 ], [ -1, 2 ], [ -6, 3 ], [ -3, 3 ], - [ -7, 6 ], [ -3, 6 ], [ -5, 7 ], [ -1, 7 ], - [ 5, -7 ], [ 1, -6 ], [ 6, -5 ], [ 4, -4 ], - [ 2, -3 ], [ 7, -2 ], [ 1, -1 ], [ 4, -1 ], - [ 2, 1 ], [ 6, 2 ], [ 0, 4 ], [ 4, 4 ], - [ 2, 5 ], [ 7, 5 ], [ 5, 6 ], [ 3, 7 ] + [-4, -7], [-7, -5], [-3, -5], [-5, -4], + [-1, -4], [-2, -2], [-6, -1], [-4, 0], + [-7, 1], [-1, 2], [-6, 3], [-3, 3], + [-7, 6], [-3, 6], [-5, 7], [-1, 7], + [5, -7], [1, -6], [6, -5], [4, -4], + [2, -3], [7, -2], [1, -1], [4, -1], + [2, 1], [6, 2], [0, 4], [4, 4], + [2, 5], [7, 5], [5, 6], [3, 7] ] ]; diff --git a/src/mol-geo/geometry/mesh/color-smoothing.ts b/src/mol-geo/geometry/mesh/color-smoothing.ts index 60ec3ac26..61228bd96 100644 --- a/src/mol-geo/geometry/mesh/color-smoothing.ts +++ b/src/mol-geo/geometry/mesh/color-smoothing.ts @@ -39,7 +39,7 @@ export function calcMeshColorSmoothing(input: ColorSmoothingInput, resolution: n Vec3.add(gridDim, gridDim, Vec3.create(2, 2, 2)); const { min } = box; - const [ xn, yn ] = gridDim; + const [xn, yn] = gridDim; const { width, height } = getVolumeTexture2dLayout(gridDim); // console.log({ width, height, dim }); diff --git a/src/mol-geo/geometry/texture-mesh/color-smoothing.ts b/src/mol-geo/geometry/texture-mesh/color-smoothing.ts index 4a320a4f7..6cbc7e514 100644 --- a/src/mol-geo/geometry/texture-mesh/color-smoothing.ts +++ b/src/mol-geo/geometry/texture-mesh/color-smoothing.ts @@ -259,7 +259,7 @@ export function calcTextureMeshColorSmoothing(input: ColorSmoothingInput, resolu Vec3.add(gridDim, gridDim, Vec3.create(2, 2, 2)); const { min } = box; - const [ dx, dy, dz ] = gridDim; + const [dx, dy, dz] = gridDim; const { texDimX: width, texDimY: height, texCols } = getTexture2dSize(gridDim); // console.log({ width, height, texCols, dim, resolution }); diff --git a/src/mol-geo/primitive/plane.ts b/src/mol-geo/primitive/plane.ts index b919e8bd0..3216aca11 100644 --- a/src/mol-geo/primitive/plane.ts +++ b/src/mol-geo/primitive/plane.ts @@ -28,7 +28,7 @@ const plane: Primitive = { const planeCage: Cage = { vertices: plane.vertices, - edges: new Uint32Array([ 0, 1, 2, 3, 3, 1, 2, 0 ]) + edges: new Uint32Array([0, 1, 2, 3, 3, 1, 2, 0]) }; export function Plane(): Primitive { diff --git a/src/mol-geo/util/marching-cubes/tables.ts b/src/mol-geo/util/marching-cubes/tables.ts index 5f6dee12a..2cd1298dc 100644 --- a/src/mol-geo/util/marching-cubes/tables.ts +++ b/src/mol-geo/util/marching-cubes/tables.ts @@ -440,16 +440,16 @@ export const TriTable = [ * The line between edge 1 and 5 is always drawn as it's on the leading edge */ export const AllowedContours = [ - [ 0, 4, 4, 4, 2, 0, 0, 0, 2, 2, 0, 0 ], // 1 2 3 4 8 9 - [ 4, 0, 4, 4, 0, 8, 0, 0, 0, 8, 8, 0 ], // 0 2 3 5 9 10 - [ 4, 4, 0, 4, 0, 0, 8, 0, 0, 0, 8, 8 ], // 0 1 3 6 10 11 - [ 4, 4, 4, 0, 0, 0, 0, 1, 1, 0, 0, 1 ], // 0 1 2 7 8 11 - [ 2, 0, 0, 0, 0, 8, 8, 8, 2, 2, 0, 0 ], // 0 5 6 7 8 9 - [ 0, 8, 0, 0, 8, 0, 8, 8, 0, 8, 8, 0 ], // And rotate it - [ 0, 0, 8, 0, 8, 8, 0, 8, 0, 0, 8, 8 ], - [ 0, 0, 0, 1, 8, 8, 8, 0, 1, 0, 0, 1 ], - [ 2, 0, 0, 1, 2, 0, 0, 1, 0, 2, 0, 1 ], // 0 3 4 7 9 11 - [ 2, 8, 0, 0, 2, 8, 0, 0, 2, 0, 8, 0 ], // And rotate some more - [ 0, 8, 8, 0, 0, 8, 8, 0, 0, 8, 0, 8 ], - [ 0, 0, 8, 1, 0, 0, 8, 1, 1, 0, 8, 0 ] + [0, 4, 4, 4, 2, 0, 0, 0, 2, 2, 0, 0], // 1 2 3 4 8 9 + [4, 0, 4, 4, 0, 8, 0, 0, 0, 8, 8, 0], // 0 2 3 5 9 10 + [4, 4, 0, 4, 0, 0, 8, 0, 0, 0, 8, 8], // 0 1 3 6 10 11 + [4, 4, 4, 0, 0, 0, 0, 1, 1, 0, 0, 1], // 0 1 2 7 8 11 + [2, 0, 0, 0, 0, 8, 8, 8, 2, 2, 0, 0], // 0 5 6 7 8 9 + [0, 8, 0, 0, 8, 0, 8, 8, 0, 8, 8, 0], // And rotate it + [0, 0, 8, 0, 8, 8, 0, 8, 0, 0, 8, 8], + [0, 0, 0, 1, 8, 8, 8, 0, 1, 0, 0, 1], + [2, 0, 0, 1, 2, 0, 0, 1, 0, 2, 0, 1], // 0 3 4 7 9 11 + [2, 8, 0, 0, 2, 8, 0, 0, 2, 0, 8, 0], // And rotate some more + [0, 8, 8, 0, 0, 8, 8, 0, 0, 8, 0, 8], + [0, 0, 8, 1, 0, 0, 8, 1, 1, 0, 8, 0] ]; \ No newline at end of file diff --git a/src/mol-gl/_spec/gl.shim.ts b/src/mol-gl/_spec/gl.shim.ts index 99c5a3404..7456e53cb 100644 --- a/src/mol-gl/_spec/gl.shim.ts +++ b/src/mol-gl/_spec/gl.shim.ts @@ -476,10 +476,10 @@ export function createGl(width: number, height: number, contextAttributes: WebGL // Int arrays case gl.MAX_VIEWPORT_DIMS: case gl.SCISSOR_BOX: - return new Int32Array([ 0, 0, 4096, 4096 ]); + return new Int32Array([0, 0, 4096, 4096]); case gl.VIEWPORT: const { x, y, width, height } = viewport; - return new Int32Array([ x, y, width, height ]); + return new Int32Array([x, y, width, height]); // Float arrays case gl.ALIASED_LINE_WIDTH_RANGE: @@ -487,12 +487,12 @@ export function createGl(width: number, height: number, contextAttributes: WebGL case gl.ALIASED_POINT_SIZE_RANGE: return new Float32Array([0, 255]); case gl.DEPTH_RANGE: - return new Float32Array([ depthRange.zNear, depthRange.zFar ]); + return new Float32Array([depthRange.zNear, depthRange.zFar]); case gl.BLEND_COLOR: return new Float32Array([0, 0, 0, 0]); case gl.COLOR_CLEAR_VALUE: const { r, g, b, a } = colorClearValue; - return new Float32Array([ r, g, b, a ]); + return new Float32Array([r, g, b, a]); case gl.COLOR_WRITEMASK: return 0; diff --git a/src/mol-gl/_spec/renderer.spec.ts b/src/mol-gl/_spec/renderer.spec.ts index 3f1ba5f25..0c2a9ea4f 100644 --- a/src/mol-gl/_spec/renderer.spec.ts +++ b/src/mol-gl/_spec/renderer.spec.ts @@ -104,7 +104,7 @@ function createPoints() { describe('renderer', () => { it('basic', () => { - const [ width, height ] = [ 32, 32 ]; + const [width, height] = [32, 32]; const gl = createGl(width, height, { preserveDrawingBuffer: true }); const { ctx, renderer } = createRenderer(gl); @@ -123,7 +123,7 @@ describe('renderer', () => { }); it('points', async () => { - const [ width, height ] = [ 32, 32 ]; + const [width, height] = [32, 32]; const gl = createGl(width, height, { preserveDrawingBuffer: true }); const { ctx } = createRenderer(gl); const scene = Scene.create(ctx); diff --git a/src/mol-gl/webgl/resources.ts b/src/mol-gl/webgl/resources.ts index 047c658d6..87972d43e 100644 --- a/src/mol-gl/webgl/resources.ts +++ b/src/mol-gl/webgl/resources.ts @@ -104,7 +104,7 @@ export function createResources(gl: GLRenderingContext, state: WebGLState, stats const programCache = createReferenceCache( (props: ProgramProps) => { - const array = [ props.shaderCode.id ]; + const array = [props.shaderCode.id]; Object.keys(props.defineValues).forEach(k => array.push(hashString(k), defineValueHash(props.defineValues[k].ref.value))); return hashFnv32a(array).toString(); }, diff --git a/src/mol-io/reader/ccp4/parser.ts b/src/mol-io/reader/ccp4/parser.ts index ab9ff9763..662d833a1 100644 --- a/src/mol-io/reader/ccp4/parser.ts +++ b/src/mol-io/reader/ccp4/parser.ts @@ -26,7 +26,7 @@ export async function readCcp4Header(file: FileHandle): Promise<{ header: Ccp4He // 54 MACHST Machine stamp indicating machine type which wrote file // 17 and 17 for big-endian or 68 and 65 for little-endian - const MACHST = [ buffer.readUInt8(53 * 4), buffer.readUInt8(53 * 4 + 1) ]; + const MACHST = [buffer.readUInt8(53 * 4), buffer.readUInt8(53 * 4 + 1)]; let littleEndian = false; if (MACHST[0] === 68 && MACHST[1] === 65) { littleEndian = true; diff --git a/src/mol-io/reader/cif/data-model.ts b/src/mol-io/reader/cif/data-model.ts index f9a4f4213..af9a713cd 100644 --- a/src/mol-io/reader/cif/data-model.ts +++ b/src/mol-io/reader/cif/data-model.ts @@ -37,7 +37,7 @@ export function CifBlock(categoryNames: string[], categories: CifCategories, hea return { categoryNames, header, categories, saveFrames, getField(name: string) { - const [ category, field ] = name.split('.'); + const [category, field] = name.split('.'); return categories[category].getField(field || ''); } }; diff --git a/src/mol-math/geometry/boundary-helper.ts b/src/mol-math/geometry/boundary-helper.ts index 3d719a15e..9d2532a58 100644 --- a/src/mol-math/geometry/boundary-helper.ts +++ b/src/mol-math/geometry/boundary-helper.ts @@ -121,10 +121,10 @@ type EposQuality = '6' | '14' | '26' | '98' function getEposDir(quality: EposQuality) { let dir: number[][]; switch (quality) { - case '6': dir = [ ...Type001 ]; break; - case '14': dir = [ ...Type001, ...Type111 ]; break; - case '26': dir = [ ...Type001, ...Type111, ...Type011 ]; break; - case '98': dir = [ ...Type001, ...Type111, ...Type011, ...Type012, ...Type112, ...Type122 ]; break; + case '6': dir = [...Type001]; break; + case '14': dir = [...Type001, ...Type111]; break; + case '26': dir = [...Type001, ...Type111, ...Type011]; break; + case '98': dir = [...Type001, ...Type111, ...Type011, ...Type012, ...Type112, ...Type122]; break; } return dir.map(a => { const v = Vec3.create(a[0], a[1], a[2]); diff --git a/src/mol-math/geometry/gaussian-density/cpu.ts b/src/mol-math/geometry/gaussian-density/cpu.ts index 064abe90c..eb42d99a1 100644 --- a/src/mol-math/geometry/gaussian-density/cpu.ts +++ b/src/mol-math/geometry/gaussian-density/cpu.ts @@ -42,7 +42,7 @@ export async function GaussianDensityCPU(ctx: RuntimeContext, position: Position idData.fill(-1); const idField = Tensor.create(space, idData); - const [ dimX, dimY, dimZ ] = dim; + const [dimX, dimY, dimZ] = dim; const iu = dimZ, iv = dimY, iuv = iu * iv; const gridx = fillGridDim(dim[0], min[0], resolution); diff --git a/src/mol-math/geometry/gaussian-density/gpu.ts b/src/mol-math/geometry/gaussian-density/gpu.ts index 763969f86..90bfb8cae 100644 --- a/src/mol-math/geometry/gaussian-density/gpu.ts +++ b/src/mol-math/geometry/gaussian-density/gpu.ts @@ -122,7 +122,7 @@ function calcGaussianDensityTexture2d(webgl: WebGLContext, position: PositionDat const { smoothness, resolution } = props; const { drawCount, positions, radii, groups, scale, expandedBox, dim, maxRadius } = prepareGaussianDensityData(position, box, radius, props); - const [ dx, dy, dz ] = dim; + const [dx, dy, dz] = dim; const { texDimX, texDimY, texCols, powerOfTwoSize } = getTexture2dSize(dim); // console.log({ texDimX, texDimY, texCols, powerOfTwoSize, dim }); const gridTexDim = Vec3.create(texDimX, texDimY, 0); @@ -207,7 +207,7 @@ function calcGaussianDensityTexture3d(webgl: WebGLContext, position: PositionDat const { smoothness, resolution } = props; const { drawCount, positions, radii, groups, scale, expandedBox, dim, maxRadius } = prepareGaussianDensityData(position, box, radius, props); - const [ dx, dy, dz ] = dim; + const [dx, dy, dz] = dim; const minDistTex = getTexture('min-dist-3d', webgl, 'volume-uint8', 'rgba', 'ubyte', 'nearest'); minDistTex.define(dx, dy, dz); @@ -431,8 +431,8 @@ function getTexture2dSize(gridDim: Vec3) { function fieldFromTexture2d(ctx: WebGLContext, texture: Texture, dim: Vec3, texDim: Vec3) { // console.time('fieldFromTexture2d') - const [ dx, dy, dz ] = dim; - const [ width, height ] = texDim; + const [dx, dy, dz] = dim; + const [width, height] = texDim; const fboTexCols = Math.floor(width / dx); const space = Tensor.Space(dim, [2, 1, 0], Float32Array); diff --git a/src/mol-math/geometry/molecular-surface.ts b/src/mol-math/geometry/molecular-surface.ts index 95a11219b..b3c314e8d 100644 --- a/src/mol-math/geometry/molecular-surface.ts +++ b/src/mol-math/geometry/molecular-surface.ts @@ -330,12 +330,12 @@ export async function calcMolecularSurface(ctx: RuntimeContext, position: Requir const pad = maxRadius + resolution; const expandedBox = Box3D.expand(Box3D(), box, Vec3.create(pad, pad, pad)); - const [ minX, minY, minZ ] = expandedBox.min; + const [minX, minY, minZ] = expandedBox.min; const scaledBox = Box3D.scale(Box3D(), expandedBox, scaleFactor); const dim = Box3D.size(Vec3(), scaledBox); Vec3.ceil(dim, dim); - const [ dimX, dimY, dimZ ] = dim; + const [dimX, dimY, dimZ] = dim; const iu = dimZ, iv = dimY, iuv = iu * iv; const { cosTable, sinTable } = getAngleTables(probePositions); diff --git a/src/mol-math/geometry/primitives/box3d.ts b/src/mol-math/geometry/primitives/box3d.ts index e097da873..c714fa72c 100644 --- a/src/mol-math/geometry/primitives/box3d.ts +++ b/src/mol-math/geometry/primitives/box3d.ts @@ -107,8 +107,8 @@ namespace Box3D { const tmpTransformV = Vec3(); /** Transform box with a Mat4 */ export function transform(out: Box3D, box: Box3D, m: Mat4): Box3D { - const [ minX, minY, minZ ] = box.min; - const [ maxX, maxY, maxZ ] = box.max; + const [minX, minY, minZ] = box.min; + const [maxX, maxY, maxZ] = box.max; setEmpty(out); add(out, Vec3.transformMat4(tmpTransformV, Vec3.set(tmpTransformV, minX, minY, minZ), m)); add(out, Vec3.transformMat4(tmpTransformV, Vec3.set(tmpTransformV, minX, minY, maxZ), m)); diff --git a/src/mol-math/linear-algebra/_spec/vec3.spec.ts b/src/mol-math/linear-algebra/_spec/vec3.spec.ts index 36bdd88d5..c67721f50 100644 --- a/src/mol-math/linear-algebra/_spec/vec3.spec.ts +++ b/src/mol-math/linear-algebra/_spec/vec3.spec.ts @@ -7,10 +7,10 @@ import { Vec3 } from '../3d/vec3'; describe('vec3', () => { - const vec1 = [ 1, 2, 3 ] as Vec3; - const vec2 = [ 2, 3, 1 ] as Vec3; - const orthVec1 = [ 0, 1, 0 ] as Vec3; - const orthVec2 = [ 1, 0, 0 ] as Vec3; + const vec1 = [1, 2, 3] as Vec3; + const vec2 = [2, 3, 1] as Vec3; + const orthVec1 = [0, 1, 0] as Vec3; + const orthVec2 = [1, 0, 0] as Vec3; it('angle calculation', () => { expect(Vec3.angle(vec1, vec1) * 360 / (2 * Math.PI)).toBe(0.0); diff --git a/src/mol-model-formats/shape/ply.ts b/src/mol-model-formats/shape/ply.ts index 099dbe69f..7eabead7f 100644 --- a/src/mol-model-formats/shape/ply.ts +++ b/src/mol-model-formats/shape/ply.ts @@ -40,8 +40,8 @@ function createPlyShapeParams(plyFile?: PlyFile) { type === 'ushort' || type === 'uint16' || type === 'uint' || type === 'uint32' || type === 'int' - ) groupOptions.push([ name, name ]); - if (type === 'uchar' || type === 'uint8') colorOptions.push([ name, name ]); + ) groupOptions.push([name, name]); + if (type === 'uchar' || type === 'uint8') colorOptions.push([name, name]); } // TODO hardcoded as convenience for data provided by MegaMol @@ -58,7 +58,7 @@ function createPlyShapeParams(plyFile?: PlyFile) { for (let i = 0, il = material.propertyNames.length; i < il; ++i) { const name = material.propertyNames[i]; const type = material.propertyTypes[i]; - if (type === 'uchar' || type === 'uint8') materialOptions.push([ name, name ]); + if (type === 'uchar' || type === 'uint8') materialOptions.push([name, name]); } if (material.propertyNames.includes('red')) defaultValues.mRed = 'red'; diff --git a/src/mol-model-formats/structure/_spec/cif-core.spec.ts b/src/mol-model-formats/structure/_spec/cif-core.spec.ts index 373ed08d3..7d244cf1b 100644 --- a/src/mol-model-formats/structure/_spec/cif-core.spec.ts +++ b/src/mol-model-formats/structure/_spec/cif-core.spec.ts @@ -98,7 +98,7 @@ describe('cif-core read', () => { expect(cifCore.cell.length_a.value(0)).toBe(11.0829); expect(cifCore.space_group['name_h-m_full'].value(0)).toBe('P-1'); - expect(cifCore.atom_site_aniso.u.value(0)).toEqual(new Float64Array([ 0.0425, 0, 0, 0.00089, 0.0423, 0, 0.01515, 0.00066, 0.0375 ])); + expect(cifCore.atom_site_aniso.u.value(0)).toEqual(new Float64Array([0.0425, 0, 0, 0.00089, 0.0423, 0, 0.01515, 0.00066, 0.0375])); expect.assertions(3); }); }); \ No newline at end of file diff --git a/src/mol-model-formats/structure/_spec/pdb.spec.ts b/src/mol-model-formats/structure/_spec/pdb.spec.ts index a106e038c..225957382 100644 --- a/src/mol-model-formats/structure/_spec/pdb.spec.ts +++ b/src/mol-model-formats/structure/_spec/pdb.spec.ts @@ -17,7 +17,7 @@ const records = [ describe('PDB to-cif', () => { it('guess-element-symbol', () => { for (let i = 0, il = records.length; i < il; ++i) { - const [ data, element ] = records[i]; + const [data, element] = records[i]; const tokens = TokenBuilder.create(data, 2); guessElementSymbolTokens(tokens, data, 12, 16); expect(data.substring(tokens.indices[0], tokens.indices[1])).toBe(element); diff --git a/src/mol-model-props/computed/chemistry/functional-group.ts b/src/mol-model-props/computed/chemistry/functional-group.ts index b17420d1b..962e04000 100644 --- a/src/mol-model-props/computed/chemistry/functional-group.ts +++ b/src/mol-model-props/computed/chemistry/functional-group.ts @@ -213,7 +213,7 @@ export function isAcetamidine (structure: Structure, unit: Unit.Atomic, index: S return terminalNitrogenCount === 2; } -const PolarElements = new Set<ElementSymbol>([ 'N', 'O', 'S', 'F', 'CL', 'BR', 'I' ] as ElementSymbol[]); +const PolarElements = new Set<ElementSymbol>(['N', 'O', 'S', 'F', 'CL', 'BR', 'I'] as ElementSymbol[]); export function isPolar(element: ElementSymbol) { return PolarElements.has(element); } export function hasPolarNeighbour (structure: Structure, unit: Unit.Atomic, index: StructureElement.UnitIndex) { diff --git a/src/mol-model-props/computed/chemistry/geometry.ts b/src/mol-model-props/computed/chemistry/geometry.ts index 6862f513a..8f4ac1891 100644 --- a/src/mol-model-props/computed/chemistry/geometry.ts +++ b/src/mol-model-props/computed/chemistry/geometry.ts @@ -63,10 +63,10 @@ export function assignGeometry (totalCoordination: number): AtomGeometry { } export const AtomGeometryAngles = new Map<AtomGeometry, number>([ - [ AtomGeometry.Linear, degToRad(180) ], - [ AtomGeometry.Trigonal, degToRad(120) ], - [ AtomGeometry.Tetrahedral, degToRad(109.4721) ], - [ AtomGeometry.Octahedral, degToRad(90) ] + [AtomGeometry.Linear, degToRad(180)], + [AtomGeometry.Trigonal, degToRad(120)], + [AtomGeometry.Tetrahedral, degToRad(109.4721)], + [AtomGeometry.Octahedral, degToRad(90)] ]); // tmp objects for `calcAngles` and `calcPlaneAngle` diff --git a/src/mol-model-props/computed/chemistry/valence-model.ts b/src/mol-model-props/computed/chemistry/valence-model.ts index 256ae9b5b..b8991ef8d 100644 --- a/src/mol-model-props/computed/chemistry/valence-model.ts +++ b/src/mol-model-props/computed/chemistry/valence-model.ts @@ -283,7 +283,7 @@ export function calculateHydrogensCharge (structure: Structure, unit: Unit.Atomi } } - return [ charge, implicitHCount, implicitHCount + hydrogenCount, geom ]; + return [charge, implicitHCount, implicitHCount + hydrogenCount, geom]; } function calcUnitValenceModel(structure: Structure, unit: Unit.Atomic, props: ValenceModelProps) { @@ -309,7 +309,7 @@ function calcUnitValenceModel(structure: Structure, unit: Unit.Atomic, props: Va for (let i = 0; i < n; ++i) { const j = (hasParent ? mapping![i] : i) as StructureElement.UnitIndex; - const [ chg, implH, totH, geom ] = calculateHydrogensCharge(structure, unit, j, props); + const [chg, implH, totH, geom] = calculateHydrogensCharge(structure, unit, j, props); charge[i] = chg; implicitH[i] = implH; totalH[i] = totH; diff --git a/src/mol-model-props/integrative/cross-link-restraint/format.ts b/src/mol-model-props/integrative/cross-link-restraint/format.ts index 3d65c86b6..ca5d3fd8f 100644 --- a/src/mol-model-props/integrative/cross-link-restraint/format.ts +++ b/src/mol-model-props/integrative/cross-link-restraint/format.ts @@ -46,7 +46,7 @@ namespace ModelCrossLinkRestraint { function _add(map: Map<ElementIndex, number[]>, element: ElementIndex, row: number) { const indices = map.get(element); if (indices) indices.push(row); - else map.set(element, [ row ]); + else map.set(element, [row]); } function add(row: number, ps: typeof p1) { diff --git a/src/mol-model-props/integrative/cross-link-restraint/property.ts b/src/mol-model-props/integrative/cross-link-restraint/property.ts index 0cff3196e..094c92eaf 100644 --- a/src/mol-model-props/integrative/cross-link-restraint/property.ts +++ b/src/mol-model-props/integrative/cross-link-restraint/property.ts @@ -180,7 +180,7 @@ function extractIntra(pairs: CrossLinkRestraint[], unit: Unit) { r.forEach((il, ri) => { if (il.length < 2) return; - const [ indexA, indexB ] = il; + const [indexA, indexB] = il; pairs.push( createCrossLinkRestraint(unit, indexA, unit, indexB, restraints, ri), createCrossLinkRestraint(unit, indexB, unit, indexA, restraints, ri) diff --git a/src/mol-model/structure/model/properties/atomic/bonds.ts b/src/mol-model/structure/model/properties/atomic/bonds.ts index cfe601150..f8ad9b974 100644 --- a/src/mol-model/structure/model/properties/atomic/bonds.ts +++ b/src/mol-model/structure/model/properties/atomic/bonds.ts @@ -64,7 +64,7 @@ const IntraBondOrderTable = new Map([ * Get order for bonds in aminoacids and nucleotides assuming standard IUPAC naming */ export function getIntraBondOrderFromTable (compId: string, atomId1: string, atomId2: string) { - [ atomId1, atomId2 ] = atomId1 < atomId2 ? [ atomId1, atomId2 ] : [ atomId2, atomId1 ]; + [atomId1, atomId2] = atomId1 < atomId2 ? [atomId1, atomId2] : [atomId2, atomId1]; if (AminoAcidNames.has(compId) && atomId1 === 'C' && atomId2 === 'O') return 2; if (BaseNames.has(compId) && atomId1 === 'OP1' && atomId2 === 'P') return 2; return IntraBondOrderTable.get(`${compId}|${atomId1}|${atomId2}`) || 1; @@ -83,8 +83,8 @@ const InterBondOrderTable = new Map([ */ export function getInterBondOrderFromTable (compId1: string, atomId1: string, compId2: string, atomId2: string) { if (compId1 > compId2) { - [ compId1, compId2 ] = [ compId2, compId1 ]; - [ atomId1, atomId2 ] = [ atomId2, atomId1 ]; + [compId1, compId2] = [compId2, compId1]; + [atomId1, atomId2] = [atomId2, atomId1]; } return InterBondOrderTable.get(`${compId1}|${atomId1}|${compId2}|${atomId2}`) || 1; } \ No newline at end of file diff --git a/src/mol-model/structure/structure/element/loci.ts b/src/mol-model/structure/structure/element/loci.ts index 2bd638ec6..a7b1d46f9 100644 --- a/src/mol-model/structure/structure/element/loci.ts +++ b/src/mol-model/structure/structure/element/loci.ts @@ -676,7 +676,7 @@ export namespace Loci { opQueries.length === 1 ? opQueries[0] // Need to union before merge for fast performance - : MS.struct.combinator.merge(opQueries.map(q => MS.struct.modifier.union([ q ]))) + : MS.struct.combinator.merge(opQueries.map(q => MS.struct.modifier.union([q]))) ]); } @@ -712,12 +712,12 @@ export namespace Loci { return multimodel ? { atom: { set, ranges }, - chain: { opName: [ opName ] }, + chain: { opName: [opName] }, entity: { modelLabel, modelIndex } } : { atom: { set, ranges }, - chain: { opName: [ opName ] }, + chain: { opName: [opName] }, }; } } \ No newline at end of file diff --git a/src/mol-plugin-state/actions/volume.ts b/src/mol-plugin-state/actions/volume.ts index e5958cd3d..3d3c696d5 100644 --- a/src/mol-plugin-state/actions/volume.ts +++ b/src/mol-plugin-state/actions/volume.ts @@ -153,5 +153,5 @@ export const AssignColorVolume = StateAction.build({ return { ref: PD.Select(cells[0].transform.ref, cells.map(c => [c.transform.ref, c.obj!.label]), { label: 'Volume' }) }; } })(({ ref, params, state }, plugin: PluginContext) => { - return plugin.build().to(ref).apply(StateTransforms.Volume.AssignColorVolume, { ref: params.ref }, { dependsOn: [ params.ref ] }).commit(); + return plugin.build().to(ref).apply(StateTransforms.Volume.AssignColorVolume, { ref: params.ref }, { dependsOn: [params.ref] }).commit(); }); \ No newline at end of file diff --git a/src/mol-plugin-state/formats/registry.ts b/src/mol-plugin-state/formats/registry.ts index c2130cb54..3c2a14c48 100644 --- a/src/mol-plugin-state/formats/registry.ts +++ b/src/mol-plugin-state/formats/registry.ts @@ -46,7 +46,7 @@ export class DataFormatRegistry { get options() { if (this._options) return this._options; const options: [string, string, string][] = []; - this._list.forEach(({ name, provider }) => options.push([ name, provider.label, provider.category || '' ])); + this._list.forEach(({ name, provider }) => options.push([name, provider.label, provider.category || ''])); this._options = options; return options; } diff --git a/src/mol-plugin-state/transforms/helpers.ts b/src/mol-plugin-state/transforms/helpers.ts index bc12da993..55ca620ae 100644 --- a/src/mol-plugin-state/transforms/helpers.ts +++ b/src/mol-plugin-state/transforms/helpers.ts @@ -14,7 +14,7 @@ import { DihedralData } from '../../mol-repr/shape/loci/dihedral'; export function getDistanceDataFromStructureSelections(s: ReadonlyArray<PluginStateObject.Molecule.Structure.SelectionEntry>): DistanceData { const lociA = s[0].loci; const lociB = s[1].loci; - return { pairs: [ { loci: [lociA, lociB] as const }] }; + return { pairs: [{ loci: [lociA, lociB] as const }] }; } export function getAngleDataFromStructureSelections(s: ReadonlyArray<PluginStateObject.Molecule.Structure.SelectionEntry>): AngleData { diff --git a/src/mol-plugin-ui/controls/color.tsx b/src/mol-plugin-ui/controls/color.tsx index f6af94357..76d871353 100644 --- a/src/mol-plugin-ui/controls/color.tsx +++ b/src/mol-plugin-ui/controls/color.tsx @@ -50,7 +50,7 @@ export class CombinedColorControl extends React.PureComponent<ParamProps<PD.Colo } onB = (v: number) => { - const [r, g, ] = Color.toRgb(this.props.value); + const [r, g] = Color.toRgb(this.props.value); const value = Color.fromRgb(r, g, v); if (value !== this.props.value) this.update(value); } diff --git a/src/mol-plugin-ui/structure/volume.tsx b/src/mol-plugin-ui/structure/volume.tsx index 77f45dfbf..94368e4d1 100644 --- a/src/mol-plugin-ui/structure/volume.tsx +++ b/src/mol-plugin-ui/structure/volume.tsx @@ -271,12 +271,12 @@ class VolumeRepresentationControls extends PurePluginUIComponent<{ representatio }); } - remove = () => this.plugin.managers.volume.hierarchy.remove([ this.props.representation ], true); + remove = () => this.plugin.managers.volume.hierarchy.remove([this.props.representation], true); toggleVisible = (e: React.MouseEvent<HTMLElement>) => { e.preventDefault(); e.currentTarget.blur(); - this.plugin.managers.volume.hierarchy.toggleVisibility([ this.props.representation ]); + this.plugin.managers.volume.hierarchy.toggleVisibility([this.props.representation]); } toggleUpdate = () => this.setState({ action: this.state.action === 'update' ? void 0 : 'update' }); diff --git a/src/mol-plugin/behavior/dynamic/volume-streaming/util.ts b/src/mol-plugin/behavior/dynamic/volume-streaming/util.ts index 3e6ce442e..753d36f32 100644 --- a/src/mol-plugin/behavior/dynamic/volume-streaming/util.ts +++ b/src/mol-plugin/behavior/dynamic/volume-streaming/util.ts @@ -32,10 +32,10 @@ export function getStreamingMethod(s?: Structure, defaultKind: VolumeServerInfo. /** Returns EMD ID when available, otherwise falls back to PDB ID */ export function getEmIds(model: Model): string[] { const ids: string[] = []; - if (!MmcifFormat.is(model.sourceData)) return [ model.entryId ]; + if (!MmcifFormat.is(model.sourceData)) return [model.entryId]; const { db_id, db_name, content_type } = model.sourceData.data.db.pdbx_database_related; - if (!db_name.isDefined) return [ model.entryId ]; + if (!db_name.isDefined) return [model.entryId]; for (let i = 0, il = db_name.rowCount; i < il; ++i) { if (db_name.value(i).toUpperCase() === 'EMDB' && content_type.value(i) === 'associated EM volume') { @@ -47,7 +47,7 @@ export function getEmIds(model: Model): string[] { } export function getXrayIds(model: Model): string[] { - return [ model.entryId ]; + return [model.entryId]; } export function getIds(method: VolumeServerInfo.Kind, s?: Structure): string[] { diff --git a/src/mol-repr/volume/util.ts b/src/mol-repr/volume/util.ts index 9fb812f2d..fb10ce7c7 100644 --- a/src/mol-repr/volume/util.ts +++ b/src/mol-repr/volume/util.ts @@ -86,7 +86,7 @@ export function createVolumeTexture2d(volume: Volume, variant: 'normals' | 'grou const textureImage = { array, width, height }; const diff = max - min; - const [ xn, yn, zn ] = dim; + const [xn, yn, zn] = dim; const xnp = xn + padding; const ynp = yn + padding; @@ -138,7 +138,7 @@ export function createVolumeTexture2d(volume: Volume, variant: 'normals' | 'grou export function createVolumeTexture3d(volume: Volume) { const { cells: { space, data }, stats: { max, min } } = volume.grid; - const [ width, height, depth ] = space.dimensions as Vec3; + const [width, height, depth] = space.dimensions as Vec3; const { dataOffset: o } = space; const array = new Uint8Array(width * height * depth * 4); diff --git a/src/mol-script/language/builder.ts b/src/mol-script/language/builder.ts index ddab77cfd..bf59c4027 100644 --- a/src/mol-script/language/builder.ts +++ b/src/mol-script/language/builder.ts @@ -40,9 +40,9 @@ export namespace MolScriptBuilder { const _aps = struct.atomSet.propertySet; /** atom core property set */ - export function acpSet(p: keyof typeof _acp) { return _aps([ acp(p) ]); }; + export function acpSet(p: keyof typeof _acp) { return _aps([acp(p)]); }; /** atom topology property set */ - export function atpSet(p: keyof typeof _atp) { return _aps([ atp(p) ]); }; + export function atpSet(p: keyof typeof _atp) { return _aps([atp(p)]); }; /** atom macromolecular property set */ - export function ammpSet(p: keyof typeof _ammp) { return _aps([ ammp(p) ]); }; + export function ammpSet(p: keyof typeof _ammp) { return _aps([ammp(p)]); }; } \ No newline at end of file diff --git a/src/mol-script/script/mol-script/script-macro.ts b/src/mol-script/script/mol-script/script-macro.ts index e42b79b6f..76cb59e4c 100644 --- a/src/mol-script/script/mol-script/script-macro.ts +++ b/src/mol-script/script/mol-script/script-macro.ts @@ -34,6 +34,6 @@ export function pickArgs(args: any, ...names: string[]) { export function aggregate(property: any, fn: any, initial?: any) { return B.struct.atomSet.reduce({ initial: initial !== void 0 ? initial : property, - value: fn([ B.struct.slot.elementSetReduce(), property ]) + value: fn([B.struct.slot.elementSetReduce(), property]) }); } \ No newline at end of file diff --git a/src/mol-theme/color/hydrophobicity.ts b/src/mol-theme/color/hydrophobicity.ts index 0f49fe06e..d8e572bc6 100644 --- a/src/mol-theme/color/hydrophobicity.ts +++ b/src/mol-theme/color/hydrophobicity.ts @@ -58,7 +58,7 @@ export function HydrophobicityColorTheme(ctx: ThemeDataContext, props: PD.Values const scale = ColorScale.create({ listOrName: props.list.colors, - domain: [ max, min ], + domain: [max, min], minLabel: 'Hydrophobic', maxLabel: 'Hydrophilic' }); diff --git a/src/mol-theme/color/molecule-type.ts b/src/mol-theme/color/molecule-type.ts index 9ed619acb..ffce58da6 100644 --- a/src/mol-theme/color/molecule-type.ts +++ b/src/mol-theme/color/molecule-type.ts @@ -72,7 +72,7 @@ export function MoleculeTypeColorTheme(ctx: ThemeDataContext, props: PD.Values<M description: Description, legend: TableLegend(Object.keys(MoleculeTypeColors).map(name => { return [name, (MoleculeTypeColors as any)[name] as Color] as [string, Color]; - }).concat([[ 'Other/unknown', DefaultMoleculeTypeColor ]])) + }).concat([['Other/unknown', DefaultMoleculeTypeColor]])) }; } diff --git a/src/mol-theme/color/operator-hkl.ts b/src/mol-theme/color/operator-hkl.ts index a0ce8e625..3062dfc2f 100644 --- a/src/mol-theme/color/operator-hkl.ts +++ b/src/mol-theme/color/operator-hkl.ts @@ -49,7 +49,7 @@ function hklKeySplit(key: string) { const h = parseInt(key.substr(0, len)); const k = parseInt(key.substr(len, len)); const l = parseInt(key.substr(len + len, len)); - return [ h - hklOffset, k - hklOffset, l - hklOffset ] as Vec3; + return [h - hklOffset, k - hklOffset, l - hklOffset] as Vec3; } function formatHkl(hkl: Vec3) { diff --git a/src/mol-theme/color/residue-name.ts b/src/mol-theme/color/residue-name.ts index 83e1c98d3..727df16a5 100644 --- a/src/mol-theme/color/residue-name.ts +++ b/src/mol-theme/color/residue-name.ts @@ -125,7 +125,7 @@ export function ResidueNameColorTheme(ctx: ThemeDataContext, props: PD.Values<Re description: Description, legend: TableLegend(Object.keys(ResidueNameColors).map(name => { return [name, (ResidueNameColors as any)[name] as Color] as [string, Color]; - }).concat([[ 'Unknown', DefaultResidueNameColor ]])) + }).concat([['Unknown', DefaultResidueNameColor]])) }; } diff --git a/src/mol-theme/color/secondary-structure.ts b/src/mol-theme/color/secondary-structure.ts index 033c4f134..f0a3eddb1 100644 --- a/src/mol-theme/color/secondary-structure.ts +++ b/src/mol-theme/color/secondary-structure.ts @@ -109,7 +109,7 @@ export function SecondaryStructureColorTheme(ctx: ThemeDataContext, props: PD.Va description: Description, legend: TableLegend(Object.keys(SecondaryStructureColors).map(name => { return [name, (SecondaryStructureColors as any)[name] as Color] as [string, Color]; - }).concat([[ 'Other', DefaultSecondaryStructureColor ]])) + }).concat([['Other', DefaultSecondaryStructureColor]])) }; } diff --git a/src/mol-util/color/color.ts b/src/mol-util/color/color.ts index 0e635c407..e90f3a25e 100644 --- a/src/mol-util/color/color.ts +++ b/src/mol-util/color/color.ts @@ -28,11 +28,11 @@ export namespace Color { } export function toRgb(hexColor: Color): [number, number, number] { - return [ hexColor >> 16 & 255, hexColor >> 8 & 255, hexColor & 255 ]; + return [hexColor >> 16 & 255, hexColor >> 8 & 255, hexColor & 255]; } export function toRgbNormalized(hexColor: Color): [number, number, number] { - return [ (hexColor >> 16 & 255) / 255, (hexColor >> 8 & 255) / 255, (hexColor & 255) / 255 ]; + return [(hexColor >> 16 & 255) / 255, (hexColor >> 8 & 255) / 255, (hexColor & 255) / 255]; } export function fromRgb(r: number, g: number, b: number): Color { diff --git a/src/mol-util/color/lists.ts b/src/mol-util/color/lists.ts index f143901e5..586368682 100644 --- a/src/mol-util/color/lists.ts +++ b/src/mol-util/color/lists.ts @@ -208,11 +208,11 @@ export const ColorLists = { */ 'rainbow': ColorList('Rainbow', 'sequential', '', - [ 0x3361E1, 0x35A845, 0xF9FF00, 0xEC8711, 0xBF2222 ] + [0x3361E1, 0x35A845, 0xF9FF00, 0xEC8711, 0xBF2222] ), 'red-white-blue': ColorList('Red-White-Blue', 'diverging', '', - [ 0xBF2222, 0xFFFFFF, 0x3361E1 ] + [0xBF2222, 0xFFFFFF, 0x3361E1] ), }; diff --git a/src/mol-util/file-info.ts b/src/mol-util/file-info.ts index 5ef434ad1..fcc242404 100644 --- a/src/mol-util/file-info.ts +++ b/src/mol-util/file-info.ts @@ -9,10 +9,10 @@ export type FileInput = File | Blob | string // TODO only support compressed files for which uncompression support is available??? // TODO store globally with decompression plugins? -const compressedExtList = [ 'gz', 'zip' ]; +const compressedExtList = ['gz', 'zip']; // TODO store globally with parser plugins? -const binaryExtList = [ 'bcif', 'ccp4', 'dcd' ]; +const binaryExtList = ['bcif', 'ccp4', 'dcd']; export interface FileInfo { path: string diff --git a/src/mol-util/polyfill.ts b/src/mol-util/polyfill.ts index c2b15b00b..ab18a3677 100644 --- a/src/mol-util/polyfill.ts +++ b/src/mol-util/polyfill.ts @@ -54,7 +54,7 @@ if (typeof window.HTMLCanvasElement !== 'undefined' && !window.HTMLCanvasElement a8[ j ] = bin.charCodeAt(j++); } - callback(new window.Blob([ a8 ], { 'type': type || 'image/png' })); + callback(new window.Blob([a8], { 'type': type || 'image/png' })); } }); @@ -397,7 +397,7 @@ if (typeof window !== 'undefined') { // MIT license let lastTime = 0; - let vendors = [ 'ms', 'moz', 'webkit', 'o' ]; + let vendors = ['ms', 'moz', 'webkit', 'o']; for (let x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { window.requestAnimationFrame = ( diff --git a/src/mol-util/zip/deflate.ts b/src/mol-util/zip/deflate.ts index 6c832d7ff..7b576c800 100644 --- a/src/mol-util/zip/deflate.ts +++ b/src/mol-util/zip/deflate.ts @@ -103,15 +103,15 @@ function deflateChunk(ctx: DeflateContext, count: number) { */ const Opts = [ /* good lazy nice chain */ - /* 0 */ [ 0, 0, 0, 0, 0], /* store only */ - /* 1 */ [ 4, 4, 8, 4, 0], /* max speed, no lazy matches */ - /* 2 */ [ 4, 5, 16, 8, 0], - /* 3 */ [ 4, 6, 16, 16, 0], - - /* 4 */ [ 4, 10, 16, 32, 0], /* lazy matches */ - /* 5 */ [ 8, 16, 32, 32, 0], - /* 6 */ [ 8, 16, 128, 128, 0], - /* 7 */ [ 8, 32, 128, 256, 0], + /* 0 */ [0, 0, 0, 0, 0], /* store only */ + /* 1 */ [4, 4, 8, 4, 0], /* max speed, no lazy matches */ + /* 2 */ [4, 5, 16, 8, 0], + /* 3 */ [4, 6, 16, 16, 0], + + /* 4 */ [4, 10, 16, 32, 0], /* lazy matches */ + /* 5 */ [8, 16, 32, 32, 0], + /* 6 */ [8, 16, 128, 128, 0], + /* 7 */ [8, 32, 128, 256, 0], /* 8 */ [32, 128, 258, 1024, 1], /* 9 */ [32, 258, 258, 4096, 1] /* max compression */ ] as const; @@ -210,7 +210,7 @@ function _hash(data: Uint8Array, i: number) { function _writeBlock(BFINAL: number, lits: Uint32Array, li: number, ebits: number, data: Uint8Array, o0: number, l0: number, out: Uint8Array, pos: number) { U.lhst[256]++; - const [ ML, MD, MH, numl, numd, numh, lset, dset ] = getTrees(); + const [ML, MD, MH, numl, numd, numh, lset, dset] = getTrees(); const cstSize = (((pos + 3) & 7) === 0 ? 0 : 8 - ((pos + 3) & 7)) + 32 + (l0 << 3); const fxdSize = ebits + contSize(U.fltree, U.lhst) + contSize(U.fdtree, U.dhst); diff --git a/src/mol-util/zip/util.ts b/src/mol-util/zip/util.ts index fb6b51762..c73482119 100644 --- a/src/mol-util/zip/util.ts +++ b/src/mol-util/zip/util.ts @@ -12,7 +12,7 @@ export const U = (function(){ return { next_code: new u16(16), bl_count: new u16(16), - ordr: [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ], + ordr: [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], of0: [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 999, 999, 999], exb: [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0, 0], ldef: new u16(32), diff --git a/src/perf-tests/mol-script.ts b/src/perf-tests/mol-script.ts index 69b3cf007..590c809db 100644 --- a/src/perf-tests/mol-script.ts +++ b/src/perf-tests/mol-script.ts @@ -49,7 +49,7 @@ console.log(result); const CustomProp = CustomPropertyDescriptor({ name: 'test_prop', - cifExport: { prefix: '', categories: [ ] }, + cifExport: { prefix: '', categories: [] }, symbols: { residueIndex: QuerySymbolRuntime.Dynamic(CustomPropSymbol('custom.test-prop', 'residue-index', Type.Num), ctx => { const e = ctx.element; diff --git a/src/servers/model/server/api.ts b/src/servers/model/server/api.ts index 32382c659..71a6ada15 100644 --- a/src/servers/model/server/api.ts +++ b/src/servers/model/server/api.ts @@ -161,7 +161,7 @@ const QueryMap = { }))); return Queries.filters.first(ligands); }, - jsonParams: [ AtomSiteTestJsonParam ], + jsonParams: [AtomSiteTestJsonParam], restParams: AtomSiteTestRestParams }), 'atoms': Q<{ atom_site: AtomSiteSchema }>({ @@ -170,7 +170,7 @@ const QueryMap = { query: p => { return Queries.combinators.merge(getAtomsTests(p.atom_site).map(test => Queries.generators.atoms(test))); }, - jsonParams: [ AtomSiteTestJsonParam ], + jsonParams: [AtomSiteTestJsonParam], restParams: AtomSiteTestRestParams }), 'symmetryMates': Q<{ radius: number }>({ @@ -180,7 +180,7 @@ const QueryMap = { structureTransform(p, s) { return StructureSymmetry.builderSymmetryMates(s, p.radius).run(); }, - jsonParams: [ RadiusParam ], + jsonParams: [RadiusParam], filter: QuerySchemas.assembly }), 'assembly': Q<{ name: string }>({ @@ -216,8 +216,8 @@ const QueryMap = { if (p.assembly_name) return StructureSymmetry.buildAssembly(s, '' + p.assembly_name).run(); return StructureSymmetry.builderSymmetryMates(s, p.radius !== void 0 ? p.radius : 5).run(); }, - jsonParams: [ AtomSiteTestJsonParam, RadiusParam, AssemblyNameParam ], - restParams: [ ...AtomSiteTestRestParams, RadiusParam, AssemblyNameParam ], + jsonParams: [AtomSiteTestJsonParam, RadiusParam, AssemblyNameParam], + restParams: [...AtomSiteTestRestParams, RadiusParam, AssemblyNameParam], filter: QuerySchemas.interaction }), 'residueSurroundings': Q<{ atom_site: AtomSiteSchema, radius: number }>({ @@ -227,8 +227,8 @@ const QueryMap = { const center = Queries.combinators.merge(getAtomsTests(p.atom_site).map(test => Queries.generators.atoms(test))); return Queries.modifiers.includeSurroundings(center, { radius: p.radius, wholeResidues: true }); }, - jsonParams: [ AtomSiteTestJsonParam, RadiusParam ], - restParams: [ ...AtomSiteTestRestParams, RadiusParam ], + jsonParams: [AtomSiteTestJsonParam, RadiusParam], + restParams: [...AtomSiteTestRestParams, RadiusParam], filter: QuerySchemas.interaction }), 'surroundingLigands': Q<{ atom_site: AtomSiteSchema, radius: number, assembly_name: string, omit_water: boolean }>({ @@ -248,8 +248,8 @@ const QueryMap = { if (p.assembly_name) return StructureSymmetry.buildAssembly(s, '' + p.assembly_name).run(); return StructureSymmetry.builderSymmetryMates(s, p.radius !== void 0 ? p.radius : 5).run(); }, - jsonParams: [ AtomSiteTestJsonParam, RadiusParam, OmitWaterParam, AssemblyNameParam ], - restParams: [ ...AtomSiteTestRestParams, RadiusParam, OmitWaterParam, AssemblyNameParam ], + jsonParams: [AtomSiteTestJsonParam, RadiusParam, OmitWaterParam, AssemblyNameParam], + restParams: [...AtomSiteTestRestParams, RadiusParam, OmitWaterParam, AssemblyNameParam], filter: QuerySchemas.interaction }), }; -- GitLab