From 135b46df23416c772841b84263f9bc8978ea0093 Mon Sep 17 00:00:00 2001 From: David Carley Date: Mon, 5 Sep 2022 10:30:42 +0000 Subject: [PATCH] Some eslint fixes --- src/js/admin-general-view.js | 2 +- src/js/app.js | 2 +- src/js/axis-control.js | 8 ++++---- src/js/axis-vars.js | 2 +- src/js/console.js | 2 +- src/js/control-view.js | 8 ++++---- src/js/gcode-viewer.js | 8 ++++---- src/js/indicators.js | 2 +- src/js/io-indicator.js | 2 +- src/js/io-view.js | 2 +- src/js/modbus-reg.js | 2 +- src/js/motor-view.js | 2 +- src/js/orbit.js | 8 ++++---- src/js/path-viewer.js | 16 ++++++++-------- src/js/templated-input.js | 2 +- src/js/tool-view.js | 2 +- src/js/unit-value.js | 2 +- 17 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/js/admin-general-view.js b/src/js/admin-general-view.js index b639260..dbb219c 100644 --- a/src/js/admin-general-view.js +++ b/src/js/admin-general-view.js @@ -15,7 +15,7 @@ const variant_defaults = { module.exports = { template: "#admin-general-view-template", - props: ["config", "state"], + props: [ "config", "state" ], data: function () { return { diff --git a/src/js/app.js b/src/js/app.js index 65eb143..d9c3da8 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -101,7 +101,7 @@ module.exports = new Vue({ template: require("../resources/config-template.json"), config: { settings: { units: "METRIC" }, - motors: [{}, {}, {}, {}], + motors: [ {}, {}, {}, {} ], version: "", full_version: "", }, diff --git a/src/js/axis-control.js b/src/js/axis-control.js index 34a60b0..100dfcc 100644 --- a/src/js/axis-control.js +++ b/src/js/axis-control.js @@ -2,7 +2,7 @@ module.exports = { template: "#axis-control-template", - props: ["axes", "colors", "enabled", "adjust", "step"], + props: [ "axes", "colors", "enabled", "adjust", "step" ], methods: { jog: function (axis, ring, direction) { @@ -21,11 +21,11 @@ module.exports = { }, value: function (ring) { - const adjust = [0.01, 0.1, 1][this.adjust]; + const adjust = [ 0.01, 0.1, 1 ][this.adjust]; if (this.step) { - return adjust * [0.1, 1, 10, 100][ring]; + return adjust * [ 0.1, 1, 10, 100 ][ring]; } - return adjust * [0.1, 0.25, 0.5, 1][ring]; + return adjust * [ 0.1, 0.25, 0.5, 1 ][ring]; }, text: function (ring) { diff --git a/src/js/axis-vars.js b/src/js/axis-vars.js index 2846782..108edf3 100644 --- a/src/js/axis-vars.js +++ b/src/js/axis-vars.js @@ -1,7 +1,7 @@ "use strict"; module.exports = { - props: ["state", "config"], + props: [ "state", "config" ], computed: { metric: function () { diff --git a/src/js/console.js b/src/js/console.js index 63772f9..84feae2 100644 --- a/src/js/console.js +++ b/src/js/console.js @@ -4,7 +4,7 @@ function _msg_equal(a, b) { return a.level == b.level && a.source == b.source && a.where == b.where - &&a.msg == b.msg; + && a.msg == b.msg; } // Shared among all instances diff --git a/src/js/control-view.js b/src/js/control-view.js index 61079c4..96c1070 100644 --- a/src/js/control-view.js +++ b/src/js/control-view.js @@ -6,7 +6,7 @@ const cookie = require("./cookie")("bbctrl-"); module.exports = { template: "#control-view-template", - props: ["config", "template", "state"], + props: [ "config", "template", "state" ], data: function () { return { @@ -245,7 +245,7 @@ module.exports = { const weight = `font-weight:${this.jog_incr === value ? "bold" : "normal"}`; const color = this.jog_incr === value ? "color:#0078e7" : ""; - return [weight, color].join(";"); + return [ weight, color ].join(";"); }, jog_fn: function (x_jog, y_jog, z_jog, a_jog) { @@ -342,7 +342,7 @@ module.exports = { utils.clickFileInput("gcode-file-input"); }, - upload: async function (e) { + upload: function (e) { const files = e.target.files || e.dataTransfer.files; if (!files.length) { return; @@ -495,5 +495,5 @@ module.exports = { } }, - mixins: [require("./axis-vars")] + mixins: [ require("./axis-vars") ] }; diff --git a/src/js/gcode-viewer.js b/src/js/gcode-viewer.js index dd50e57..db11b33 100644 --- a/src/js/gcode-viewer.js +++ b/src/js/gcode-viewer.js @@ -2,7 +2,7 @@ const entityMap = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'", - "/": "/", "`": "`", "=": "="}; + "/": "/", "`": "`", "=": "=" }; function escapeHTML(s) { return s.replace(/[&<>"'`=\\/]/g, function (c) { @@ -42,7 +42,7 @@ module.exports = { scrollElem: this.$el.querySelector(".clusterize-scroll"), contentElem: this.$el.querySelector(".clusterize-content"), no_data_text: "GCode view...", - callbacks: {clusterChanged: this.highlight} + callbacks: { clusterChanged: this.highlight } }); }, @@ -69,7 +69,7 @@ module.exports = { const text = await response.text(); if (text.length > 20e6) { - this.clusterize.update(["File is large - gcode view disabled"]); + this.clusterize.update([ "File is large - gcode view disabled" ]); } else { const lines = escapeHTML(text.trimRight()) .split(/[\r\n]/) @@ -113,7 +113,7 @@ module.exports = { line.className = (line.className || "") .split(" ") .filter(c => c !== "highlight") - .concat(["highlight"]) + .concat([ "highlight" ]) .join(" "); } }, diff --git a/src/js/indicators.js b/src/js/indicators.js index e19a1c6..439776e 100644 --- a/src/js/indicators.js +++ b/src/js/indicators.js @@ -4,7 +4,7 @@ const modbus = require("./modbus.js"); module.exports = { template: "#indicators-template", - props: ["state"], + props: [ "state" ], computed: { modbus_status: function () { diff --git a/src/js/io-indicator.js b/src/js/io-indicator.js index 5385e1d..fcd31a3 100644 --- a/src/js/io-indicator.js +++ b/src/js/io-indicator.js @@ -2,7 +2,7 @@ module.exports = { template: "#io-indicator-template", - props: ["name", "state"], + props: [ "name", "state" ], computed: { klass: function () { diff --git a/src/js/io-view.js b/src/js/io-view.js index 97d8b46..4d2679b 100644 --- a/src/js/io-view.js +++ b/src/js/io-view.js @@ -2,7 +2,7 @@ module.exports = { template: "#io-view-template", - props: ["config", "template", "state"], + props: [ "config", "template", "state" ], events: { "input-changed": function() { diff --git a/src/js/modbus-reg.js b/src/js/modbus-reg.js index 288166b..9595006 100644 --- a/src/js/modbus-reg.js +++ b/src/js/modbus-reg.js @@ -3,7 +3,7 @@ module.exports = { replace: true, template: "#modbus-reg-view-template", - props: ["index", "model", "template", "enable"], + props: [ "index", "model", "template", "enable" ], computed: { has_user_value: function () { diff --git a/src/js/motor-view.js b/src/js/motor-view.js index ab1e2b3..3185f6e 100644 --- a/src/js/motor-view.js +++ b/src/js/motor-view.js @@ -2,7 +2,7 @@ module.exports = { template: "#motor-view-template", - props: ["index", "config", "template", "state"], + props: [ "index", "config", "template", "state" ], computed: { metric: function () { diff --git a/src/js/orbit.js b/src/js/orbit.js index 88cbeb9..ae47cf6 100644 --- a/src/js/orbit.js +++ b/src/js/orbit.js @@ -22,9 +22,9 @@ const OrbitControls = function (object, domElement) { // eslint-disable-next-line @typescript-eslint/no-this-alias const scope = this; - const changeEvent = {type: "change"}; - const startEvent = {type: "start"}; - const endEvent = {type: "end"}; + const changeEvent = { type: "change" }; + const startEvent = { type: "start" }; + const endEvent = { type: "end" }; const STATE = { NONE: -1, ROTATE: 0, DOLLY: 1, PAN: 2, TOUCH_ROTATE: 3, TOUCH_DOLLY_PAN: 4 @@ -106,7 +106,7 @@ const OrbitControls = function (object, domElement) { this.enableKeys = true; // The four arrow keys - this.keys = {LEFT: 37, UP: 38, RIGHT: 39, BOTTOM: 40}; + this.keys = { LEFT: 37, UP: 38, RIGHT: 39, BOTTOM: 40 }; // Mouse buttons this.mouseButtons = { diff --git a/src/js/path-viewer.js b/src/js/path-viewer.js index 4fdeaba..bff6bab 100644 --- a/src/js/path-viewer.js +++ b/src/js/path-viewer.js @@ -6,7 +6,7 @@ const font = require("./helvetiker_regular.typeface.json"); module.exports = { template: "#path-viewer-template", - props: ["toolpath"], + props: [ "toolpath" ], data: function () { return { @@ -128,7 +128,7 @@ module.exports = { return new Float32Array(arrayBuffer); } - const [positions, speeds] = await Promise.all([ + const [ positions, speeds ] = await Promise.all([ get(`/api/path/${this.toolpath.filename}/positions`), get(`/api/path/${this.toolpath.filename}/speeds`) ]); @@ -275,7 +275,7 @@ module.exports = { try { // Renderer - this.renderer = new THREE.WebGLRenderer({antialias: true, alpha: true}); + this.renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true }); this.renderer.setPixelRatio(window.devicePixelRatio); this.renderer.setClearColor(0, 0); this.target.appendChild(this.renderer.domElement); @@ -502,7 +502,7 @@ module.exports = { get_color: function (speed) { if (isNaN(speed)) { - return [255, 0, 0]; + return [ 255, 0, 0 ]; } // Rapid let intensity = speed / this.toolpath.maxSpeed; @@ -510,7 +510,7 @@ module.exports = { intensity = 1; } - return [0, 255 * intensity, 127 * (1 - intensity)]; + return [ 0, 255 * intensity, 127 * (1 - intensity) ]; }, draw_path: function (scene) { @@ -595,7 +595,7 @@ module.exports = { draw_bbox: function (scene, bbox) { const geometry = this.create_bbox_geom(bbox); - const material = new THREE.LineBasicMaterial({color: 0xffffff}); + const material = new THREE.LineBasicMaterial({ color: 0xffffff }); const line = new THREE.LineSegments(geometry, material); line.visible = this.showBBox; @@ -607,7 +607,7 @@ module.exports = { draw_envelope: function (scene) { const geometry = this.create_empty_geom(); - const material = new THREE.LineBasicMaterial({color: 0x00f7ff}); + const material = new THREE.LineBasicMaterial({ color: 0x00f7ff }); const line = new THREE.LineSegments(geometry, material); line.visible = this.showBBox; @@ -769,5 +769,5 @@ module.exports = { } }, - mixins: [require("./axis-vars")] + mixins: [ require("./axis-vars") ] }; diff --git a/src/js/templated-input.js b/src/js/templated-input.js index 801174d..327701c 100644 --- a/src/js/templated-input.js +++ b/src/js/templated-input.js @@ -3,7 +3,7 @@ module.exports = { replace: true, template: "#templated-input-template", - props: ["name", "model", "template"], + props: [ "name", "model", "template" ], data: function () { return { view: "" }; diff --git a/src/js/tool-view.js b/src/js/tool-view.js index 6d7e8df..cc49e6b 100644 --- a/src/js/tool-view.js +++ b/src/js/tool-view.js @@ -6,7 +6,7 @@ const merge = require("lodash.merge"); module.exports = { template: "#tool-view-template", - props: ["config", "template", "state"], + props: [ "config", "template", "state" ], data: function () { return { diff --git a/src/js/unit-value.js b/src/js/unit-value.js index 72ec6ac..ff7149f 100644 --- a/src/js/unit-value.js +++ b/src/js/unit-value.js @@ -3,7 +3,7 @@ module.exports = { replace: true, template: '{{text}}{{metric ? unit : iunit}}', - props: ["value", "precision", "unit", "iunit", "scale"], + props: [ "value", "precision", "unit", "iunit", "scale" ], computed: { metric: {