Skip to content

Commit 9b05e2a

Browse files
authored
chore: handle many eslint errors (#55)
1 parent afeb5cd commit 9b05e2a

105 files changed

Lines changed: 404 additions & 703 deletions

File tree

Some content is hidden

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

.babelrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

.github/workflows/nodejs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ jobs:
2626
- name: Install dependencies
2727
run: npm ci
2828
- name: Run babel on all files
29-
run: npm run babel
29+
run: npm run babel-test

ChemEquilibrium/AcidModel.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ let pkas = [
147147
{ ha: 'HCl', a: 'Cl-', pka: 1, specie: { label: 'Cl-', number: 1, pka: 1 } },
148148
];
149149

150-
define(['lodash'], function (_) {
150+
define(['lodash'], (_) => {
151151
class AcidBase {
152152
constructor(customPkas) {
153153
this.pkas = customPkas || pkas;
@@ -165,14 +165,14 @@ define(['lodash'], function (_) {
165165

166166
addAcidBase(label, total) {
167167
let titrProtonCount;
168-
let titrSpecie = pkas.find(function (pka) {
168+
let titrSpecie = pkas.find(function equalsLabel(pka) {
169169
return pka.ha === label;
170170
});
171171
if (titrSpecie) {
172172
titrProtonCount = titrSpecie.specie.number;
173173
titrSpecie = titrSpecie.specie.label;
174174
} else {
175-
titrSpecie = pkas.find(function (pka) {
175+
titrSpecie = pkas.find(function equalsLabel(pka) {
176176
return pka.a === label;
177177
});
178178
if (titrSpecie) {
@@ -222,13 +222,13 @@ define(['lodash'], function (_) {
222222
getModel() {
223223
// Get all involved pkas
224224
let pkas = this.pkas.filter((pka) => {
225-
return this.components.find(function (c) {
225+
return this.components.find(function equalsLabel(c) {
226226
return String(c.label) === String(pka.specie.label);
227227
});
228228
});
229229

230230
// group pkas by component
231-
let grouped = _.groupBy(pkas, function (pka) {
231+
let grouped = _.groupBy(pkas, function equalsLabel(pka) {
232232
return String(pka.specie.label);
233233
});
234234

@@ -241,7 +241,7 @@ define(['lodash'], function (_) {
241241

242242
// Model components
243243
model.components = new Array(nbComponents);
244-
for (i = 0; i < this.components.length; i++) {
244+
for (let i = 0; i < this.components.length; i++) {
245245
model.components[i] = { ...this.components[i] };
246246
}
247247

@@ -256,7 +256,7 @@ define(['lodash'], function (_) {
256256

257257
model.formedSpecies[0].components[protonIndex] = -1;
258258

259-
for (var i = 0; i < this.components.length; i++) {
259+
for (let i = 0; i < this.components.length; i++) {
260260
if (i === protonIndex) continue;
261261
let group = grouped[this.components[i].label];
262262
if (!group) throw new Error('Should be unreachable');

ChemEquilibrium/chart.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
define(['src/util/color'], function (Color) {
1+
define(['src/util/color'], (Color) => {
22
return {
33
getChart(x, y, options) {
44
options = options || {};
@@ -20,10 +20,9 @@ define(['src/util/color'], function (Color) {
2020
let species = Object.keys(y[0]);
2121
let colors = Color.getDistinctColors(species.length);
2222

23-
for (var i = 0; i < species.length; i++) {
23+
for (let i = 0; i < species.length; i++) {
2424
let data = {};
2525
chart.data.push(data);
26-
// eslint-disable-next-line no-loop-func
2726
data.y = y.map((y) => {
2827
return y[species[i]];
2928
});

biology/needleman/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function run(v, w, options = {}) {
4949
let matrixScore;
5050
try {
5151
matrixScore = S[v[i - 1]][w[j - 1]];
52-
} catch (e) {
52+
} catch {
5353
// e.g. a letter is not found in the matrix
5454
matrixScore = indel;
5555
}

chemistry/PubChem.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ async function getMolecules(mf) {
1010

1111
let response = await fetch(`${pubchemURL}${searchParams.toString()}`);
1212
let results = await response.json();
13-
console.log(results.data);
1413
return results.data;
1514
}
1615

@@ -66,7 +65,7 @@ module.exports = {
6665
rowHeight: 140,
6766
},
6867
})
69-
.catch(function (e) {
68+
.catch((e) => {
7069
console.error(e); // eslint-disable-line no-console
7170
ui.showNotification('search failed', 'error');
7271
});

chemistry/chemcalcSequenceSVG.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
define([
22
'https://www.lactame.com/github/adobe-webplatform/Snap.svg/84fbff7d512c8145c522b71fc9c872cb0bcae49a/dist/snap.svg-min.js',
33
'./sequenceSplitter',
4-
], function (Snap, sequenceSplitter) {
4+
], (snap, sequenceSplitter) => {
55
function getSVG(sequence, analysisResult, options) {
66
const {
77
width = 600,
@@ -24,7 +24,7 @@ define([
2424

2525
let line = 0;
2626
// we create a temporary paper in order to get the width of the text blocs
27-
let tempPaper = Snap(1000, 40);
27+
let tempPaper = snap(1000, 40);
2828
for (let i = 0; i < mfParts.length; i++) {
2929
let part = mfParts[i];
3030
let text = tempPaper.text(xPos, 20, part);
@@ -130,11 +130,11 @@ define([
130130
rowHeight * (line + 1) + 50 + verticalShiftForTerminalAnnotations;
131131

132132
// We start to create the SVG and create the paper
133-
let paper = Snap(width, height);
133+
let paper = snap(width, height);
134134

135135
addScript(paper);
136136

137-
residues.forEach(function (residue) {
137+
residues.forEach((residue) => {
138138
residue.y = (residue.line + 1) * rowHeight;
139139
let text = paper.text(residue.xFrom, residue.y, residue.label);
140140
text.attr({ id: `residue-${residue.nTer}` });
@@ -163,7 +163,7 @@ define([
163163
let used = {};
164164
for (let i = from; i < to; i++) {
165165
let residue = residues[i];
166-
residue.usedSlots.forEach(function (usedSlot, index) {
166+
residue.usedSlots.forEach((usedSlot, index) => {
167167
used[index] = true;
168168
});
169169
}
@@ -182,7 +182,7 @@ define([
182182

183183
function drawTerminals() {
184184
for (let result of results) {
185-
var residue;
185+
let residue;
186186
let nTerminal = false;
187187
if (result.fromNTerm) {
188188
residue = residues[result.to];
@@ -267,7 +267,7 @@ define([
267267
// var charge = result.charge > 0 ? '+' + result.charge : result.charge;
268268
// var label = result.type + ' (' + charge + ', ' + Math.round(result.similarity) + '%)';
269269
// we need to check on how many lines we are
270-
var fromX, toX, y;
270+
let fromX, toX, y;
271271
for (let line = fromResidue.line; line <= toResidue.line; line++) {
272272
y =
273273
-10 -

chemistry/orbitals.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
define([
22
'https://www.lactame.com/github/adobe-webplatform/Snap.svg/84fbff7d512c8145c522b71fc9c872cb0bcae49a/dist/snap.svg-min.js',
3-
], function (Snap) {
3+
], (snap) => {
44
let exports = {};
55

66
let defaultOptions = {
@@ -133,7 +133,7 @@ define([
133133
}
134134

135135
svgModifier = [];
136-
paper = Snap(width, height);
136+
paper = snap(width, height);
137137

138138
paper
139139
.path('M 0 0 L 10 4 L 0 8 z')
@@ -216,7 +216,7 @@ define([
216216

217217
function parseelConfig(elConfig) {
218218
elConfig = elConfig.split(' ');
219-
elConfig = elConfig.map(function (o) {
219+
elConfig = elConfig.map((o) => {
220220
let m = o.match(/^(\d\w)(\d+)/);
221221
return {
222222
layer: m[1],
@@ -282,11 +282,11 @@ define([
282282
return Math.floor(electron / num) === 0 ? 1 : -1;
283283
}
284284

285-
exports.getSvg = function (...args) {
285+
exports.getSvg = function getSvg(...args) {
286286
createSvg(args);
287287
return svg;
288288
};
289-
exports.getSvgAndModifier = function (...args) {
289+
exports.getSvgAndModifier = function getSvgAndModifier(...args) {
290290
createSvg(args);
291291
return { svg, svgModifier };
292292
};

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,

0 commit comments

Comments
 (0)