Some eslint fixes

This commit is contained in:
David Carley
2022-09-05 10:30:42 +00:00
parent cae5ccd7b7
commit 135b46df23
17 changed files with 36 additions and 36 deletions

View File

@@ -15,7 +15,7 @@ const variant_defaults = {
module.exports = { module.exports = {
template: "#admin-general-view-template", template: "#admin-general-view-template",
props: ["config", "state"], props: [ "config", "state" ],
data: function () { data: function () {
return { return {

View File

@@ -101,7 +101,7 @@ module.exports = new Vue({
template: require("../resources/config-template.json"), template: require("../resources/config-template.json"),
config: { config: {
settings: { units: "METRIC" }, settings: { units: "METRIC" },
motors: [{}, {}, {}, {}], motors: [ {}, {}, {}, {} ],
version: "<loading>", version: "<loading>",
full_version: "<loading>", full_version: "<loading>",
}, },

View File

@@ -2,7 +2,7 @@
module.exports = { module.exports = {
template: "#axis-control-template", template: "#axis-control-template",
props: ["axes", "colors", "enabled", "adjust", "step"], props: [ "axes", "colors", "enabled", "adjust", "step" ],
methods: { methods: {
jog: function (axis, ring, direction) { jog: function (axis, ring, direction) {
@@ -21,11 +21,11 @@ module.exports = {
}, },
value: function (ring) { value: function (ring) {
const adjust = [0.01, 0.1, 1][this.adjust]; const adjust = [ 0.01, 0.1, 1 ][this.adjust];
if (this.step) { 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) { text: function (ring) {

View File

@@ -1,7 +1,7 @@
"use strict"; "use strict";
module.exports = { module.exports = {
props: ["state", "config"], props: [ "state", "config" ],
computed: { computed: {
metric: function () { metric: function () {

View File

@@ -4,7 +4,7 @@ function _msg_equal(a, b) {
return a.level == b.level return a.level == b.level
&& a.source == b.source && a.source == b.source
&& a.where == b.where && a.where == b.where
&&a.msg == b.msg; && a.msg == b.msg;
} }
// Shared among all instances // Shared among all instances

View File

@@ -6,7 +6,7 @@ const cookie = require("./cookie")("bbctrl-");
module.exports = { module.exports = {
template: "#control-view-template", template: "#control-view-template",
props: ["config", "template", "state"], props: [ "config", "template", "state" ],
data: function () { data: function () {
return { return {
@@ -245,7 +245,7 @@ module.exports = {
const weight = `font-weight:${this.jog_incr === value ? "bold" : "normal"}`; const weight = `font-weight:${this.jog_incr === value ? "bold" : "normal"}`;
const color = this.jog_incr === value ? "color:#0078e7" : ""; 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) { jog_fn: function (x_jog, y_jog, z_jog, a_jog) {
@@ -342,7 +342,7 @@ module.exports = {
utils.clickFileInput("gcode-file-input"); utils.clickFileInput("gcode-file-input");
}, },
upload: async function (e) { upload: function (e) {
const files = e.target.files || e.dataTransfer.files; const files = e.target.files || e.dataTransfer.files;
if (!files.length) { if (!files.length) {
return; return;
@@ -495,5 +495,5 @@ module.exports = {
} }
}, },
mixins: [require("./axis-vars")] mixins: [ require("./axis-vars") ]
}; };

View File

@@ -2,7 +2,7 @@
const entityMap = { const entityMap = {
"&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;", "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;",
"/": "&#x2F;", "`": "&#x60;", "=": "&#x3D;"}; "/": "&#x2F;", "`": "&#x60;", "=": "&#x3D;" };
function escapeHTML(s) { function escapeHTML(s) {
return s.replace(/[&<>"'`=\\/]/g, function (c) { return s.replace(/[&<>"'`=\\/]/g, function (c) {
@@ -42,7 +42,7 @@ module.exports = {
scrollElem: this.$el.querySelector(".clusterize-scroll"), scrollElem: this.$el.querySelector(".clusterize-scroll"),
contentElem: this.$el.querySelector(".clusterize-content"), contentElem: this.$el.querySelector(".clusterize-content"),
no_data_text: "GCode view...", no_data_text: "GCode view...",
callbacks: {clusterChanged: this.highlight} callbacks: { clusterChanged: this.highlight }
}); });
}, },
@@ -69,7 +69,7 @@ module.exports = {
const text = await response.text(); const text = await response.text();
if (text.length > 20e6) { if (text.length > 20e6) {
this.clusterize.update(["File is large - gcode view disabled"]); this.clusterize.update([ "File is large - gcode view disabled" ]);
} else { } else {
const lines = escapeHTML(text.trimRight()) const lines = escapeHTML(text.trimRight())
.split(/[\r\n]/) .split(/[\r\n]/)
@@ -113,7 +113,7 @@ module.exports = {
line.className = (line.className || "") line.className = (line.className || "")
.split(" ") .split(" ")
.filter(c => c !== "highlight") .filter(c => c !== "highlight")
.concat(["highlight"]) .concat([ "highlight" ])
.join(" "); .join(" ");
} }
}, },

View File

@@ -4,7 +4,7 @@ const modbus = require("./modbus.js");
module.exports = { module.exports = {
template: "#indicators-template", template: "#indicators-template",
props: ["state"], props: [ "state" ],
computed: { computed: {
modbus_status: function () { modbus_status: function () {

View File

@@ -2,7 +2,7 @@
module.exports = { module.exports = {
template: "#io-indicator-template", template: "#io-indicator-template",
props: ["name", "state"], props: [ "name", "state" ],
computed: { computed: {
klass: function () { klass: function () {

View File

@@ -2,7 +2,7 @@
module.exports = { module.exports = {
template: "#io-view-template", template: "#io-view-template",
props: ["config", "template", "state"], props: [ "config", "template", "state" ],
events: { events: {
"input-changed": function() { "input-changed": function() {

View File

@@ -3,7 +3,7 @@
module.exports = { module.exports = {
replace: true, replace: true,
template: "#modbus-reg-view-template", template: "#modbus-reg-view-template",
props: ["index", "model", "template", "enable"], props: [ "index", "model", "template", "enable" ],
computed: { computed: {
has_user_value: function () { has_user_value: function () {

View File

@@ -2,7 +2,7 @@
module.exports = { module.exports = {
template: "#motor-view-template", template: "#motor-view-template",
props: ["index", "config", "template", "state"], props: [ "index", "config", "template", "state" ],
computed: { computed: {
metric: function () { metric: function () {

View File

@@ -22,9 +22,9 @@ const OrbitControls = function (object, domElement) {
// eslint-disable-next-line @typescript-eslint/no-this-alias // eslint-disable-next-line @typescript-eslint/no-this-alias
const scope = this; const scope = this;
const changeEvent = {type: "change"}; const changeEvent = { type: "change" };
const startEvent = {type: "start"}; const startEvent = { type: "start" };
const endEvent = {type: "end"}; const endEvent = { type: "end" };
const STATE = { const STATE = {
NONE: -1, ROTATE: 0, DOLLY: 1, PAN: 2, TOUCH_ROTATE: 3, TOUCH_DOLLY_PAN: 4 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; this.enableKeys = true;
// The four arrow keys // 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 // Mouse buttons
this.mouseButtons = { this.mouseButtons = {

View File

@@ -6,7 +6,7 @@ const font = require("./helvetiker_regular.typeface.json");
module.exports = { module.exports = {
template: "#path-viewer-template", template: "#path-viewer-template",
props: ["toolpath"], props: [ "toolpath" ],
data: function () { data: function () {
return { return {
@@ -128,7 +128,7 @@ module.exports = {
return new Float32Array(arrayBuffer); 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}/positions`),
get(`/api/path/${this.toolpath.filename}/speeds`) get(`/api/path/${this.toolpath.filename}/speeds`)
]); ]);
@@ -275,7 +275,7 @@ module.exports = {
try { try {
// Renderer // 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.setPixelRatio(window.devicePixelRatio);
this.renderer.setClearColor(0, 0); this.renderer.setClearColor(0, 0);
this.target.appendChild(this.renderer.domElement); this.target.appendChild(this.renderer.domElement);
@@ -502,7 +502,7 @@ module.exports = {
get_color: function (speed) { get_color: function (speed) {
if (isNaN(speed)) { if (isNaN(speed)) {
return [255, 0, 0]; return [ 255, 0, 0 ];
} // Rapid } // Rapid
let intensity = speed / this.toolpath.maxSpeed; let intensity = speed / this.toolpath.maxSpeed;
@@ -510,7 +510,7 @@ module.exports = {
intensity = 1; intensity = 1;
} }
return [0, 255 * intensity, 127 * (1 - intensity)]; return [ 0, 255 * intensity, 127 * (1 - intensity) ];
}, },
draw_path: function (scene) { draw_path: function (scene) {
@@ -595,7 +595,7 @@ module.exports = {
draw_bbox: function (scene, bbox) { draw_bbox: function (scene, bbox) {
const geometry = this.create_bbox_geom(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); const line = new THREE.LineSegments(geometry, material);
line.visible = this.showBBox; line.visible = this.showBBox;
@@ -607,7 +607,7 @@ module.exports = {
draw_envelope: function (scene) { draw_envelope: function (scene) {
const geometry = this.create_empty_geom(); 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); const line = new THREE.LineSegments(geometry, material);
line.visible = this.showBBox; line.visible = this.showBBox;
@@ -769,5 +769,5 @@ module.exports = {
} }
}, },
mixins: [require("./axis-vars")] mixins: [ require("./axis-vars") ]
}; };

View File

@@ -3,7 +3,7 @@
module.exports = { module.exports = {
replace: true, replace: true,
template: "#templated-input-template", template: "#templated-input-template",
props: ["name", "model", "template"], props: [ "name", "model", "template" ],
data: function () { data: function () {
return { view: "" }; return { view: "" };

View File

@@ -6,7 +6,7 @@ const merge = require("lodash.merge");
module.exports = { module.exports = {
template: "#tool-view-template", template: "#tool-view-template",
props: ["config", "template", "state"], props: [ "config", "template", "state" ],
data: function () { data: function () {
return { return {

View File

@@ -3,7 +3,7 @@
module.exports = { module.exports = {
replace: true, replace: true,
template: '{{text}}<span class="unit">{{metric ? unit : iunit}}</span>', template: '{{text}}<span class="unit">{{metric ? unit : iunit}}</span>',
props: ["value", "precision", "unit", "iunit", "scale"], props: [ "value", "precision", "unit", "iunit", "scale" ],
computed: { computed: {
metric: { metric: {