Skip to content

Commit 5554523

Browse files
committed
chore: remove more eslint errors
1 parent 5f1313a commit 5554523

50 files changed

Lines changed: 200 additions & 373 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

chemistry/structuralAnalysisExercises.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ async function fetchData(
4343
}
4444
let datum = data[file.rn];
4545
switch (file.kind) {
46-
case 'mol':
46+
case 'mol': {
4747
datum.mol = { type: 'mol2d', url: file.url };
4848
const molfile = await (await fetch(file.url)).text();
4949
const molecule = Molecule.fromMolfile(molfile);
@@ -61,6 +61,7 @@ async function fetchData(
6161
datum.nbH = Number(datum.mf.replace(/.*H([0-9]+).*/, '$1'));
6262
datum.nbC = Number(datum.mf.replace(/.*C([0-9]+).*/, '$1'));
6363
break;
64+
}
6465
case 'mass':
6566
datum.mass = { type: 'jcamp', url: file.url };
6667
datum.isMass = true;

defaultOptions/mass.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
define(function () {
1+
define(() => {
22
return {
33
monoisotopicMass: 300.123,
44
resolution: 100000,

eln/BioReaction.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,11 @@ class BioReaction {
177177
case 'save':
178178
await this.roc.update(this.sample);
179179
break;
180-
case 'deleteAttachment':
181-
var attachment = action.value.name;
180+
case 'deleteAttachment': {
181+
const attachment = action.value.name;
182182
await this.roc.deleteAttachment(this.sample, attachment);
183183
break;
184+
}
184185
case 'unattach':
185186
await this.roc.unattach(this.sample, action.value);
186187
break;

eln/ExtSample.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class Sample {
100100
case '$content.general.mf':
101101
try {
102102
this.mf.fromMF();
103-
} catch (e) {
103+
} catch {
104104
// ignore
105105
}
106106
break;
@@ -119,7 +119,7 @@ class Sample {
119119
}
120120

121121
async _init() {
122-
this._initialized = new Promise(async (resolve) => {
122+
this._initialized = (async () => {
123123
let sample;
124124
if (this.options.trackId) {
125125
try {
@@ -143,8 +143,7 @@ class Sample {
143143
sample.$content.general.molfile = ''; // can not be edited otherwise
144144
}
145145
this._loadSample(sample);
146-
resolve();
147-
});
146+
})();
148147
}
149148

150149
bindChange() {
@@ -157,7 +156,7 @@ class Sample {
157156
}
158157

159158
async handleDrop(name, askType, options = {}) {
160-
let { converters = {}, autoJcamp, autoKind } = options;
159+
let { converters = {}, autoKind } = options;
161160
if (!name) {
162161
throw new Error('handleDrop expects a variable name');
163162
}
@@ -201,8 +200,6 @@ class Sample {
201200
}
202201

203202
if (converters[kind]) {
204-
autoJcamp = false;
205-
206203
let converted = await converters[kind](droppedData.content);
207204
if (!Array.isArray(converted)) {
208205
converted = [converted];

eln/MF.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,6 @@ class MF {
9797
this.sample.setChildSync(['$content', 'general', 'mf'], mf);
9898
}
9999

100-
setMF(mf) {
101-
this.sample.setChildSync(['$content', 'general', 'mf'], mf);
102-
}
103-
104100
setMW(mw) {
105101
this.sample.setChildSync(['$content', 'general', 'mw'], mw);
106102
}

eln/Nmr1dManager.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,14 @@ class Nmr1dManager {
177177
this._autoRanges(currentNmr);
178178
break;
179179
}
180-
case 'deleteAllRanges':
181-
var ranges = API.getData('currentNmrRanges');
180+
case 'deleteAllRanges': {
181+
const ranges = API.getData('currentNmrRanges');
182182
while (ranges.length) {
183183
ranges.pop();
184184
}
185185
ranges.triggerChange();
186186
break;
187+
}
187188
case 'clearAssignments': {
188189
let ranges = this.getCurrentRanges();
189190
if (ranges) {
@@ -298,8 +299,9 @@ class Nmr1dManager {
298299
_getNMR(currentNMRLine) {
299300
let filename = String(currentNMRLine.getChildSync(['jcamp', 'filename']));
300301
return currentNMRLine.getChild(['jcamp', 'data']).then((jcamp) => {
302+
let spectrum;
301303
if (filename && this.spectra[filename]) {
302-
var spectrum = this.spectra[filename];
304+
spectrum = this.spectra[filename];
303305
} else if (jcamp) {
304306
jcamp = String(jcamp.get());
305307
spectrum = NMR.fromJcamp(jcamp);
@@ -381,7 +383,7 @@ class Nmr1dManager {
381383
if (mfInfo && mfInfo.atoms && mfInfo.atoms.H) {
382384
return mfInfo.atoms.H || 100;
383385
}
384-
} catch (e) {
386+
} catch {
385387
return 100;
386388
}
387389
}

eln/Sample.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -616,11 +616,15 @@ Your local changes will be lost.</p>`;
616616
content = atob(droppedData.content);
617617
droppedData.encoding = 'text';
618618
break;
619-
case 'buffer':
619+
case 'buffer': {
620620
const decoder = new TextDecoder();
621621
content = decoder.decode(droppedData.content);
622622
droppedData.encoding = 'text';
623623
break;
624+
}
625+
default: {
626+
// No special handling
627+
}
624628
}
625629
droppedData.content = convertToJcamp(content, {
626630
meta,
@@ -675,8 +679,8 @@ Your local changes will be lost.</p>`;
675679
case 'translateNucleic':
676680
Sequence.translateNucleic(this.sample);
677681
break;
678-
case 'createOptions':
679-
var advancedOptions1H = API.cache('nmr1hAdvancedOptions');
682+
case 'createOptions': {
683+
const advancedOptions1H = API.cache('nmr1hAdvancedOptions');
680684
if (advancedOptions1H) {
681685
API.createData(
682686
'nmr1hOndeTemplate',
@@ -689,8 +693,10 @@ Your local changes will be lost.</p>`;
689693
);
690694
}
691695
break;
696+
}
692697
case 'recreateVariables':
693698
this.createVariables();
699+
break;
694700
case 'deleteAttachment': {
695701
const ok = await UI.confirm(
696702
'Are you sure you want to delete the attachment?',

eln/StockSample.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class Sample {
5656
case '$content.general.mf':
5757
try {
5858
this.mf.fromMF();
59-
} catch (e) {
59+
} catch {
6060
// ignore
6161
}
6262
break;
@@ -69,11 +69,10 @@ class Sample {
6969
}
7070

7171
async _init() {
72-
this._initialized = new Promise(async (resolve) => {
72+
this._initialized = (async () => {
7373
this.sample = await API.createData(this.options.varName, this.sample);
7474
this._loadSample();
75-
resolve();
76-
});
75+
})();
7776
}
7877

7978
bindChange() {

eln/nucleic/genbank.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import Twig from 'lib/twigjs/twig';
1+
// eslint-disable-next-line import/no-unassigned-import
22
import 'angularplasmid';
3-
import typerenderer from 'src/util/typerenderer';
43
import $ from 'jquery';
4+
import Twig from 'lib/twigjs/twig';
5+
import typerenderer from 'src/util/typerenderer';
56

67
const templateOptions = {
78
style: `
@@ -86,9 +87,9 @@ export async function getSvg(parsedGb, options) {
8687
}
8788

8889
async function compile(val) {
89-
return new Promise(function (resolve) {
90+
return new Promise(function compile(resolve) {
9091
let $injector = self.angular.injector(['ng', 'angularplasmid']);
91-
$injector.invoke(function ($rootScope, $compile) {
92+
$injector.invoke(function invoke($rootScope, $compile) {
9293
const svg = $compile(String(val))($rootScope);
9394
// TODO: why is this setTimeout needed
9495
setTimeout(() => resolve(svg), 0);

0 commit comments

Comments
 (0)