From cb81ce3a89cec6b794d0c5999fabb47f361ab309 Mon Sep 17 00:00:00 2001 From: Erik Huelsmann Date: Sat, 1 Jun 2024 17:23:51 +0200 Subject: [PATCH] cleanup/jslinter suppressions (#8234) * Eliminate unused variable warnings Partially by moving to 'arrow functions'. * Remove airbnb style ruleset; lots of rules need temporary disabling (like 'class-methods-use-this') * Remove untriggered eslint suppressions * Fix shadowed variables * We don't like camelcase, so don't enforce it... * Suppress inner declaration errors for webpack.config.js * Remove unused variable * Remove errors that aren't fine-grained enough (e.g., we accept console in jest scripts) * Enable resolving vue-router * Fix infinite recursion --- UI/__mocks__/dijit/registry.js | 15 +++-- UI/js-src/lsmb/menus/Tree.js | 1 - UI/js-src/lsmb/parts/PartDescription.js | 13 ++-- UI/js-src/lsmb/parts/PartSelector.js | 10 ++-- UI/js-src/lsmb/reports/ComparisonSelector.js | 18 +++--- UI/js-src/lsmb/users/ChangePassword.js | 28 ++++----- UI/js-src/lsmb/webpack.loaderConfig.js | 3 +- UI/package.json | 17 ++---- UI/src/components/ServerUI.js | 1 - UI/src/elements/lsmb-base-input.js | 1 - UI/src/elements/lsmb-button.js | 1 - UI/src/elements/lsmb-date.js | 1 - UI/src/elements/lsmb-dijit.js | 2 - UI/src/elements/lsmb-password.js | 1 - UI/src/elements/lsmb-text.js | 1 - UI/src/i18n.js | 7 +-- UI/src/main-vue.js | 5 +- UI/src/robot-vue.js | 2 - UI/src/router.js | 1 - UI/src/views/LoginPage.machines.js | 4 +- UI/tests/common/i18n.js | 1 - UI/tests/common/jest-setup.js | 5 +- UI/tests/common/mocks/login_handlers.js | 1 - UI/tests/common/mocks/lsmb_elements.js | 3 - UI/tests/common/mocks/server.js | 1 - .../mocks/store_business-types_handlers.js | 1 - .../common/mocks/store_countries_handlers.js | 3 +- .../common/mocks/store_language_handlers.js | 3 +- .../mocks/store_pricegroups_handlers.js | 3 +- .../mocks/store_sessionUser_handlers.js | 9 ++- UI/tests/common/mocks/store_sics_handlers.js | 3 +- .../common/mocks/store_warehouses_handlers.js | 3 +- UI/tests/specs/openapi/database.js | 1 - UI/tests/specs/stores/countries.spec.js | 1 - UI/tests/specs/stores/gifis.spec.js | 1 - UI/webpack.config.js | 11 +--- UI/yarn.lock | 59 ++----------------- 37 files changed, 65 insertions(+), 176 deletions(-) diff --git a/UI/__mocks__/dijit/registry.js b/UI/__mocks__/dijit/registry.js index 8ac945c5ab..e74eef91ad 100644 --- a/UI/__mocks__/dijit/registry.js +++ b/UI/__mocks__/dijit/registry.js @@ -1,4 +1,3 @@ -/* eslint-disable no-shadow */ // Borrowed from dijit/registry to avoid pulling in all Dojo/Dijit const registry = Object.create(null); @@ -6,12 +5,12 @@ const registry = Object.create(null); function findWidgets(root, skipNode) { var outAry = []; - function getChildrenHelper(root){ - for(var node = root.firstChild; node; node = node.nextSibling){ - if(node.getAttribute && node.getAttribute("widgetid")){ - outAry.push(node); - }else if(node !== skipNode){ - getChildrenHelper(node); + function getChildrenHelper (node) { + for(var el = node.firstChild; el; el = el.nextSibling){ + if(el.getAttribute && el.getAttribute("widgetid")){ + outAry.push(el); + }else if(el !== skipNode){ + getChildrenHelper(el); } } } @@ -22,4 +21,4 @@ function findWidgets(root, skipNode) { registry.findWidgets = findWidgets; -module.exports = registry; \ No newline at end of file +module.exports = registry; diff --git a/UI/js-src/lsmb/menus/Tree.js b/UI/js-src/lsmb/menus/Tree.js index 6e24db9bf1..d01aae99f0 100644 --- a/UI/js-src/lsmb/menus/Tree.js +++ b/UI/js-src/lsmb/menus/Tree.js @@ -61,7 +61,6 @@ define([ complete = true; } }, - // eslint-disable-next-line no-unused-vars getRoot: function (onItem, onError) { onItem({ id: 0 }); } diff --git a/UI/js-src/lsmb/parts/PartDescription.js b/UI/js-src/lsmb/parts/PartDescription.js index a606c995fd..8c1f555189 100644 --- a/UI/js-src/lsmb/parts/PartDescription.js +++ b/UI/js-src/lsmb/parts/PartDescription.js @@ -30,7 +30,6 @@ define([ channel: null, height: null, store: partRestStore, - /* eslint no-template-curly-in-string:0 */ queryExpr: "*${0}*", autoComplete: false, highlightMatch: "all", @@ -40,18 +39,16 @@ define([ dropDownClass: _ComboBoxMenu, autoSizing: true, startup: function () { - var self = this; this.inherited(arguments); if (this.channel) { this.own( - topic.subscribe(this.channel, function (selected) { - self.set("value", selected[self.searchAttr]); + topic.subscribe(this.channel, (selected) => { + this.set("value", selected[this.searchAttr]); }) ); - // eslint-disable-next-line no-unused-vars - this.on("change", function (newValue) { - if (self.item) { - topic.publish(self.channel, self.item); + this.on("change", () => { + if (this.item) { + topic.publish(this.channel, this.item); } }); } diff --git a/UI/js-src/lsmb/parts/PartSelector.js b/UI/js-src/lsmb/parts/PartSelector.js index d8b5e9d0a7..1fcf8c2ff7 100644 --- a/UI/js-src/lsmb/parts/PartSelector.js +++ b/UI/js-src/lsmb/parts/PartSelector.js @@ -24,17 +24,15 @@ define([ this.initialValue = arguments[0].value; }, startup: function () { - var self = this; this.inherited(arguments); if (this.channel) { this.own( - topic.subscribe(this.channel, function (selected) { - self.set("value", selected[self.searchAttr]); + topic.subscribe(this.channel, (selected) => { + this.set("value", selected[this.searchAttr]); }) ); - // eslint-disable-next-line no-unused-vars - this.on("change", function (newValue) { - topic.publish(self.channel, self.item); + this.on("change", () => { + topic.publish(this.channel, this.item); }); } } diff --git a/UI/js-src/lsmb/reports/ComparisonSelector.js b/UI/js-src/lsmb/reports/ComparisonSelector.js index b1f6aea8ed..842ea8eca1 100644 --- a/UI/js-src/lsmb/reports/ComparisonSelector.js +++ b/UI/js-src/lsmb/reports/ComparisonSelector.js @@ -26,33 +26,29 @@ define([ channel: "", mode: "by-dates", postCreate: function () { - var self = this; this.inherited(arguments); this.own( - topic.subscribe(this.channel, function (action, value) { + topic.subscribe(this.channel, (action, value) => { var display = ""; if (action === "changed-period-type") { - self.mode = value; + this.mode = value; if (value === "by-dates") { - display = self._comparison_periods.get("value"); + display = this._comparison_periods.get("value"); } } - self._update_display(display); + this._update_display(display); }) ); }, startup: function () { - var self = this; - this.inherited(arguments); this._comparison_periods = registry.byId("comparison-periods"); this.own( - // eslint-disable-next-line no-unused-vars - on(this._comparison_periods, "change", function (newvalue) { - self._update_display( - self._comparison_periods.get("value") + on(this._comparison_periods, "change", () => { + this._update_display( + this._comparison_periods.get("value") ); }) ); diff --git a/UI/js-src/lsmb/users/ChangePassword.js b/UI/js-src/lsmb/users/ChangePassword.js index 31749149c7..f1741761da 100644 --- a/UI/js-src/lsmb/users/ChangePassword.js +++ b/UI/js-src/lsmb/users/ChangePassword.js @@ -43,7 +43,6 @@ define([ return this.lstrings[toTranslate]; }, startup: function () { - // eslint-disable-next-line guard-for-in for (var str in this._lstrings) { if (this.lstrings[str]) { continue; @@ -106,7 +105,6 @@ define([ nonWords: /\W/.test(pass) }; var variationCount = 0; - // eslint-disable-next-line guard-for-in for (var check in variations) { variationCount += variations[check] === true ? 1 : 0; } @@ -128,17 +126,16 @@ define([ domAttr.set("pw-strength", "innerHTML", score); }, submitForm: function () { - var I = this; var r = request; - var oldPassword = I.oldpw.get("value"); - var newPassword = I.newpw.get("value"); - var confirmedPassword = I.verified.get("value"); + var oldPassword = this.oldpw.get("value"); + var newPassword = this.newpw.get("value"); + var confirmedPassword = this.verified.get("value"); if (oldPassword === "" || newPassword === "") { - I.setFeedback(false, I.text("Password Required")); + this.setFeedback(false, this.text("Password Required")); return; } if (newPassword !== confirmedPassword) { - I.setFeedback(false, I.text("Confirmation did not match")); + this.setFeedback(false, this.text("Confirmation did not match")); return; } r("user.pl", { @@ -150,21 +147,20 @@ define([ }, method: "POST" }) - // eslint-disable-next-line no-unused-vars - .then(function (response) { - I.setFeedback(true, I.text("Password Changed")); + .then(() => { + this.setFeedback(true, this.text("Password Changed")); }) - .otherwise(function (err) { + .otherwise((err) => { if (err.response.status !== 200) { if (err.response.status !== 500) { - I.setFeedback( + this.setFeedback( false, - I.text("Bad username/Password") + this.text("Bad username/Password") ); } else { - I.setFeedback( + this.setFeedback( false, - I.text("Error changing password.") + this.text("Error changing password.") ); } } diff --git a/UI/js-src/lsmb/webpack.loaderConfig.js b/UI/js-src/lsmb/webpack.loaderConfig.js index f6d7148db1..a6e7f5a8e5 100644 --- a/UI/js-src/lsmb/webpack.loaderConfig.js +++ b/UI/js-src/lsmb/webpack.loaderConfig.js @@ -17,8 +17,7 @@ */ const path = require("path"); -// eslint-disable-next-line no-unused-vars -function getConfig(env) { +function getConfig( /* env */ ) { // env is set by the 'buildEnvironment' and/or 'environment' plugin options // (see webpack.config.js), // or by the code at the end of this file if using without webpack diff --git a/UI/package.json b/UI/package.json index dacc255849..21c894ff96 100644 --- a/UI/package.json +++ b/UI/package.json @@ -49,7 +49,7 @@ "tapable": "2.2.1", "vue": "3.4.27", "vue-i18n": "9.13.1", - "vue-router": "4.3.2" + "vue-router": "^4.3.2" }, "devDependencies": { "@babel/core": "7.24.6", @@ -77,7 +77,6 @@ "dojo-webpack-plugin": "3.0.6", "ejs-loader": "0.5.0", "eslint": "8.57.0", - "eslint-config-airbnb-base": "15.0.0", "eslint-config-eslint": "10.0.0", "eslint-config-prettier": "9.1.0", "eslint-import-resolver-webpack": "0.13.8", @@ -203,8 +202,7 @@ "rules": { "jest/prefer-expect-assertions": "off", "jest/no-commented-out-tests": "off", - "no-console": "off", - "camelcase": "off" + "no-console": "off" } }, { @@ -253,7 +251,6 @@ "es6": true }, "extends": [ - "airbnb-base/legacy", "eslint:recommended", "plugin:import/errors", "plugin:import/warnings", @@ -270,7 +267,6 @@ "!__mocks__/**" ], "rules": { - "camelcase": "error", "compat/compat": "warn", "consistent-return": "error", "curly": [ @@ -280,11 +276,7 @@ "dot-notation": "error", "eqeqeq": "error", "func-names": 0, - "global-require": "error", - "guard-for-in": "error", "new-cap": 0, - "no-alert": "error", - "no-console": "error", "no-continue": 0, "no-else-return": "error", "no-lonely-if": "error", @@ -303,7 +295,10 @@ "no-use-before-define": "error", "no-useless-escape": "error", "no-useless-return": "error", - "one-var": "error", + "one-var": [ + "error", + "never" + ], "radix": "error", "spaced-comment": [ "error", diff --git a/UI/src/components/ServerUI.js b/UI/src/components/ServerUI.js index 657acd2612..08777bf54a 100644 --- a/UI/src/components/ServerUI.js +++ b/UI/src/components/ServerUI.js @@ -176,7 +176,6 @@ export default { // the widgets. (it may take a bit for the new content to overwrite the old // content...) query("*", document.getElementById("maindiv")).forEach( - /* eslint-disable no-param-reassign */ (n) => delete n._cssState ); } catch (e) { diff --git a/UI/src/elements/lsmb-base-input.js b/UI/src/elements/lsmb-base-input.js index 849b9481e1..6010556a22 100644 --- a/UI/src/elements/lsmb-base-input.js +++ b/UI/src/elements/lsmb-base-input.js @@ -1,5 +1,4 @@ /** @format */ -/* eslint-disable class-methods-use-this */ import { LsmbDijit } from "@/elements/lsmb-dijit"; diff --git a/UI/src/elements/lsmb-button.js b/UI/src/elements/lsmb-button.js index e8403e1270..c9148dee53 100644 --- a/UI/src/elements/lsmb-button.js +++ b/UI/src/elements/lsmb-button.js @@ -1,5 +1,4 @@ /** @format */ -/* eslint-disable class-methods-use-this */ import { LsmbDijit } from "@/elements/lsmb-dijit"; diff --git a/UI/src/elements/lsmb-date.js b/UI/src/elements/lsmb-date.js index 954b4d309f..b4a669454f 100644 --- a/UI/src/elements/lsmb-date.js +++ b/UI/src/elements/lsmb-date.js @@ -1,5 +1,4 @@ /** @format */ -/* eslint-disable class-methods-use-this, max-classes-per-file */ import { LsmbBaseInput } from "@/elements/lsmb-base-input"; diff --git a/UI/src/elements/lsmb-dijit.js b/UI/src/elements/lsmb-dijit.js index 87430c9444..07f364bcd5 100644 --- a/UI/src/elements/lsmb-dijit.js +++ b/UI/src/elements/lsmb-dijit.js @@ -1,5 +1,4 @@ /** @format */ -/* eslint-disable class-methods-use-this */ export class LsmbDijit extends HTMLElement { dojoWidget = null; @@ -21,7 +20,6 @@ export class LsmbDijit extends HTMLElement { } _collectProps() { - /* eslint-disable no-eval */ let extra = this.hasAttribute("dojo-props") ? eval("({" + this.getAttribute("dojo-props") + "})") : {}; diff --git a/UI/src/elements/lsmb-password.js b/UI/src/elements/lsmb-password.js index f26d28478c..04cf6e72a6 100644 --- a/UI/src/elements/lsmb-password.js +++ b/UI/src/elements/lsmb-password.js @@ -1,5 +1,4 @@ /** @format */ -/* eslint-disable class-methods-use-this */ import { LsmbText } from "@/elements/lsmb-text"; diff --git a/UI/src/elements/lsmb-text.js b/UI/src/elements/lsmb-text.js index 65714b9db9..d98106a231 100644 --- a/UI/src/elements/lsmb-text.js +++ b/UI/src/elements/lsmb-text.js @@ -1,5 +1,4 @@ /** @format */ -/* eslint-disable class-methods-use-this, max-classes-per-file */ import { LsmbBaseInput } from "@/elements/lsmb-base-input"; diff --git a/UI/src/i18n.js b/UI/src/i18n.js index 65c86f8134..477217a88d 100644 --- a/UI/src/i18n.js +++ b/UI/src/i18n.js @@ -1,6 +1,4 @@ /** @format */ -/* eslint-disable global-require */ -/* eslint-disable camelcase, prettier/prettier */ const rtlDetect = require("rtl-detect"); @@ -14,7 +12,6 @@ function _mapLocale(locale) { return locale; } -// eslint-disable-next-line import/no-unresolved import messages from '@/locales/en.json'; import { nextTick } from "vue"; @@ -38,14 +35,14 @@ export async function setI18nLanguage(lang) { const _messages = await import(/* webpackChunkName: "lang-[request]" */ `@/locales/${locale}.json`); i18n.global.setLocaleMessage(locale, _messages.default); } - catch (e) { + catch { const strippedLocale = locale.replace(/_[a-z]+/i, ''); try { const _messages = await import(/* webpackChunkName: "lang-[request]" */ `@/locales/${strippedLocale}.json`); i18n.global.setLocaleMessage(strippedLocale, _messages.default); locale = strippedLocale; } - catch (f) { + catch { locale = "en"; } } diff --git a/UI/src/main-vue.js b/UI/src/main-vue.js index 0499672960..df69f259e1 100644 --- a/UI/src/main-vue.js +++ b/UI/src/main-vue.js @@ -1,5 +1,4 @@ /** @format */ -/* eslint-disable no-console, import/no-unresolved, vue/multi-word-component-names */ import { createApp } from "vue"; import router from "@/router"; @@ -19,7 +18,6 @@ let appName; let lsmbDirective = { beforeMount(el, binding /* , vnode */) { let handler = (event) => { - /* eslint-disable no-param-reassign */ binding.instance[binding.arg] = event.target.value; }; el.addEventListener("input", handler); @@ -37,8 +35,7 @@ if (document.getElementById("main")) { mounted() { window.__lsmbLoadLink = (url) => this.$router.push( - // eslint-disable-next-line no-useless-escape - url.replace(/^https?:\/\/(?:[^@\/]+)/, "") + url.replace(/^https?:\/\/(?:[^@/]+)/, "") ); let m = document.getElementById("main"); diff --git a/UI/src/robot-vue.js b/UI/src/robot-vue.js index 64a98a5a31..efe5d76fd5 100644 --- a/UI/src/robot-vue.js +++ b/UI/src/robot-vue.js @@ -75,11 +75,9 @@ function contextRef(service, key) { typeof service.context[key] === typeof {} ) { const s = service; - // eslint-disable-next-line vue/no-ref-as-operand ref = reactive(service.context[key]); s.context[key] = ref; } else { - // eslint-disable-next-line vue/no-ref-as-operand ref = allocRef(service.context[key]); } const ctxRef = { diff --git a/UI/src/router.js b/UI/src/router.js index 11aded1d2e..156a7f67e6 100644 --- a/UI/src/router.js +++ b/UI/src/router.js @@ -1,6 +1,5 @@ /** @format */ -/* eslint-disable-next-line import/no-unresolved */ import { createRouter, createWebHashHistory } from "vue-router"; import Home from "@/views/Home"; diff --git a/UI/src/views/LoginPage.machines.js b/UI/src/views/LoginPage.machines.js index e863387349..22a525fd33 100644 --- a/UI/src/views/LoginPage.machines.js +++ b/UI/src/views/LoginPage.machines.js @@ -48,7 +48,7 @@ function createLoginMachine(initialContext) { submitLogin, transition( 'error', 'ready', - action((ctx, e) => { alert(e.error); }) // eslint-disable-line no-alert + action((ctx, e) => { alert(e.error); }) ), transition( 'done', 'submitted', @@ -74,7 +74,7 @@ function createLoginMachine(initialContext) { 'ready', guard(testNot(testResponseOkFn())), action((ctx) => { - alert(ctx.t("Unknown error preventing login")); // eslint-disable-line no-alert + alert(ctx.t("Unknown error preventing login")); }), ), immediate('parsing'), diff --git a/UI/tests/common/i18n.js b/UI/tests/common/i18n.js index 3c784dea9a..ae8189ccc1 100644 --- a/UI/tests/common/i18n.js +++ b/UI/tests/common/i18n.js @@ -17,7 +17,6 @@ function _mapLocale(locale) { var _messages = {}; SUPPORT_LOCALES.forEach(function (it) { const locale = _mapLocale(it); - // eslint-disable-next-line global-require _messages[locale] = require("@/locales/" + locale + ".json"); }); diff --git a/UI/tests/common/jest-setup.js b/UI/tests/common/jest-setup.js index f71ebe0d6b..e0862da558 100644 --- a/UI/tests/common/jest-setup.js +++ b/UI/tests/common/jest-setup.js @@ -1,11 +1,10 @@ -/* eslint-disable no-console */ import { jest, beforeAll, afterAll, beforeEach, afterEach } from "@jest/globals"; import 'core-js'; import { setGlobalOrigin } from 'undici'; import "./mocks/lsmb_elements"; -import { server } from './mocks/server.js' +import { server } from './mocks/server.js'; Object.defineProperty(window, "lsmbConfig", { writable: true, @@ -40,7 +39,7 @@ beforeAll(() => { // Establish API mocking before all tests. server.listen({ onUnhandledRequest(req) { - console.error( // eslint-disable-line no-console + console.error( 'Found an unhandled %s request to %s', req.method, req.url.href diff --git a/UI/tests/common/mocks/login_handlers.js b/UI/tests/common/mocks/login_handlers.js index 0a6911d323..8fd45350b2 100644 --- a/UI/tests/common/mocks/login_handlers.js +++ b/UI/tests/common/mocks/login_handlers.js @@ -1,4 +1,3 @@ -/* eslint-disable no-console */ import { http, HttpResponse } from 'msw'; export const loginHandlers = [ diff --git a/UI/tests/common/mocks/lsmb_elements.js b/UI/tests/common/mocks/lsmb_elements.js index 6265855ec5..5e0f31c34b 100644 --- a/UI/tests/common/mocks/lsmb_elements.js +++ b/UI/tests/common/mocks/lsmb_elements.js @@ -1,7 +1,4 @@ /** @format */ -/* eslint-disable vue/component-definition-name-casing */ -/* eslint-disable vue/require-prop-types, vue/one-component-per-file */ -/* eslint-disable global-require */ import { config } from "@vue/test-utils"; import { defineComponent } from "vue"; diff --git a/UI/tests/common/mocks/server.js b/UI/tests/common/mocks/server.js index 703910e52e..573c9731a6 100644 --- a/UI/tests/common/mocks/server.js +++ b/UI/tests/common/mocks/server.js @@ -1,4 +1,3 @@ -/* eslint-disable no-console */ import { setupServer } from 'msw/node'; import { handlers } from './handlers'; diff --git a/UI/tests/common/mocks/store_business-types_handlers.js b/UI/tests/common/mocks/store_business-types_handlers.js index 8b8f76b4d9..9666939b3a 100644 --- a/UI/tests/common/mocks/store_business-types_handlers.js +++ b/UI/tests/common/mocks/store_business-types_handlers.js @@ -1,4 +1,3 @@ -/* eslint-disable no-unused-vars, no-console */ import { http, HttpResponse } from 'msw'; export const businessTypesHandlers = [ diff --git a/UI/tests/common/mocks/store_countries_handlers.js b/UI/tests/common/mocks/store_countries_handlers.js index a423bd63f1..28d0f7e479 100644 --- a/UI/tests/common/mocks/store_countries_handlers.js +++ b/UI/tests/common/mocks/store_countries_handlers.js @@ -1,5 +1,4 @@ -/* eslint-disable no-unused-vars, no-console */ -import { http, HttpResponse } from 'msw' +import { http, HttpResponse } from 'msw'; export const countriesHandlers = [ diff --git a/UI/tests/common/mocks/store_language_handlers.js b/UI/tests/common/mocks/store_language_handlers.js index 3299eb769b..4c6ab26cc8 100644 --- a/UI/tests/common/mocks/store_language_handlers.js +++ b/UI/tests/common/mocks/store_language_handlers.js @@ -1,5 +1,4 @@ -/* eslint-disable no-unused-vars, no-console */ -import { http, HttpResponse } from 'msw' +import { http, HttpResponse } from 'msw'; export const languageHandlers = [ diff --git a/UI/tests/common/mocks/store_pricegroups_handlers.js b/UI/tests/common/mocks/store_pricegroups_handlers.js index a20dc52ac5..1e34a8f8ab 100644 --- a/UI/tests/common/mocks/store_pricegroups_handlers.js +++ b/UI/tests/common/mocks/store_pricegroups_handlers.js @@ -1,5 +1,4 @@ -/* eslint-disable no-unused-vars, no-console */ -import { http, HttpResponse } from 'msw' +import { http, HttpResponse } from 'msw'; export const pricegroupHandlers = [ diff --git a/UI/tests/common/mocks/store_sessionUser_handlers.js b/UI/tests/common/mocks/store_sessionUser_handlers.js index 64cd5bb11d..7e3c7c8d53 100644 --- a/UI/tests/common/mocks/store_sessionUser_handlers.js +++ b/UI/tests/common/mocks/store_sessionUser_handlers.js @@ -1,9 +1,8 @@ -/* eslint-disable no-unused-vars, no-console */ -import { http, HttpResponse } from 'msw' +import { http, HttpResponse } from 'msw'; export const sessionUserHandlers = [ - http.get('/erp/api/v0/session', ({ request }) => { + http.get('/erp/api/v0/session', () => { return HttpResponse.json( { @@ -23,7 +22,7 @@ export const sessionUserHandlers = [ } }, { status: 200 } - ) + ); }) -] \ No newline at end of file +]; diff --git a/UI/tests/common/mocks/store_sics_handlers.js b/UI/tests/common/mocks/store_sics_handlers.js index c91ad2d295..287d7f1f52 100644 --- a/UI/tests/common/mocks/store_sics_handlers.js +++ b/UI/tests/common/mocks/store_sics_handlers.js @@ -1,5 +1,4 @@ -/* eslint-disable no-unused-vars, no-console */ -import { http, HttpResponse } from 'msw' +import { http, HttpResponse } from 'msw'; export const sicsHandlers = [ diff --git a/UI/tests/common/mocks/store_warehouses_handlers.js b/UI/tests/common/mocks/store_warehouses_handlers.js index 85d6f778a7..dee7592d59 100644 --- a/UI/tests/common/mocks/store_warehouses_handlers.js +++ b/UI/tests/common/mocks/store_warehouses_handlers.js @@ -1,5 +1,4 @@ -/* eslint-disable no-unused-vars, no-console */ -import { http, HttpResponse } from 'msw' +import { http, HttpResponse } from 'msw'; export const warehousesHandlers = [ diff --git a/UI/tests/specs/openapi/database.js b/UI/tests/specs/openapi/database.js index 99cd2c5bf9..9c601b8de8 100644 --- a/UI/tests/specs/openapi/database.js +++ b/UI/tests/specs/openapi/database.js @@ -1,4 +1,3 @@ -/* eslint-disable camelcase */ // Import test packages import { spawnSync } from "child_process"; diff --git a/UI/tests/specs/stores/countries.spec.js b/UI/tests/specs/stores/countries.spec.js index b329b63273..697d783d67 100644 --- a/UI/tests/specs/stores/countries.spec.js +++ b/UI/tests/specs/stores/countries.spec.js @@ -1,5 +1,4 @@ /** @format */ -/* eslint-disable no-console */ import { createTestingPinia } from "@pinia/testing"; diff --git a/UI/tests/specs/stores/gifis.spec.js b/UI/tests/specs/stores/gifis.spec.js index 0a29bfad9d..f186a70aa3 100644 --- a/UI/tests/specs/stores/gifis.spec.js +++ b/UI/tests/specs/stores/gifis.spec.js @@ -1,5 +1,4 @@ /** @format */ -/* eslint-disable no-console */ import { createTestingPinia } from "@pinia/testing"; diff --git a/UI/webpack.config.js b/UI/webpack.config.js index e37cda9579..e8ce4be326 100644 --- a/UI/webpack.config.js +++ b/UI/webpack.config.js @@ -1,5 +1,5 @@ /** @format */ -/* eslint global-require:0, no-param-reassign:0, no-unused-vars:0 */ +/* eslint global-require:0, no-param-reassign:0, no-unused-vars:0, no-inner-declarations:0 */ /* global getConfig */ const TARGET = process.env.npm_lifecycle_event; @@ -23,7 +23,6 @@ if (TARGET !== "readme") { const UnusedWebpackPlugin = require("unused-webpack-plugin"); const VirtualModulesPlugin = require("webpack-virtual-modules"); const { VueLoaderPlugin } = require("vue-loader"); - // eslint-disable-next-line const { WebpackDeduplicationPlugin } = require("webpack-deduplication-plugin"); const argv = require("yargs").argv; @@ -39,7 +38,6 @@ if (TARGET !== "readme") { /* FUNCTIONS */ var includedRequires = []; - /* eslint-disable-next-line no-inner-declarations */ function findDataDojoTypes(fileName) { var content = "" + fs.readFileSync(fileName); // Return unique data-dojo-type refereces @@ -50,7 +48,6 @@ if (TARGET !== "readme") { ).filter((x, i, a) => a.indexOf(x) === i); } - /* eslint-disable-next-line no-inner-declarations */ function getPOFilenames(_path, extension) { return fs .readdirSync(_path) @@ -64,7 +61,6 @@ if (TARGET !== "readme") { .sort(); } - /* eslint-disable-next-line no-inner-declarations */ function globCssEntries(globPath) { const files = glob.sync(globPath); let entries = {}; @@ -199,13 +195,11 @@ if (TARGET !== "readme") { // dojo/domReady (only works if the DOM is ready when invoked) const NormalModuleReplacementPluginOptionsDomReady = function (data) { const match = /^dojo\/domReady!(.*)$/.exec(data.request); - /* eslint-disable-next-line no-param-reassign */ data.request = "dojo/loaderProxy?loader=dojo/domReady!" + match[1]; }; const NormalModuleReplacementPluginOptionsSVG = function (data) { var match = /^svg!(.*)$/.exec(data.request); - /* eslint-disable-next-line no-param-reassign */ data.request = "dojo/loaderProxy?loader=svg&deps=dojo/text%21" + match[1] + @@ -249,7 +243,6 @@ if (TARGET !== "readme") { // Compile bootstrap module as a virtual one const VirtualModulesPluginOptions = { "./bootstrap.js": - `/* eslint-disable */\n` + `define(["dojo/parser","dojo/ready","` + includedRequires.join('","') + `"], function(parser, ready) {\n` + @@ -278,7 +271,6 @@ if (TARGET !== "readme") { new webpack.NormalModuleReplacementPlugin(/^dojo\/text!/, function ( data ) { - /* eslint-disable-next-line no-param-reassign */ data.request = data.request.replace( /^dojo\/text!/, "!!raw-loader!" @@ -450,6 +442,7 @@ if (TARGET !== "readme") { resolve: { alias: { vue$: "vue/dist/vue.cjs.js", + "vue-router": "vue-router/dist/vue-router.cjs.js", pinia$: "pinia/dist/pinia.cjs", "vue-i18n": "vue-i18n/dist/vue-i18n.cjs", "@pinia": path.join(__dirname, "node_modules/@pinia"), // Fix eslint importer diff --git a/UI/yarn.lock b/UI/yarn.lock index d1d0feba47..0235003584 100644 --- a/UI/yarn.lock +++ b/UI/yarn.lock @@ -3576,11 +3576,6 @@ config-chain@^1.1.13: ini "^1.3.4" proto-list "~1.2.1" -confusing-browser-globals@^1.0.10: - version "1.0.11" - resolved "https://registry.yarnpkg.com/confusing-browser-globals/-/confusing-browser-globals-1.0.11.tgz#ae40e9b57cdd3915408a2805ebd3a5585608dc81" - integrity sha512-JsPKdmh8ZkmnHxDk55FZ1TqVLvEQTvoByJZRN9jzI0UjxK/QgAmsphz7PGtqgPieQZ/CQcHWXCR7ATDNhGe+YA== - connect-history-api-fallback@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/connect-history-api-fallback/-/connect-history-api-fallback-2.0.0.tgz#647264845251a0daf25b97ce87834cace0f5f1c8" @@ -4545,16 +4540,6 @@ eslint-compat-utils@^0.1.2: resolved "https://registry.yarnpkg.com/eslint-compat-utils/-/eslint-compat-utils-0.1.2.tgz#f45e3b5ced4c746c127cf724fb074cd4e730d653" integrity sha512-Jia4JDldWnFNIru1Ehx1H5s9/yxiRHY/TimCuUc0jNexew3cF1gI6CYZil1ociakfWO3rRqFjl1mskBblB3RYg== -eslint-config-airbnb-base@15.0.0: - version "15.0.0" - resolved "https://registry.yarnpkg.com/eslint-config-airbnb-base/-/eslint-config-airbnb-base-15.0.0.tgz#6b09add90ac79c2f8d723a2580e07f3925afd236" - integrity sha512-xaX3z4ZZIcFLvh2oUNvcX5oEofXda7giYmuplVxoOg5A7EXJMrUyqRgR+mhDhPK8LZ4PttFOBvCYDbX3sUoUig== - dependencies: - confusing-browser-globals "^1.0.10" - object.assign "^4.1.2" - object.entries "^1.1.5" - semver "^6.3.0" - eslint-config-eslint@10.0.0: version "10.0.0" resolved "https://registry.yarnpkg.com/eslint-config-eslint/-/eslint-config-eslint-10.0.0.tgz#253fc138ef2ee172c6134046b2084d61ae93b89f" @@ -7680,7 +7665,7 @@ object-keys@^1.1.1: resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== -object.assign@^4.1.2, object.assign@^4.1.5: +object.assign@^4.1.5: version "4.1.5" resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.5.tgz#3a833f9ab7fdb80fc9e8d2300c803d216d8fdbb0" integrity sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ== @@ -7690,15 +7675,6 @@ object.assign@^4.1.2, object.assign@^4.1.5: has-symbols "^1.0.3" object-keys "^1.1.1" -object.entries@^1.1.5: - version "1.1.7" - resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.1.7.tgz#2b47760e2a2e3a752f39dd874655c61a7f03c131" - integrity sha512-jCBs/0plmPsOnrKAfFQXRG2NFjlhZgjjcBLSmTnEhU8U6vVTsVe8ANeQJCHTl3gSsI4J+0emOoCgoKlmQPMgmA== - dependencies: - call-bind "^1.0.2" - define-properties "^1.2.0" - es-abstract "^1.22.1" - object.fromentries@^2.0.7: version "2.0.7" resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-2.0.7.tgz#71e95f441e9a0ea6baf682ecaaf37fa2a8d7e616" @@ -9534,16 +9510,7 @@ string-length@^4.0.1: char-regex "^1.0.2" strip-ansi "^6.0.0" -"string-width-cjs@npm:string-width@^4.2.0": - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -9607,14 +9574,7 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -10425,7 +10385,7 @@ vue-loader@17.4.2: hash-sum "^2.0.0" watchpack "^2.4.0" -vue-router@4.3.2: +vue-router@^4.3.2: version "4.3.2" resolved "https://registry.yarnpkg.com/vue-router/-/vue-router-4.3.2.tgz#08096c7765dacc6832f58e35f7a081a8b34116a7" integrity sha512-hKQJ1vDAZ5LVkKEnHhmm1f9pMiWIBNGF5AwU67PdH7TyXCj/a4hTccuUuYCAMgJK6rO/NVYtQIEN3yL8CECa7Q== @@ -10766,7 +10726,7 @@ wordwrap@~0.0.2: resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" integrity sha512-1tMA907+V4QmxV7dbRvb4/8MaRALK6q9Abid3ndMYnbyo8piisCmeONVqVSXqQA3KaP4SLt5b7ud6E2sqP8TFw== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -10784,15 +10744,6 @@ wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"