ソースを参照

linting & cleanup

Sebastian Bittrich 3 年 前
コミット
9db9166229

+ 1 - 4
.vscode/launch.json

@@ -1,14 +1,11 @@
 {
-    // Use IntelliSense to learn about possible attributes.
-    // Hover to view descriptions of existing attributes.
-    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
     "version": "0.2.0",
     "configurations": [
         {
             "type": "chrome",
             "request": "launch",
             "name": "Launch RCSB PDB Mol* Viewer",
-            "url": "http://localhost:1335/build/dist/structure-viewer/index.html?pdbId=4zjx&assemblyId=1",
+            "url": "http://localhost:1335/build/dist/structure/index.html?pdbId=4zjx&assemblyId=1",
             "sourceMaps": true,
             "webRoot": "${workspaceFolder}"
         }

+ 1 - 1
.vscode/settings.json

@@ -5,5 +5,5 @@
         "*.frag.ts": "glsl",
         "*.vert.ts": "glsl",
         "*.gql.ts": "graphql"
-    },
+    }
 }

+ 2 - 2
src/viewer/helpers/af-confidence/behavior.ts

@@ -20,7 +20,7 @@ export const AlphaFoldConfidenceScore = PluginBehavior.create<{ autoAttach: bool
         description: 'AlphaFold Confidence Score.'
     },
     ctor: class extends PluginBehavior.Handler<{ autoAttach: boolean, showTooltip: boolean }> {
-        private provider = AlphaFoldConfidenceProvider
+        private provider = AlphaFoldConfidenceProvider;
 
         private labelProvider = {
             label: (loci: Loci): string | undefined => {
@@ -40,7 +40,7 @@ export const AlphaFoldConfidenceScore = PluginBehavior.create<{ autoAttach: bool
                     default: return;
                 }
             }
-        }
+        };
 
         register(): void {
             this.ctx.customModelProperties.register(this.provider, this.params.autoAttach);

+ 1 - 1
src/viewer/helpers/preset.ts

@@ -348,7 +348,7 @@ function determineAssemblyId(traj: any, p: MotifProps) {
             g.split(',').forEach(e => {
                 const dashIndex = e.indexOf('-');
                 if (dashIndex > 0) {
-                    const from = parseInt(e.substring(0, dashIndex)), to = parseInt(e.substr(dashIndex + 1));
+                    const from = parseInt(e.substring(0, dashIndex)), to = parseInt(e.substring(dashIndex + 1));
                     for (let i = from; i <= to; i++) group[group.length] = i.toString();
                 } else {
                     group[group.length] = e.trim();

+ 1 - 1
src/viewer/helpers/superpose/flexible-structure.ts

@@ -17,7 +17,7 @@ const FlexibleStructureFromModel = PluginStateTransform.BuiltIn({
     from: SO.Molecule.Model,
     to: SO.Molecule.Structure,
     isDecorator: true,
-    params(a) {
+    params(_a) {
         return {
             targets: PD.Value<PropsetProps['targets']>([])
         };

+ 4 - 3
src/viewer/helpers/viewer.ts

@@ -11,7 +11,8 @@ import { MolScriptBuilder as MS } from 'molstar/lib/mol-script/language/builder'
 import { StructureRepresentationRegistry } from 'molstar/lib/mol-repr/structure/registry';
 import { StructureSelectionQuery } from 'molstar/lib/mol-plugin-state/helpers/structure-selection-query';
 import {
-    rangeToTest, SelectBase,
+    rangeToTest,
+    SelectBase,
     SelectRange,
     SelectTarget,
     Target,
@@ -46,7 +47,7 @@ export function getStructureRefWithModelId(structures: StructureRef[], target: {
 export function select(plugin: PluginContext, targets: SelectTarget | SelectTarget[], mode: 'select' | 'hover', modifier: 'add' | 'set') {
     if (modifier === 'set')
         clearSelection(plugin, mode);
-    (Array.isArray(targets) ? targets : [targets]).forEach((target, n)=>{
+    (Array.isArray(targets) ? targets : [targets]).forEach(target => {
         const data = getStructureWithModelId(plugin.managers.structure.hierarchy.current.structures, target);
         if (!data) return;
 
@@ -85,7 +86,7 @@ export async function createComponent(plugin: PluginContext, componentLabel: str
         if (!structureRef) throw Error('createComponent error: model not found');
 
         const residues = toResidues(target);
-        const sel = StructureSelectionQuery('innerQuery_' + Math.random().toString(36).substr(2),
+        const sel = StructureSelectionQuery('innerQuery_' + Math.random().toString(36).substring(2),
             MS.struct.generator.atomGroups(rangeToTest(target.labelAsymId, residues)));
         await plugin.managers.structure.component.add({
             selection: sel,

+ 1 - 1
src/viewer/ui/exchanges.tsx

@@ -42,7 +42,7 @@ export class ExchangesControl extends React.Component<{ handler: Residue }> {
     onClickSwatch = (e: React.MouseEvent<HTMLButtonElement>) => {
         const tlc = e.currentTarget.getAttribute('data-id')!;
         this.props.handler.toggleExchange(tlc);
-    }
+    };
 
     swatch() {
         // TODO update of isSelected style is delayed - this seems to be a Chrome-related bug

+ 1 - 1
src/viewer/ui/export.tsx

@@ -30,7 +30,7 @@ class CoordinatesExportControls extends PluginUIComponent {
     download = async () => {
         const content = encodeStructureData(this.plugin);
         await downloadAsZipFile(this.plugin, content);
-    }
+    };
 
     render() {
         return <>

+ 2 - 2
src/viewer/ui/strucmotif.tsx

@@ -222,7 +222,7 @@ class SubmitControls extends PurePluginUIComponent<{}, { isBusy: boolean, residu
         const url = sierraUrl + encodeURIComponent(JSON.stringify(query)) + RETURN_TYPE;
         // console.log(url);
         window.open(url, '_blank');
-    }
+    };
 
     sortResidueIds(a: ResidueSelection, b: ResidueSelection): number {
         if (a.label_asym_id !== b.label_asym_id) {
@@ -249,7 +249,7 @@ class SubmitControls extends PurePluginUIComponent<{}, { isBusy: boolean, residu
     selectAction: ActionMenu.OnSelect = item => {
         if (!item) return;
         (item?.value as any)();
-    }
+    };
 
     toggleExchanges = (idx: number) => this.setState({ action: (this.state.action === idx ? void 0 : idx) as ExchangeState });
 

+ 2 - 2
src/viewer/ui/validation.tsx

@@ -89,7 +89,7 @@ export class ValidationReportControls extends CollapsableControls<{}, Validation
                 return { errorStates: errors };
             });
         }
-    }
+    };
 
     get actions(): ActionMenu.Items {
         // TODO this could support other kinds of reports/validation like the AlphaFold confidence scores
@@ -108,7 +108,7 @@ export class ValidationReportControls extends CollapsableControls<{}, Validation
     selectAction: ActionMenu.OnSelect = item => {
         if (!item) return;
         (item?.value as any)();
-    }
+    };
 
     renderControls() {
         return <ActionMenu items={this.actions} onSelect={this.selectAction} />;