From b7bbbff56f112db40c08bba9544c322dff576f65 Mon Sep 17 00:00:00 2001 From: Dave Roberts Date: Wed, 16 Jul 2025 14:35:48 +0100 Subject: [PATCH 01/14] Formatted test and config code and updated test files Also removed extra yarn commands that weren't needed, and automated download of browserslist updates on build. --- package.json | 3 +- .../button/lib/remove-curval-button.test.js | 2 +- .../button/lib/show-blank-button.test.ts | 2 +- .../components/data-table/lib/helper.test.ts | 2 +- .../form-group/autosave/lib/autosave.test.ts | 1 + .../help-view/lib/component.test.ts | 1 + src/frontend/js/lib/set-field-value.test.ts | 2 ++ .../lib/encryptedStorage.test.ts | 6 ++++ .../js/lib/util/filedrag/lib/filedrag.test.ts | 1 + .../js/lib/util/mapper/formdataMapper.test.ts | 1 + .../lib/storageProvider.test.ts | 2 +- .../typeahead/lib/TypeaheadBuilder.test.ts | 1 + .../js/lib/util/upload/UploadControl.test.ts | 2 +- yarn.lock | 35 ++++++++++++++++--- 14 files changed, 50 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 2bd6bc20f..ca98143ae 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,7 @@ "build:dev": "webpack --env development --progress -w", "test:watch": "jest --watch", "e2e": "yarn cypress run", - "prebuild": "npx update-browserslist-db@latest", - "pretest": "npx update-browserslist-db@latest" + "prebuild": "npx update-browserslist-db@latest" }, "dependencies": { "@egjs/hammerjs": "^2.0.0", diff --git a/src/frontend/components/button/lib/remove-curval-button.test.js b/src/frontend/components/button/lib/remove-curval-button.test.js index a22dd35f8..5d854852c 100644 --- a/src/frontend/components/button/lib/remove-curval-button.test.js +++ b/src/frontend/components/button/lib/remove-curval-button.test.js @@ -61,4 +61,4 @@ describe('RemoveCurvalButton', () => { button.click(); expect(current.children.length).toBe(0); }); -}); \ No newline at end of file +}); diff --git a/src/frontend/components/button/lib/show-blank-button.test.ts b/src/frontend/components/button/lib/show-blank-button.test.ts index 3d13895ca..ee0237e2a 100644 --- a/src/frontend/components/button/lib/show-blank-button.test.ts +++ b/src/frontend/components/button/lib/show-blank-button.test.ts @@ -29,4 +29,4 @@ describe('ShowBlankButton', () => { button.trigger('click'); expect(item.css('display')).toBe('none'); }); -}); \ No newline at end of file +}); diff --git a/src/frontend/components/data-table/lib/helper.test.ts b/src/frontend/components/data-table/lib/helper.test.ts index 454cbc18a..e95dbd801 100644 --- a/src/frontend/components/data-table/lib/helper.test.ts +++ b/src/frontend/components/data-table/lib/helper.test.ts @@ -71,4 +71,4 @@ describe('helper', () => { clearTable($(target)); expect(target.querySelectorAll('tbody tr').length).toBe(1); }); -}); \ No newline at end of file +}); diff --git a/src/frontend/components/form-group/autosave/lib/autosave.test.ts b/src/frontend/components/form-group/autosave/lib/autosave.test.ts index e88811f25..113cc014e 100644 --- a/src/frontend/components/form-group/autosave/lib/autosave.test.ts +++ b/src/frontend/components/form-group/autosave/lib/autosave.test.ts @@ -2,6 +2,7 @@ import AutosaveBase from './autosaveBase'; import { describe, it, expect, beforeAll, afterAll } from '@jest/globals'; +// Mocking the AutosaveBase class for testing class TestAutosave extends AutosaveBase { initAutosave(): void { console.log('initAutosave'); diff --git a/src/frontend/components/help-view/lib/component.test.ts b/src/frontend/components/help-view/lib/component.test.ts index d5720a849..b5e4fa94c 100644 --- a/src/frontend/components/help-view/lib/component.test.ts +++ b/src/frontend/components/help-view/lib/component.test.ts @@ -2,6 +2,7 @@ import HelpView from './component'; import { describe, it, expect } from '@jest/globals'; +// Mock class to test the HelpView component exposing private members class TestHelpView extends HelpView { public get button() { return this.$button; diff --git a/src/frontend/js/lib/set-field-value.test.ts b/src/frontend/js/lib/set-field-value.test.ts index e7e852e3a..91028f2ec 100644 --- a/src/frontend/js/lib/set-field-value.test.ts +++ b/src/frontend/js/lib/set-field-value.test.ts @@ -13,6 +13,7 @@ import textAreaComponent from 'components/form-group/textarea'; import { describe, it, expect, beforeEach, jest } from '@jest/globals'; import { setFieldValues } from './set-field-values'; +// Mocking jQuery plugins declare global { interface JQuery { renameButton: (options?: any) => JQuery; @@ -27,6 +28,7 @@ declare global { $.fn.filedrag = jest.fn().mockReturnThis(); })(jQuery); +// DOM elements for testing const stringDom = `
(); @@ -14,6 +16,7 @@ class TestStorage implements Storage { this.map.clear(); this.length = 0; } + getItem(key: string): string | null { const ret = this.map.get(key); if (ret === undefined) { @@ -21,6 +24,7 @@ class TestStorage implements Storage { } return ret; } + key(index: number): string | null { const keys = Array.from(this.map.keys()); if (keys.length <= index) { @@ -28,6 +32,7 @@ class TestStorage implements Storage { } return keys[index]; } + removeItem(key: string): void { if (this.map.has(key)) { this.map.delete(key); @@ -35,6 +40,7 @@ class TestStorage implements Storage { this[key] = undefined; } } + setItem(key: string, value: string): void { this.map.set(key, value); this[key] = value; diff --git a/src/frontend/js/lib/util/filedrag/lib/filedrag.test.ts b/src/frontend/js/lib/util/filedrag/lib/filedrag.test.ts index 0abedd382..420307622 100644 --- a/src/frontend/js/lib/util/filedrag/lib/filedrag.test.ts +++ b/src/frontend/js/lib/util/filedrag/lib/filedrag.test.ts @@ -2,6 +2,7 @@ import { describe, it, expect, jest } from '@jest/globals'; import FileDrag from './filedrag'; +// Test class implementation to expose private methods for testing class FileDragTest extends FileDrag { constructor(element: HTMLElement, onDrop: (files: File, index?: number, length?: number) => void = ()=>{}) { super(element, { debug: true }, onDrop); diff --git a/src/frontend/js/lib/util/mapper/formdataMapper.test.ts b/src/frontend/js/lib/util/mapper/formdataMapper.test.ts index ab50d2e4c..ee5f56211 100644 --- a/src/frontend/js/lib/util/mapper/formdataMapper.test.ts +++ b/src/frontend/js/lib/util/mapper/formdataMapper.test.ts @@ -1,3 +1,4 @@ +import { describe, it, expect } from '@jest/globals'; import { formdataMapper } from './formdataMapper'; describe('Basic formdata mapper tests', () => { diff --git a/src/frontend/js/lib/util/storageProvider/lib/storageProvider.test.ts b/src/frontend/js/lib/util/storageProvider/lib/storageProvider.test.ts index 4a497eab0..d1b93d78d 100644 --- a/src/frontend/js/lib/util/storageProvider/lib/storageProvider.test.ts +++ b/src/frontend/js/lib/util/storageProvider/lib/storageProvider.test.ts @@ -59,7 +59,7 @@ describe('StorageProvider', () => { await expect(storage.getItem('key')).resolves.toBe(undefined); }); - it('should set multipe key value pairs on the same instance', async () => { + it('should set multiple key value pairs on the same instance', async () => { const storage = new StorageProvider('test', localStorage); await expect(storage.setItem('key1', 'value1')).resolves.toBeUndefined(); await expect(storage.setItem('key2', 'value2')).resolves.toBeUndefined(); diff --git a/src/frontend/js/lib/util/typeahead/lib/TypeaheadBuilder.test.ts b/src/frontend/js/lib/util/typeahead/lib/TypeaheadBuilder.test.ts index 8bc4680e4..a47d4e874 100644 --- a/src/frontend/js/lib/util/typeahead/lib/TypeaheadBuilder.test.ts +++ b/src/frontend/js/lib/util/typeahead/lib/TypeaheadBuilder.test.ts @@ -1,4 +1,5 @@ import { TypeaheadBuilder } from './TypeaheadBuilder'; +import { describe, it, expect } from '@jest/globals'; describe('builder', () => { it('should error on the typeahead input not being set', () => { diff --git a/src/frontend/js/lib/util/upload/UploadControl.test.ts b/src/frontend/js/lib/util/upload/UploadControl.test.ts index 4555b92bd..4443de926 100644 --- a/src/frontend/js/lib/util/upload/UploadControl.test.ts +++ b/src/frontend/js/lib/util/upload/UploadControl.test.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ -import { describe, it, expect, beforeEach, afterEach } from '@jest/globals'; +import { describe, it, expect, beforeEach, afterEach, jest } from '@jest/globals'; import { Uploader, XmlHttpRequestLike } from './UploadControl'; /* @ts-ignore */ import { initGlobals, MockXhr } from 'testing/globals.definitions'; diff --git a/yarn.lock b/yarn.lock index 6f9d00c42..d9a6949ee 100644 --- a/yarn.lock +++ b/yarn.lock @@ -219,12 +219,22 @@ "@babel/traverse" "^7.27.1" "@babel/types" "^7.27.1" -"@babel/helper-string-parser@^7.23.4", "@babel/helper-string-parser@^7.27.1": +"@babel/helper-string-parser@^7.23.4": + version "7.24.1" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.24.1.tgz#f99c36d3593db9540705d0739a1f10b5e20c696e" + integrity sha512-2ofRCjnnA9y+wk8b9IAREroeUP02KHp431N2mhKniy2yKIDKpbrHv9eXwm8cBeWQYcJmzv5qKCu65P47eCF7CQ== + +"@babel/helper-string-parser@^7.27.1": version "7.27.1" resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz#54da796097ab19ce67ed9f88b47bb2ec49367687" integrity sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA== -"@babel/helper-validator-identifier@^7.22.20", "@babel/helper-validator-identifier@^7.25.9", "@babel/helper-validator-identifier@^7.27.1", "@babel/helper-validator-identifier@^7.28.5": +"@babel/helper-validator-identifier@^7.22.20": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz#c4ae002c61d2879e724581d96665583dbc1dc0e0" + integrity sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A== + +"@babel/helper-validator-identifier@^7.25.9", "@babel/helper-validator-identifier@^7.27.1", "@babel/helper-validator-identifier@^7.28.5": version "7.28.5" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz#010b6938fab7cb7df74aa2bbc06aa503b8fe5fb4" integrity sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q== @@ -243,7 +253,16 @@ "@babel/traverse" "^7.28.3" "@babel/types" "^7.28.2" -"@babel/helpers@^7.24.1", "@babel/helpers@^7.28.4": +"@babel/helpers@^7.24.1": + version "7.24.1" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.24.1.tgz#183e44714b9eba36c3038e442516587b1e0a1a94" + integrity sha512-BpU09QqEe6ZCHuIHFphEFgvNSrubve1FtyMton26ekZ85gRGi6LrTF7zArARp2YvyFxloeiRmtSCq5sjh1WqIg== + dependencies: + "@babel/template" "^7.24.0" + "@babel/traverse" "^7.24.1" + "@babel/types" "^7.24.0" + +"@babel/helpers@^7.28.4": version "7.28.4" resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.28.4.tgz#fe07274742e95bdf7cf1443593eeb8926ab63827" integrity sha512-HFN59MmQXGHVyYadKLVumYsA9dBFun/ldYxipEjzA4196jpLZd8UjEEBLkbEkvfYreDqJhZxYAWFPtrfhNpj4w== @@ -1050,7 +1069,15 @@ "@babel/helper-validator-identifier" "^7.22.20" to-fast-properties "^2.0.0" -"@babel/types@^7.24.0", "@babel/types@^7.27.1", "@babel/types@^7.27.3", "@babel/types@^7.28.2", "@babel/types@^7.28.4", "@babel/types@^7.28.5", "@babel/types@^7.4.4": +"@babel/types@^7.22.5": + version "7.29.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.29.0.tgz#9f5b1e838c446e72cf3cd4b918152b8c605e37c7" + integrity sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A== + dependencies: + "@babel/helper-string-parser" "^7.27.1" + "@babel/helper-validator-identifier" "^7.28.5" + +"@babel/types@^7.24.0", "@babel/types@^7.27.1", "@babel/types@^7.27.3", "@babel/types@^7.28.2", "@babel/types@^7.28.5", "@babel/types@^7.4.4": version "7.28.5" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.28.5.tgz#10fc405f60897c35f07e85493c932c7b5ca0592b" integrity sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA== From 32d3f87b5ef40a0b71681d29f76939aa6022b802 Mon Sep 17 00:00:00 2001 From: Dave Roberts <145559566+droberts-ctrlo@users.noreply.github.com> Date: Mon, 1 Sep 2025 15:06:15 +0100 Subject: [PATCH 02/14] Update package.json --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index ca98143ae..c0067a44a 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,7 @@ "test": "jest", "build:dev": "webpack --env development --progress -w", "test:watch": "jest --watch", - "e2e": "yarn cypress run", - "prebuild": "npx update-browserslist-db@latest" + "e2e": "yarn cypress run" }, "dependencies": { "@egjs/hammerjs": "^2.0.0", From d35831ee6907bcda5a3b49a1b0a62712392bc315 Mon Sep 17 00:00:00 2001 From: Dave Roberts Date: Tue, 2 Dec 2025 15:06:15 +0000 Subject: [PATCH 03/14] Updated error handler Updated error handler --- yarn.lock | 41 +++++++---------------------------------- 1 file changed, 7 insertions(+), 34 deletions(-) diff --git a/yarn.lock b/yarn.lock index d9a6949ee..2fbce8371 100644 --- a/yarn.lock +++ b/yarn.lock @@ -219,22 +219,12 @@ "@babel/traverse" "^7.27.1" "@babel/types" "^7.27.1" -"@babel/helper-string-parser@^7.23.4": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.24.1.tgz#f99c36d3593db9540705d0739a1f10b5e20c696e" - integrity sha512-2ofRCjnnA9y+wk8b9IAREroeUP02KHp431N2mhKniy2yKIDKpbrHv9eXwm8cBeWQYcJmzv5qKCu65P47eCF7CQ== - -"@babel/helper-string-parser@^7.27.1": +"@babel/helper-string-parser@^7.23.4", "@babel/helper-string-parser@^7.27.1": version "7.27.1" resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz#54da796097ab19ce67ed9f88b47bb2ec49367687" integrity sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA== -"@babel/helper-validator-identifier@^7.22.20": - version "7.22.20" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz#c4ae002c61d2879e724581d96665583dbc1dc0e0" - integrity sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A== - -"@babel/helper-validator-identifier@^7.25.9", "@babel/helper-validator-identifier@^7.27.1", "@babel/helper-validator-identifier@^7.28.5": +"@babel/helper-validator-identifier@^7.22.20", "@babel/helper-validator-identifier@^7.25.9", "@babel/helper-validator-identifier@^7.27.1", "@babel/helper-validator-identifier@^7.28.5": version "7.28.5" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz#010b6938fab7cb7df74aa2bbc06aa503b8fe5fb4" integrity sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q== @@ -253,16 +243,7 @@ "@babel/traverse" "^7.28.3" "@babel/types" "^7.28.2" -"@babel/helpers@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.24.1.tgz#183e44714b9eba36c3038e442516587b1e0a1a94" - integrity sha512-BpU09QqEe6ZCHuIHFphEFgvNSrubve1FtyMton26ekZ85gRGi6LrTF7zArARp2YvyFxloeiRmtSCq5sjh1WqIg== - dependencies: - "@babel/template" "^7.24.0" - "@babel/traverse" "^7.24.1" - "@babel/types" "^7.24.0" - -"@babel/helpers@^7.28.4": +"@babel/helpers@^7.24.1", "@babel/helpers@^7.28.4": version "7.28.4" resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.28.4.tgz#fe07274742e95bdf7cf1443593eeb8926ab63827" integrity sha512-HFN59MmQXGHVyYadKLVumYsA9dBFun/ldYxipEjzA4196jpLZd8UjEEBLkbEkvfYreDqJhZxYAWFPtrfhNpj4w== @@ -1069,15 +1050,7 @@ "@babel/helper-validator-identifier" "^7.22.20" to-fast-properties "^2.0.0" -"@babel/types@^7.22.5": - version "7.29.0" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.29.0.tgz#9f5b1e838c446e72cf3cd4b918152b8c605e37c7" - integrity sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A== - dependencies: - "@babel/helper-string-parser" "^7.27.1" - "@babel/helper-validator-identifier" "^7.28.5" - -"@babel/types@^7.24.0", "@babel/types@^7.27.1", "@babel/types@^7.27.3", "@babel/types@^7.28.2", "@babel/types@^7.28.5", "@babel/types@^7.4.4": +"@babel/types@^7.24.0", "@babel/types@^7.27.1", "@babel/types@^7.27.3", "@babel/types@^7.28.2", "@babel/types@^7.28.4", "@babel/types@^7.28.5", "@babel/types@^7.4.4": version "7.28.5" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.28.5.tgz#10fc405f60897c35f07e85493c932c7b5ca0592b" integrity sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA== @@ -3055,9 +3028,9 @@ camelcase@^6.2.0: integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001587, caniuse-lite@^1.0.30001754: - version "1.0.30001792" - resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001792.tgz" - integrity sha512-hVLMUZFgR4JJ6ACt1uEESvQN1/dBVqPAKY0hgrV70eN3391K6juAfTjKZLKvOMsx8PxA7gsY1/tLMMTcfFLLpw== + version "1.0.30001757" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001757.tgz#a46ff91449c69522a462996c6aac4ef95d7ccc5e" + integrity sha512-r0nnL/I28Zi/yjk1el6ilj27tKcdjLsNqAOZr0yVjWPrSQyHgKI2INaEWw21bAQSv2LXRt1XuCS/GomNpWOxsQ== caseless@~0.12.0: version "0.12.0" From fb27bb4b539eecad1a6403d537e3c673b3e4ffd1 Mon Sep 17 00:00:00 2001 From: Dave Roberts Date: Thu, 17 Jul 2025 12:08:23 +0100 Subject: [PATCH 04/14] Added editorconfig and upgraded ESLint to current version --- eslint.config.mjs | 4 +- package.json | 6 ++- yarn.lock | 134 ++++++++++++++++++++++++++++++++++------------ 3 files changed, 107 insertions(+), 37 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index b402bafb9..6a1b52159 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -9,9 +9,9 @@ import jsdoc from "eslint-plugin-jsdoc"; export default defineConfig([ { settings: { react: { version: "detect" } } }, - { ignores: ["*.cjs", "eslint.config.mjs", "**/public/**", "**/node_modules/**", "**/cypress/**", "cypress.config.ts", ".stylelintrc.js", "src/frontend/testing/**", "src/frontend/css/stylesheets/external/**", "src/frontend/components/dashboard/lib/react/polyfills/**", "babel.config.js", "webpack.config.js", "jest.config.js", "tsconfig.json", "src/frontend/js/lib/jqplot/**", "src/frontend/js/lib/jquery/**", "src/frontend/js/lib/plotly/**", "src/frontend/components/timeline/**", "fengari-web.js"] }, + { ignores: ["eslint.config.mjs", "**/public/**", "**/node_modules/**", "**/cypress/**", "cypress.config.ts", ".stylelintrc.js", "src/frontend/testing/**", "src/frontend/css/stylesheets/external/**", "src/frontend/components/dashboard/lib/react/polyfills/**", "babel.config.js", "webpack.config.js", "jest.config.js", "tsconfig.json", "src/frontend/js/lib/jqplot/**", "src/frontend/js/lib/jquery/**", "src/frontend/js/lib/plotly/**", "src/frontend/components/timeline/**", "fengari-web.js"] }, { files: ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"], plugins: { js }, extends: ["js/recommended"] }, - { files: ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"], languageOptions: { globals: { ...globals.browser, ...globals.jquery, ...globals.jest } } }, + { files: ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"], languageOptions: { globals: { ...globals.browser, ...globals.jquery } } }, tseslint.configs.recommended, pluginReact.configs.flat.recommended, { files: ["**/*.css"], plugins: { css }, language: "css/css", extends: ["css/recommended"] }, diff --git a/package.json b/package.json index c0067a44a..3d1b09e42 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,9 @@ "test": "jest", "build:dev": "webpack --env development --progress -w", "test:watch": "jest --watch", - "e2e": "yarn cypress run" + "e2e": "yarn cypress run", + "prebuild": "npx update-browserslist-db@latest", + "pretest": "npx update-browserslist-db@latest" }, "dependencies": { "@egjs/hammerjs": "^2.0.0", @@ -76,7 +78,7 @@ "css-loader": "^3.2.0", "cypress": "^13.7.2", "eslint": "^9.31.0", - "eslint-plugin-jsdoc": "^52.0.0", + "eslint-plugin-jsdoc": "^62.9.0", "eslint-plugin-react": "^7.37.5", "globals": "^16.3.0", "jest": "^29.7.0", diff --git a/yarn.lock b/yarn.lock index 2fbce8371..6803c9417 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1112,16 +1112,21 @@ dependencies: "@types/hammerjs" "^2.0.36" -"@es-joy/jsdoccomment@~0.52.0": - version "0.52.0" - resolved "https://registry.yarnpkg.com/@es-joy/jsdoccomment/-/jsdoccomment-0.52.0.tgz#106945b6d1abed89597aa104b80ff8f9fb7038a6" - integrity sha512-BXuN7BII+8AyNtn57euU2Yxo9yA/KUDNzrpXyi3pfqKmBhhysR6ZWOebFh3vyPoqA3/j1SOvGgucElMGwlXing== +"@es-joy/jsdoccomment@~0.86.0": + version "0.86.0" + resolved "https://registry.yarnpkg.com/@es-joy/jsdoccomment/-/jsdoccomment-0.86.0.tgz#f7276904ed73bf2136993627033aeb5183b4392a" + integrity sha512-ukZmRQ81WiTpDWO6D/cTBM7XbrNtutHKvAVnZN/8pldAwLoJArGOvkNyxPTBGsPjsoaQBJxlH+tE2TNA/92Qgw== dependencies: "@types/estree" "^1.0.8" - "@typescript-eslint/types" "^8.34.1" - comment-parser "1.4.1" - esquery "^1.6.0" - jsdoc-type-pratt-parser "~4.1.0" + "@typescript-eslint/types" "^8.58.0" + comment-parser "1.4.6" + esquery "^1.7.0" + jsdoc-type-pratt-parser "~7.2.0" + +"@es-joy/resolve.exports@1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@es-joy/resolve.exports/-/resolve.exports-1.2.0.tgz#fe541a68aa080255f798c8561714ac8fad72cdd5" + integrity sha512-Q9hjxWI5xBM+qW2enxfe8wDKdFWMfd0Z29k5ZJnuBqD/CasY5Zryj09aCA6owbGATWz+39p5uIdaHXpopOcG8g== "@eslint-community/eslint-utils@^4.7.0", "@eslint-community/eslint-utils@^4.8.0", "@eslint-community/eslint-utils@^4.9.0": version "4.9.0" @@ -1584,6 +1589,11 @@ resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" integrity sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA== +"@sindresorhus/base62@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@sindresorhus/base62/-/base62-1.0.0.tgz#c47c42410e5212e4fa4657670e118ddfba39acd6" + integrity sha512-TeheYy0ILzBEI/CO55CP6zJCSdSWeRtGnHy8U8dWSUH4I68iqTsy7HkMktR4xakThc9jotkPQUXT4ITdbV7cHA== + "@sinonjs/commons@^3.0.0": version "3.0.1" resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-3.0.1.tgz#1029357e44ca901a615585f6d27738dbc89084cd" @@ -2072,11 +2082,16 @@ debug "^4.3.4" ts-api-utils "^2.1.0" -"@typescript-eslint/types@8.48.1", "@typescript-eslint/types@^8.34.1", "@typescript-eslint/types@^8.47.0", "@typescript-eslint/types@^8.48.1": +"@typescript-eslint/types@8.48.1", "@typescript-eslint/types@^8.47.0", "@typescript-eslint/types@^8.48.1": version "8.48.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.48.1.tgz#a9ff808f5f798f28767d5c0b015a88fa7ce46bd7" integrity sha512-+fZ3LZNeiELGmimrujsDCT4CRIbq5oXdHe7chLiW8qzqyPMnn1puNstCrMNVAqwcl2FdIxkuJ4tOs/RFDBVc/Q== +"@typescript-eslint/types@^8.58.0": + version "8.59.3" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.59.3.tgz#b7ca539c5e302fdde9a7cadb73caed107ef8f2cd" + integrity sha512-ePFoH0g4ludssdRFqqDxQePCxU4WQyRa9+XVwjm7yLn0FKhMeoetC+qBEEI1Eyb1pGSDveTIT09Bvw2WhlGayg== + "@typescript-eslint/typescript-estree@8.48.1": version "8.48.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.48.1.tgz#0d0e31fc47c5796c6463ab50cde19e1718d465b1" @@ -2302,6 +2317,11 @@ acorn@^8.15.0: resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.15.0.tgz#a360898bc415edaac46c8241f6383975b930b816" integrity sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg== +acorn@^8.16.0: + version "8.16.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.16.0.tgz#4ce79c89be40afe7afe8f3adb902a1f1ce9ac08a" + integrity sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw== + agent-base@6: version "6.0.2" resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" @@ -3224,10 +3244,10 @@ commander@^6.2.1: resolved "https://registry.yarnpkg.com/commander/-/commander-6.2.1.tgz#0792eb682dfbc325999bb2b84fddddba110ac73c" integrity sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA== -comment-parser@1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/comment-parser/-/comment-parser-1.4.1.tgz#bdafead37961ac079be11eb7ec65c4d021eaf9cc" - integrity sha512-buhp5kePrmda3vhc5B9t7pUQXAb2Tnd0qgpkIhPhkHXxJpiPJ11H0ZEU0oBpJ2QztSbzG/ZxMj/CHsYJqRHmyg== +comment-parser@1.4.6: + version "1.4.6" + resolved "https://registry.yarnpkg.com/comment-parser/-/comment-parser-1.4.6.tgz#49a6b1d53fa563324f7577ab8c0b26db4e7d1f9a" + integrity sha512-ObxuY6vnbWTN6Od72xfwN9DbzC7Y2vv8u1Soi9ahRKL37gb6y1qk6/dgjs+3JWuXJHWvsg3BXIwzd/rkmAwavg== common-tags@^1.8.0: version "1.8.2" @@ -3657,7 +3677,7 @@ debug@^3.1.0: dependencies: ms "^2.1.1" -debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.4.1: +debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.4.1, debug@^4.4.3: version "4.4.3" resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.3.tgz#c6ae432d9bd9662582fce08709b038c58e9e3d6a" integrity sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA== @@ -4187,21 +4207,25 @@ escodegen@^2.0.0: optionalDependencies: source-map "~0.6.1" -eslint-plugin-jsdoc@^52.0.0: - version "52.0.4" - resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-52.0.4.tgz#d391b33dd8d6808d573118588451229d4f41f20d" - integrity sha512-be5OzGlLExvcK13Il3noU7/v7WmAQGenTmCaBKf1pwVtPOb6X+PGFVnJad0QhMj4KKf45XjE4hbsBxv25q1fTg== +eslint-plugin-jsdoc@^62.9.0: + version "62.9.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-62.9.0.tgz#a4902f6978b1e7cc5c5d1a528ecf7d8c7ce716d9" + integrity sha512-PY7/X4jrVgoIDncUmITlUqK546Ltmx/Pd4Hdsu4CvSjryQZJI2mEV4vrdMufyTetMiZ5taNSqvK//BTgVUlNkA== dependencies: - "@es-joy/jsdoccomment" "~0.52.0" + "@es-joy/jsdoccomment" "~0.86.0" + "@es-joy/resolve.exports" "1.2.0" are-docs-informative "^0.0.2" - comment-parser "1.4.1" - debug "^4.4.1" + comment-parser "1.4.6" + debug "^4.4.3" escape-string-regexp "^4.0.0" - espree "^10.4.0" - esquery "^1.6.0" + espree "^11.2.0" + esquery "^1.7.0" + html-entities "^2.6.0" + object-deep-merge "^2.0.0" parse-imports-exports "^0.2.4" - semver "^7.7.2" + semver "^7.7.4" spdx-expression-parse "^4.0.0" + to-valid-identifier "^1.0.0" eslint-plugin-react@^7.37.5: version "7.37.5" @@ -4253,6 +4277,11 @@ eslint-visitor-keys@^4.2.1: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz#4cfea60fe7dd0ad8e816e1ed026c1d5251b512c1" integrity sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ== +eslint-visitor-keys@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz#9e3c9489697824d2d4ce3a8ad12628f91e9f59be" + integrity sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA== + eslint@^9.31.0: version "9.39.1" resolved "https://registry.yarnpkg.com/eslint/-/eslint-9.39.1.tgz#be8bf7c6de77dcc4252b5a8dcb31c2efff74a6e5" @@ -4302,18 +4331,34 @@ espree@^10.0.1, espree@^10.4.0: acorn-jsx "^5.3.2" eslint-visitor-keys "^4.2.1" +espree@^11.2.0: + version "11.2.0" + resolved "https://registry.yarnpkg.com/espree/-/espree-11.2.0.tgz#01d5e47dc332aaba3059008362454a8cc34ccaa5" + integrity sha512-7p3DrVEIopW1B1avAGLuCSh1jubc01H2JHc8B4qqGblmg5gI9yumBgACjWo4JlIc04ufug4xJ3SQI8HkS/Rgzw== + dependencies: + acorn "^8.16.0" + acorn-jsx "^5.3.2" + eslint-visitor-keys "^5.0.1" + esprima@^4.0.0, esprima@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== -esquery@^1.5.0, esquery@^1.6.0: +esquery@^1.5.0: version "1.6.0" resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.6.0.tgz#91419234f804d852a82dceec3e16cdc22cf9dae7" integrity sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg== dependencies: estraverse "^5.1.0" +esquery@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.7.0.tgz#08d048f261f0ddedb5bae95f46809463d9c9496d" + integrity sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g== + dependencies: + estraverse "^5.1.0" + esrecurse@^4.3.0: version "4.3.0" resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" @@ -5048,6 +5093,11 @@ html-entities@^2.3.2: resolved "https://registry.yarnpkg.com/html-entities/-/html-entities-2.5.2.tgz#201a3cf95d3a15be7099521620d19dfb4f65359f" integrity sha512-K//PSRMQk4FZ78Kyau+mZurHn3FH0Vwr+H36eE0rPbeYkRRi9YxceYPhuN60UwWorxyKHhqoAJl2OFKa4BVtaA== +html-entities@^2.6.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/html-entities/-/html-entities-2.6.0.tgz#7c64f1ea3b36818ccae3d3fb48b6974208e984f8" + integrity sha512-kig+rMn/QOVRvr7c86gQ8lWXq+Hkv6CbAH1hLu+RG338StTpE8Z0b44SDVaqVu7HGKf27frdmUYEs9hTUX/cLQ== + html-escaper@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" @@ -6200,10 +6250,10 @@ jsbn@~0.1.0: resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" integrity sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg== -jsdoc-type-pratt-parser@~4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-4.1.0.tgz#ff6b4a3f339c34a6c188cbf50a16087858d22113" - integrity sha512-Hicd6JK5Njt2QB6XYFS7ok9e37O8AYk3jTcppG4YVQnYjOemymvTcmc7OWsmq/Qqj5TdRFO5/x/tIPmBeRtGHg== +jsdoc-type-pratt-parser@~7.2.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-7.2.0.tgz#0a29c27bd4e01e85e4617625e34e797be1486a9b" + integrity sha512-dh140MMgjyg3JhJZY/+iEzW+NO5xR2gpbDFKHqotCmexElVntw7GjWjt511+C/Ef02RU5TKYrJo/Xlzk+OLaTw== jsdom@^20.0.0: version "20.0.3" @@ -6790,6 +6840,11 @@ object-assign@^4.0.1, object-assign@^4.1.1: resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== +object-deep-merge@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/object-deep-merge/-/object-deep-merge-2.0.0.tgz#94d24cf713d4a7a143653500ff4488a2d494681f" + integrity sha512-3DC3UMpeffLTHiuXSy/UG4NOIYTLlY9u3V82+djSCLYClWobZiS4ivYzpIUWrRY/nfsJ8cWsKyG3QfyLePmhvg== + object-inspect@^1.13.1: version "1.13.1" resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.1.tgz#b96c6109324ccfef6b12216a956ca4dc2ff94bc2" @@ -7614,6 +7669,11 @@ requires-port@^1.0.0: resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ== +reserved-identifiers@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/reserved-identifiers/-/reserved-identifiers-1.2.0.tgz#d2982cd698e317dd3dced1ee1c52412dbd64fc64" + integrity sha512-yE7KUfFvaBFzGPs5H3Ops1RevfUEsDc5Iz65rOwWg4lE8HJSYtle77uul3+573457oHvBKuHYDl/xqUkKpEEdw== + resolve-cwd@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d" @@ -7883,10 +7943,10 @@ semver@^7.6.0: resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.2.tgz#1e3b34759f896e8f14d6134732ce798aeb0c6e13" integrity sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w== -semver@^7.7.2: - version "7.7.3" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.7.3.tgz#4b5f4143d007633a8dc671cd0a6ef9147b8bb946" - integrity sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q== +semver@^7.7.4: + version "7.8.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.8.0.tgz#ed0661039fcbcda2ce71f01fa6adbefaa77040df" + integrity sha512-AcM7dV/5ul4EekoQ29Agm5vri8JNqRyj39o0qpX6vDF2GZrtutZl5RwgD1XnZjiTAfncsJhMI48QQH3sN87YNA== send@0.18.0: version "0.18.0" @@ -8511,6 +8571,14 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" +to-valid-identifier@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/to-valid-identifier/-/to-valid-identifier-1.0.0.tgz#27337955333c3c517feb60bea533cf27ce54b79f" + integrity sha512-41wJyvKep3yT2tyPqX/4blcfybknGB4D+oETKLs7Q76UiPqRpUJK3hr1nxelyYO0PHKVzJwlu0aCeEAsGI6rpw== + dependencies: + "@sindresorhus/base62" "^1.0.0" + reserved-identifiers "^1.0.0" + toidentifier@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" From e6d4df6d54523dc4a27adbbed37ae87a6f57eff8 Mon Sep 17 00:00:00 2001 From: Dave Roberts Date: Thu, 17 Jul 2025 12:09:37 +0100 Subject: [PATCH 05/14] Formatted and changed code with ESLint fixes - functionality has not changed Removed cjs from eslint - cjs are used for internal development files, and should never be included --- eslint.config.mjs | 2 +- .../button/lib/remove-curval-button.test.js | 2 +- .../button/lib/show-blank-button.test.ts | 2 +- .../button/lib/submit-field-button.ts | 1 - .../components/collapsible/lib/component.js | 2 +- .../components/dashboard/lib/react/api.tsx | 3 +- .../components/data-table/lib/component.js | 62 +++++++++---------- .../components/data-table/lib/helper.test.ts | 2 +- .../form-group/autosave/lib/autosave.test.ts | 1 - .../help-view/lib/component.test.ts | 1 - .../sidebar/lib/sidebarObservable.js | 2 - src/frontend/js/lib/set-field-value.test.ts | 2 - .../lib/encryptedStorage.test.ts | 6 -- .../js/lib/util/filedrag/lib/filedrag.test.ts | 1 - .../js/lib/util/mapper/formdataMapper.test.ts | 1 - .../lib/storageProvider.test.ts | 2 +- .../typeahead/lib/TypeaheadBuilder.test.ts | 1 - yarn.lock | 41 +++++++++++- 18 files changed, 77 insertions(+), 57 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 6a1b52159..c11e44cf9 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -9,7 +9,7 @@ import jsdoc from "eslint-plugin-jsdoc"; export default defineConfig([ { settings: { react: { version: "detect" } } }, - { ignores: ["eslint.config.mjs", "**/public/**", "**/node_modules/**", "**/cypress/**", "cypress.config.ts", ".stylelintrc.js", "src/frontend/testing/**", "src/frontend/css/stylesheets/external/**", "src/frontend/components/dashboard/lib/react/polyfills/**", "babel.config.js", "webpack.config.js", "jest.config.js", "tsconfig.json", "src/frontend/js/lib/jqplot/**", "src/frontend/js/lib/jquery/**", "src/frontend/js/lib/plotly/**", "src/frontend/components/timeline/**", "fengari-web.js"] }, + { ignores: ["*.cjs", "eslint.config.mjs", "**/public/**", "**/node_modules/**", "**/cypress/**", "cypress.config.ts", ".stylelintrc.js", "src/frontend/testing/**", "src/frontend/css/stylesheets/external/**", "src/frontend/components/dashboard/lib/react/polyfills/**", "babel.config.js", "webpack.config.js", "jest.config.js", "tsconfig.json", "src/frontend/js/lib/jqplot/**", "src/frontend/js/lib/jquery/**", "src/frontend/js/lib/plotly/**", "src/frontend/components/timeline/**", "fengari-web.js"] }, { files: ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"], plugins: { js }, extends: ["js/recommended"] }, { files: ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"], languageOptions: { globals: { ...globals.browser, ...globals.jquery } } }, tseslint.configs.recommended, diff --git a/src/frontend/components/button/lib/remove-curval-button.test.js b/src/frontend/components/button/lib/remove-curval-button.test.js index 5d854852c..a22dd35f8 100644 --- a/src/frontend/components/button/lib/remove-curval-button.test.js +++ b/src/frontend/components/button/lib/remove-curval-button.test.js @@ -61,4 +61,4 @@ describe('RemoveCurvalButton', () => { button.click(); expect(current.children.length).toBe(0); }); -}); +}); \ No newline at end of file diff --git a/src/frontend/components/button/lib/show-blank-button.test.ts b/src/frontend/components/button/lib/show-blank-button.test.ts index ee0237e2a..3d13895ca 100644 --- a/src/frontend/components/button/lib/show-blank-button.test.ts +++ b/src/frontend/components/button/lib/show-blank-button.test.ts @@ -29,4 +29,4 @@ describe('ShowBlankButton', () => { button.trigger('click'); expect(item.css('display')).toBe('none'); }); -}); +}); \ No newline at end of file diff --git a/src/frontend/components/button/lib/submit-field-button.ts b/src/frontend/components/button/lib/submit-field-button.ts index 905c3885f..530a72b9d 100644 --- a/src/frontend/components/button/lib/submit-field-button.ts +++ b/src/frontend/components/button/lib/submit-field-button.ts @@ -97,7 +97,6 @@ export default class SubmitFieldButton { url: this.getURL(data), data: { data: mytext, csrf_token: data.csrfToken } }).done(() => { - alert('Tree has been updated'); }); } diff --git a/src/frontend/components/collapsible/lib/component.js b/src/frontend/components/collapsible/lib/component.js index 3a323a203..f6a282bf7 100644 --- a/src/frontend/components/collapsible/lib/component.js +++ b/src/frontend/components/collapsible/lib/component.js @@ -1,7 +1,7 @@ import { Component } from 'component'; /** - * + * CollapsibleComponent class that initializes the collapsible component and handles the toggle functionality for collapsing and expanding content. */ class CollapsibleComponent extends Component { /** diff --git a/src/frontend/components/dashboard/lib/react/api.tsx b/src/frontend/components/dashboard/lib/react/api.tsx index f199cddce..de7c32d5d 100644 --- a/src/frontend/components/dashboard/lib/react/api.tsx +++ b/src/frontend/components/dashboard/lib/react/api.tsx @@ -100,6 +100,7 @@ export default class ApiClient { const strippedLayout = layout.map(widget => ({ ...widget, moved: undefined })); return this.PUT(`/dashboard/${id}`, strippedLayout); } + return Promise.resolve(new Response()); }; /** @@ -127,7 +128,7 @@ export default class ApiClient { * @param {string} id The ID of the widget to delete. * @returns {promise} A promise that resolves when the widget is deleted. */ - deleteWidget = (id: string): Promise => !this.isDev && this.DELETE(`/widget/${id}`); + deleteWidget = (id: string): Promise => this.isDev ? Promise.resolve(new Response()) : this.DELETE(`/widget/${id}`); /** * Get the edit form for a widget. diff --git a/src/frontend/components/data-table/lib/component.js b/src/frontend/components/data-table/lib/component.js index b47401a6e..639bca9b0 100644 --- a/src/frontend/components/data-table/lib/component.js +++ b/src/frontend/components/data-table/lib/component.js @@ -37,7 +37,7 @@ class DataTableComponent extends Component { * Initializes the DataTable component */ initTable() { - if (this.hasClearState) { + if(this.hasClearState) { this.clearTableStateForPage(); const url = new URL(window.location.href); @@ -49,7 +49,7 @@ class DataTableComponent extends Component { } const conf = this.getConf(); - const { columns } = conf; + const {columns} = conf; this.columns = columns; this.el.DataTable(conf); this.initializingTable = true; @@ -62,7 +62,7 @@ class DataTableComponent extends Component { if (this.el.hasClass('table-account-requests')) { this.modal = $.find('#userModal'); this.initClickableTable(); - this.el.on('draw.dt', () => { + this.el.on('draw.dt', ()=> { this.initClickableTable(); }); } @@ -91,7 +91,7 @@ class DataTableComponent extends Component { */ clearTableStateForPage() { for (let i = 0; i < localStorage.length; i++) { - const storageKey = localStorage.key(i); + const storageKey = localStorage.key( i ); if (!storageKey.startsWith('DataTables')) { continue; @@ -103,7 +103,7 @@ class DataTableComponent extends Component { continue; } - if (window.location.href.indexOf('/' + keySegments.slice(1).join('/')) !== -1) { + if(window.location.href.indexOf('/' + keySegments.slice(1).join('/')) !== -1) { localStorage.removeItem(storageKey); } } @@ -194,9 +194,9 @@ class DataTableComponent extends Component { getCheckboxElement(id, label) { return ( '
' + - `` + - `` + - '
' + `` + + `` + + '
' ); } @@ -219,10 +219,10 @@ class DataTableComponent extends Component { }); // Check if the 'select all' checkbox is checked and all checkboxes need to be checked - $selectAllElm.find('input').on('click', (ev) => { + $selectAllElm.find('input').on( 'click', (ev) => { const checkbox = $(ev.target); - if ($(checkbox).is(':checked')) { + if ($(checkbox).is( ':checked' )) { this.checkAllCheckboxes($checkBoxes, true); } else { this.checkAllCheckboxes($checkBoxes, false); @@ -237,7 +237,7 @@ class DataTableComponent extends Component { */ checkAllCheckboxes($checkBoxes, bCheckAll) { if (bCheckAll) { - $checkBoxes.prop('checked', true); + $checkBoxes.prop( 'checked', true ); } else { $checkBoxes.prop('checked', false); } @@ -285,7 +285,7 @@ class DataTableComponent extends Component { .find('.data-table__header-wrapper') .html($button); - dataTable.order.listener($button, column.index()); + dataTable.order.listener($button, column.index() ); } /** @@ -316,9 +316,9 @@ class DataTableComponent extends Component { const title = $header.text().trim(); const searchValue = column.search(); const self = this; - const { context } = column; - const { oAjaxData } = context[0]; - const { columns } = oAjaxData; + const {context} = column; + const {oAjaxData} = context[0]; + const {columns} = oAjaxData; const columnId = columns[column.index()].name; const col = this.columns[column.index()]; @@ -416,7 +416,7 @@ class DataTableComponent extends Component { self.toggleFilter(column); // Update or add the filter to the searchParams - if (self.searchParams.has(id)) { + if(self.searchParams.has(id)) { self.searchParams.set(id, this.value); } else { self.searchParams.append(id, this.value); @@ -560,7 +560,7 @@ class DataTableComponent extends Component { thisHTML += `

${this.encodeHTMLEntities(detail.definition)}: ${strDecodedValue}

`; } }); - thisHTML += ''; + thisHTML += ''; strHTML += ( `