Skip to content

Commit d42b785

Browse files
committed
Fix style according to eslint with activated airbnb style
1 parent 8e298cd commit d42b785

File tree

21 files changed

+524
-550
lines changed

21 files changed

+524
-550
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Setup Node
1919
uses: actions/setup-node@v1
2020
with:
21-
node-version: '18.13.0'
21+
node-version: '18'
2222

2323
- name: npm install, build
2424
env:

viplab-standalone-frontend-vue/.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@
2121
"vue"
2222
],
2323
"rules": {
24+
"max-len" :"off"
2425
}
2526
}

viplab-standalone-frontend-vue/src/App.vue

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
<script>
3737
import base64url from 'base64url';
3838
39+
// eslint-disable-next-line global-require
3940
global.Buffer = global.Buffer || require('buffer').Buffer;
4041
// const Base64 = require('js-base64');
4142
@@ -109,15 +110,11 @@ export default {
109110
// this.token = appDiv.getAttribute("data-token");
110111
111112
// if there are parameters in parts, set var accordingly for rendering of button
112-
for (const file in this.json.files) {
113-
for (const part in this.json.files[file].parts) {
114-
const parti = this.json.files[file].parts[part];
115-
if (parti.access == 'template' && parti.parameters) {
116-
this.isPartParameters++;
117-
break;
118-
}
113+
Object.values(this.json.files).forEach((file) => {
114+
if (Object.values(file.parts).find((part) => part.access === 'template' && part.parameters)) {
115+
this.isPartParameters += 1;
119116
}
120-
}
117+
});
121118
},
122119
},
123120
created() {

viplab-standalone-frontend-vue/src/components/AnsiOutput.vue

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ export default {
3333
};
3434
},
3535
watch: {
36-
content(concat_content, old_content) {
37-
if (concat_content === '') {
36+
content(concatContent, oldContent) {
37+
if (concatContent === '') {
3838
// should never come to that branch; instead component is mounted again
3939
// when content resets
4040
console.log('Clearing out content of ansioutput');
4141
this.lines = [];
4242
} else {
43-
const new_content = concat_content.substring(old_content.length);
44-
this.renderContent(new_content);
43+
const newContent = concatContent.substring(oldContent.length);
44+
this.renderContent(newContent);
4545
}
4646
},
4747
},
@@ -51,6 +51,7 @@ export default {
5151
this.$el.scrollTop = this.$el.scrollHeight
5252
}, */
5353
beforeMount() {
54+
// eslint-disable-next-line new-cap
5455
this.ansi = new AU.default();
5556
},
5657
mounted() {
@@ -60,12 +61,12 @@ export default {
6061
methods: {
6162
renderContent(content) {
6263
// console.log(this.lines.length);
63-
const new_lines = content.split(/\r?\n/);
64-
for (const line_idx in new_lines) {
64+
const newLines = content.split(/\r?\n/);
65+
Object.values(newLines).forEach((newLine) => {
6566
this.lines.push(`${this.ansi.ansi_to_html(
66-
new_lines[line_idx],
67+
newLine,
6768
)}<br/>`);
68-
}
69+
});
6970
},
7071
},
7172
};

viplab-standalone-frontend-vue/src/components/CheckBox.vue

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ extend('required', {
3434
3535
extend('checkboxOneOf', (value) => {
3636
// console.log("checkbox oneof " + value);
37-
if (value.length > 0 && value.length == 1) {
37+
if (value.length > 0 && value.length === 1) {
3838
return true;
3939
}
4040
return 'Only choose one!';
@@ -68,16 +68,10 @@ export default {
6868
},
6969
},
7070
onlyone() {
71-
if (this.checkbox.validation === 'onlyone') {
72-
return true;
73-
}
74-
return false;
71+
return this.checkbox.validation === 'onlyone';
7572
},
7673
minone() {
77-
if (this.checkbox.validation === 'minone') {
78-
return true;
79-
}
80-
return false;
74+
return this.checkbox.validation === 'minone';
8175
},
8276
},
8377
data() {

viplab-standalone-frontend-vue/src/components/DropDown.vue

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,10 @@ export default {
9494
},
9595
},
9696
onlyone() {
97-
if (this.dropitem.validation === 'onlyone') {
98-
return true;
99-
}
100-
return false;
97+
return this.dropitem.validation === 'onlyone';
10198
},
10299
minone() {
103-
if (this.dropitem.validation === 'minone') {
104-
return true;
105-
}
106-
return false;
100+
return this.dropitem.validation === 'minone';
107101
},
108102
},
109103
data() {
@@ -115,7 +109,7 @@ export default {
115109
/** get all values of an item that are not disabled */
116110
itemWithoutDisabled(item) {
117111
const array = [];
118-
for (let i = 0; i < item.options.length; i++) {
112+
for (let i = 0; i < item.options.length; i += 1) {
119113
if (!item.options[i].disabled) {
120114
array.push(item.options[i]);
121115
}
@@ -124,7 +118,7 @@ export default {
124118
},
125119
itemsDisabled(item) {
126120
const array = [];
127-
for (let i = 0; i < item.options.length; i++) {
121+
for (let i = 0; i < item.options.length; i += 1) {
128122
if (item.options[i].disabled) {
129123
array.push(item.options[i]);
130124
}

viplab-standalone-frontend-vue/src/components/Parameters.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export default {
6464
InputField,
6565
AceEditorComponent,
6666
},
67+
// eslint-disable-next-line vue/multi-word-component-names
6768
name: 'Parameters',
6869
props: {
6970
parameters: Array,

viplab-standalone-frontend-vue/src/components/ToggleButton.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ extend('required', {
2525
2626
extend('toggleOneOf', (value) => {
2727
// console.log("toggle oneof " + value);
28-
if (value.length > 0 && value.length == 1) {
28+
if (value.length > 0 && value.length === 1) {
2929
return true;
3030
}
3131
return 'Only choose one!';

viplab-standalone-frontend-vue/src/components/csv-plots/CsvPlot.vue

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,11 @@ export default {
109109
// map the row-values to the header to create header:value type entries
110110
const data = rows.map((row) => {
111111
const values = row.split(delimiter);
112-
const element = headers.reduce((object, header, index) => {
113-
object[header] = values[index];
114-
return object;
112+
return headers.reduce((object, header, index) => {
113+
const newObject = object;
114+
newObject[header] = values[index];
115+
return newObject;
115116
}, {});
116-
return element;
117117
});
118118
this.processData(data);
119119
},
@@ -123,9 +123,9 @@ export default {
123123
// create an object, where there is an array for each column name
124124
const obj = [];
125125
const keys = Object.keys(data[0]);
126-
keys.forEach((element) => obj[element] = []);
126+
keys.forEach((element) => { obj[element] = []; });
127127
// fill the object with the data depending on the keys (column names)
128-
for (let i = 0; i < data.length; i++) {
128+
for (let i = 0; i < data.length; i *= 1) {
129129
const row = data[i];
130130
keys.forEach((element) => obj[element].push(row[element]));
131131
}
@@ -139,28 +139,28 @@ export default {
139139
140140
// multiply x-axis by factor if given
141141
if (this.labelProp.factor !== undefined) {
142-
for (let j = 0; j < obj[(xkey)].length; j++) {
143-
obj[(xkey)][j] = obj[(xkey)][j] * this.labelProp.factor;
142+
for (let j = 0; j < obj[(xkey)].length; j += 1) {
143+
obj[(xkey)][j] *= this.labelProp.factor;
144144
}
145145
}
146-
const xkey_ind = keys.indexOf(xkey);
147-
if (xkey_ind > -1) {
148-
keys.splice(xkey_ind, 1);
146+
const xKeyIndex = keys.indexOf(xkey);
147+
if (xKeyIndex > -1) {
148+
keys.splice(xKeyIndex, 1);
149149
}
150150
// create traces to be rendered later; the first column is always x; the others are ys
151-
for (let k = 0; k < keys.length; k++) {
151+
for (let k = 0; k < keys.length; k += 1) {
152152
if (this.datasetProp.key) {
153153
// multiply y-axis by factor if given
154154
if (keys[k] === this.datasetProp.key || this.datasetProp.key.includes(keys[k])) {
155155
if (this.datasetProp.factor !== undefined) {
156-
for (let j = 0; j < obj[(xkey)].length; j++) {
157-
obj[(keys[k])][j] = obj[(keys[k])][j] * this.datasetProp.factor;
156+
for (let j = 0; j < obj[(xkey)].length; j += 1) {
157+
obj[(keys[k])][j] *= this.datasetProp.factor;
158158
}
159159
}
160160
const trace = {
161161
x: obj[(xkey)],
162162
y: obj[(keys[k])],
163-
name: (typeof this.datasetProp.key == 'string') ? this.datasetProp.label : keys[k],
163+
name: (typeof this.datasetProp.key === 'string') ? this.datasetProp.label : keys[k],
164164
};
165165
traces.push(trace);
166166
}
@@ -179,9 +179,9 @@ export default {
179179
let title = 'Graph';
180180
if (this.areUrlsProp) {
181181
let startIndex = this.csvs[this.fileIndex].lastIndexOf('/');
182-
startIndex = (startIndex != -1) ? startIndex : 0;
182+
startIndex = (startIndex !== -1) ? startIndex : 0;
183183
let endIndex = this.csvs[this.fileIndex].lastIndexOf('?');
184-
endIndex = (endIndex != -1) ? endIndex : this.csvs[this.fileIndex].length;
184+
endIndex = (endIndex !== -1) ? endIndex : this.csvs[this.fileIndex].length;
185185
title = this.csvs[this.fileIndex].substring(startIndex + 1, endIndex);
186186
}
187187
Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
export function DataSet(w, h, xmin, xmax, ymin, ymax, time, label) {
2-
this.data = new Array();
1+
export default function DataSet(w, h, xmin, xmax, ymin, ymax, time, label) {
2+
this.data = [];
33
this.width = w;
44
this.height = h;
55
this.xmin = xmin;
@@ -10,57 +10,46 @@ export function DataSet(w, h, xmin, xmax, ymin, ymax, time, label) {
1010
this.label = label;
1111

1212
this.getWidth = function () {
13-
// console.log(this.width);
1413
return this.width;
1514
};
1615

1716
this.getHeight = function () {
18-
// console.log(this.height);
1917
return this.height;
2018
};
2119

2220
this.getData = function () {
23-
// console.log(this.data);
2421
return this.data;
2522
};
2623

2724
this.getXMin = function () {
28-
// console.log(this.xmin);
2925
return this.xmin;
3026
};
3127

3228
this.getXMax = function () {
33-
// console.log(this.xmax);
3429
return this.xmax;
3530
};
3631

3732
this.getYMin = function () {
38-
// console.log(this.xmin);
39-
return this.xmin;
33+
return this.ymin;
4034
};
4135

4236
this.getYMax = function () {
43-
// console.log(this.xmax);
44-
return this.xmax;
37+
return this.ymax;
4538
};
4639

4740
this.getXMin = function () {
48-
// console.log(this.xmin);
4941
return this.xmin;
5042
};
5143

5244
this.getTime = function () {
53-
// console.log(this.time);
5445
return this.time;
5546
};
5647

5748
this.getXMin = function () {
58-
// console.log(this.xmin);
5949
return this.xmin;
6050
};
6151

6252
this.getLabel = function () {
63-
// console.log(this.label);
6453
return this.label;
6554
};
6655
}

viplab-standalone-frontend-vue/src/components/viplab-plots/gridplot/GridPlot.vue

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<script>
1515
import { Plotly } from '@rleys/vue-plotly-basic';
16-
import * as Parser from '../parse.js';
16+
import Parse from '../parse';
1717
1818
export default {
1919
name: 'GridPlot',
@@ -47,17 +47,17 @@ export default {
4747
};
4848
},
4949
mounted() {
50-
const parseTest = new Parser.Parse(this.plotData);
50+
const parseTest = new Parse(this.plotData);
5151
const testJson = parseTest.parseFileToJson();
5252
this.datasetList = parseTest.parseValues(testJson);
5353
this.minColor = parseTest.getMinColor();
5454
this.maxColor = parseTest.getMaxColor();
5555
56-
for (var i = 0; i < this.datasetList[0].getWidth(); i++) {
56+
for (let i = 0; i < this.datasetList[0].getWidth(); i += 1) {
5757
this.xArray.push(this.datasetList[0].getXMin() * 1 + (i * ((this.datasetList[0].getXMax() - this.datasetList[0].getXMin()) / this.datasetList[0].getWidth())));
5858
}
5959
60-
for (i = 0; i < this.datasetList[0].getHeight(); i++) {
60+
for (let i = 0; i < this.datasetList[0].getHeight(); i += 1) {
6161
this.yArray.push(this.datasetList[0].getYMin() * 1 + (i * ((this.datasetList[0].getYMax() - this.datasetList[0].getYMin()) / this.datasetList[0].getHeight())));
6262
}
6363
@@ -102,26 +102,26 @@ export default {
102102
y: this.yArray,
103103
type: 'heatmap',
104104
hoverongaps: false,
105-
xgap: 0.5,
106-
ygap: 0.5,
105+
xgap: 0.5,
106+
ygap: 0.5,
107107
colorscale: [[0, this.minColor[0]], [1, this.maxColor[0]]],
108108
},
109109
];
110110
},
111111
create3dKaestchen() {
112-
const xScatterArray = new Array();
113-
const yScatterArray = new Array();
112+
const xScatterArray = [];
113+
const yScatterArray = [];
114114
115-
for (var j = 0; j < this.datasetList[0].getData()[0].length; j++) {
115+
for (let j = 0; j < this.datasetList[0].getData()[0].length; j += 1) {
116116
Array.prototype.push.apply(xScatterArray, this.xArray);
117117
}
118118
119-
for (j = 0; j < this.datasetList[0].getData().length; j++) {
119+
for (let j = 0; j < this.datasetList[0].getData().length; j += 1) {
120120
Array.prototype.push.apply(yScatterArray, this.yArray);
121121
}
122122
123-
let zScatterArray = new Array();
124-
for (let i = 0; i < this.datasetList[0].getData().length; i++) {
123+
let zScatterArray = [];
124+
for (let i = 0; i < this.datasetList[0].getData().length; i += 1) {
125125
zScatterArray = zScatterArray.concat(this.datasetList[0].getData()[i]);
126126
}
127127
yScatterArray.sort((a, b) => a - b);

0 commit comments

Comments
 (0)