From 7e2d8e58be4a6652139a2a47ec2a234b4a211b20 Mon Sep 17 00:00:00 2001 From: Damien Cassou Date: Fri, 5 Apr 2024 11:56:29 +0200 Subject: [PATCH 1/2] 32129139: Stop using jquery globals "jQuery" and "$" --- src/router/url.js | 1 + src/test/htmlCanvasTest.js | 6 +++--- src/test/widgetTest.js | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/router/url.js b/src/router/url.js index 128f95c2..7adc5008 100644 --- a/src/router/url.js +++ b/src/router/url.js @@ -1,4 +1,5 @@ import { object } from "klassified"; +import jQuery from "../lib-wrappers/jquery.js"; /** * Token/Char used to separate segments in URL paths. diff --git a/src/test/htmlCanvasTest.js b/src/test/htmlCanvasTest.js index 19cef683..e2014201 100644 --- a/src/test/htmlCanvasTest.js +++ b/src/test/htmlCanvasTest.js @@ -2,7 +2,7 @@ import htmlCanvas from "../htmlCanvas.js"; import jQuery from "../lib-wrappers/jquery.js"; function withCanvas(callback) { - $("BODY").append('
'); + jQuery("BODY").append('
'); let sandbox = jQuery("#sandbox"); let html = htmlCanvas(sandbox); @@ -24,7 +24,7 @@ describe("htmlCanvas", () => { expect(html).toBeTruthy(); expect(html.root).toBeTruthy(); expect(html.root.element).toBeTruthy(); - expect($("BODY").is(html.root.element)).toBeTruthy(); + expect(jQuery("BODY").is(html.root.element)).toBeTruthy(); }); it("throws exception if jQuery dont match element", () => { @@ -266,7 +266,7 @@ describe("htmlCanvas", () => { withCanvas((html) => { // Arrange a div with10 sub span supplied to DIV as an array html.div( - $.map([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], (num) => + jQuery.map([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], (num) => html.span(num.toString()), ), ).id("test_div"); diff --git a/src/test/widgetTest.js b/src/test/widgetTest.js index 4c9b03c6..054bb262 100644 --- a/src/test/widgetTest.js +++ b/src/test/widgetTest.js @@ -24,7 +24,7 @@ function withWidget(callback) { } function withCanvas(callback) { - $("BODY").append('
'); + jQuery("BODY").append('
'); let sandbox = jQuery("#sandbox"); let html = htmlCanvas(sandbox); From a31979efaba196fd7d0536673646597564baac92 Mon Sep 17 00:00:00 2001 From: Damien Cassou Date: Fri, 5 Apr 2024 11:57:28 +0200 Subject: [PATCH 2/2] 32129139: Remove unwanted eslint environments This forces us to declare its usage everywhere needed. --- .eslintrc.js | 5 +++++ src/test/.eslintrc.js | 3 +++ 2 files changed, 8 insertions(+) diff --git a/.eslintrc.js b/.eslintrc.js index 5c312d6a..c5a5b619 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,6 +1,11 @@ +/* eslint-env commonjs */ + module.exports = { root: true, extends: ["plugin:@foretagsplatsen/main"], + // workaround for plugin:@foretagsplatsen/main enabling many + // unwanted environments: + env: { amd: false, jquery: false, node: false, jasmine: false }, rules: { "import/no-unused-modules": [ "error", diff --git a/src/test/.eslintrc.js b/src/test/.eslintrc.js index f7759ecb..5552e6cb 100644 --- a/src/test/.eslintrc.js +++ b/src/test/.eslintrc.js @@ -1,4 +1,7 @@ +/* eslint-env commonjs */ + module.exports = { + env: { jasmine: true }, rules: { "import/no-unused-modules": "off", },